-
Notifications
You must be signed in to change notification settings - Fork 0
[DEV] 배경화면 관련 스타일 변경 #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 6 commits
cac8a97
9973259
6060fcc
ffcbac1
56363ca
e37b191
a02bb00
f7cdc82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import IconWandStars from '../../icon/wand_stars.svg?react' | |
| import IconAddPhoto from '../../icon/add_photo_alternate.svg?react' | ||
| import useCreateMoodboard from '../../hooks/useCreateMoodboard' | ||
| import useUploadImage from '../../hooks/useUploadImage' | ||
| import usePatchMagazineCover from '../../hooks/usePatchMagazineCover' | ||
| import ConfirmModal from '../common/ConfirmModal' | ||
| import Toast from '../common/Toast' | ||
|
|
||
|
|
@@ -15,6 +16,7 @@ export default function ScreenSettings() { | |
| const fileInputRef = useRef<HTMLInputElement>(null) | ||
| const { mutateAsync: uploadImage } = useUploadImage() | ||
| const { mutateAsync: createMoodboard } = useCreateMoodboard() | ||
| const { mutateAsync: patchCover } = usePatchMagazineCover() | ||
|
|
||
| const handleOpenFile = () => { | ||
| fileInputRef.current?.click() | ||
|
|
@@ -24,7 +26,8 @@ export default function ScreenSettings() { | |
| const file = e.target.files?.[0] | ||
| if (!file) return | ||
| try { | ||
| await uploadImage(file) | ||
| const { imageUrl } = await uploadImage(file) | ||
| await patchCover({ id: Number(magazineId), coverImageUrl: imageUrl }) | ||
| setShowToast(true) | ||
| setTimeout(() => setShowToast(false), 3000) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
다음은 useEffect(() => {
if (showToast) {
const timerId = setTimeout(() => {
setShowToast(false);
}, 3000);
return () => clearTimeout(timerId);
}
}, [showToast]);이렇게 수정하면 각 핸들러 함수에서는
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 수정해야할까요? |
||
| } catch (error) { | ||
|
|
@@ -52,15 +55,15 @@ export default function ScreenSettings() { | |
| <div className="w-136.5 h-36.5 flex gap-6.5"> | ||
| <button | ||
| onClick={() => setIsConfirmOpen(true)} | ||
| className="flex flex-col w-65 h-full rounded-2xl border border-white/30 bg-white/10 items-center justify-center gap-3 text-white/70 transition-colors duration-150 hover:bg-white/20 hover:border-white/50 hover:text-white" | ||
| className="flex flex-col w-65 h-full rounded-2xl border border-gray-100-op40 bg-gray-500-op40 items-center justify-center gap-3 text-gray-100-op70 transition-colors duration-150 hover:bg-white/20 hover:border-gray-100-op40 hover:text-gray-100-op70" | ||
| > | ||
| <IconWandStars className="w-6 h-6 aspect-square **:stroke-current **:fill-current" /> | ||
| <IconWandStars className="w-6 h-6 aspect-square **:fill-current" /> | ||
| <span className="font-regular14">AI로 무드보드 생성하기</span> | ||
| </button> | ||
|
|
||
| <button | ||
| onClick={handleOpenFile} | ||
| className="flex flex-col w-65 h-full rounded-2xl border border-white/30 bg-white/10 items-center justify-center gap-3 text-white/70 transition-colors duration-150 hover:bg-white/20 hover:border-white/50 hover:text-white" | ||
| className="flex flex-col w-65 h-full rounded-2xl border border-gray-100-op40 bg-gray-500-op40 items-center justify-center gap-3 text-gray-100-op70 transition-colors duration-150 hover:bg-white/20 hover:border-gray-100-op40 hover:text-gray-100-op70" | ||
| > | ||
| <IconAddPhoto className="w-6 h-6 aspect-square **:stroke-current **:fill-current" /> | ||
| <span className="font-regular14">컴퓨터에서 이미지 가져오기</span> | ||
|
|
@@ -85,4 +88,4 @@ export default function ScreenSettings() { | |
| )} | ||
| </> | ||
| ) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import ScreenSettings from './ScreenSettings' | ||
|
|
||
| interface ScreenSettingsModalProps { | ||
| isOpen: boolean | ||
| onClose: () => void | ||
| } | ||
|
|
||
| export default function ScreenSettingsModal({ isOpen, onClose }: ScreenSettingsModalProps) { | ||
| if (!isOpen) return null | ||
|
|
||
| return ( | ||
| <div | ||
| className="fixed inset-0 bg-black/40 flex items-center justify-center z-999" | ||
| onClick={onClose} | ||
| > | ||
| <div | ||
| className="relative bg-gray-600-op70 rounded-2xl p-10 shadow-[0px_4px_4px_rgba(0,0,0,0.25)]" | ||
| onClick={(e) => e.stopPropagation()} | ||
| > | ||
| <ScreenSettings /> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { useMutation, useQueryClient } from '@tanstack/react-query' | ||
| import { patchMagazineCover } from '../api/magazine' | ||
|
|
||
| export default function usePatchMagazineCover() { | ||
| const queryClient = useQueryClient() | ||
| return useMutation({ | ||
| mutationFn: ({ id, coverImageUrl }: { id: number; coverImageUrl: string }) => | ||
| patchMagazineCover(id, coverImageUrl), | ||
| onSuccess: () => { | ||
| queryClient.invalidateQueries({ queryKey: ['magazineDetail'] }) | ||
| }, | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미지 업로드 후 표시되는 토스트 메시지가 '무드보드가 생성되었습니다.'로 고정되어 있어 사용자에게 혼란을 줄 수 있습니다. 실제 동작은 커버 이미지를 변경하는 것이므로, '커버 이미지가 변경되었습니다.'와 같이 보다 정확한 메시지를 보여주는 것이 좋습니다.
이를 위해 토스트 메시지를 상태로 관리하는 것을 고려해 보세요. 예를 들어,
const [toastMessage, setToastMessage] = useState('')와 같이 상태를 추가하고, 각 작업에 맞는 메시지를 설정한 후Toast컴포넌트에 전달할 수 있습니다.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정해야할까요?