diff --git a/src/components/ui/scrollable-date-picker.tsx b/src/components/ui/scrollable-date-picker.tsx index d0522677..a408a369 100644 --- a/src/components/ui/scrollable-date-picker.tsx +++ b/src/components/ui/scrollable-date-picker.tsx @@ -238,7 +238,7 @@ export function ScrollableDatePicker({ return (
{/* Selection Indicator */} -
+
{/* Columns Container */}
diff --git a/src/feature/create-album/components/CreateInputList.tsx b/src/feature/create-album/components/CreateInputList.tsx index baab1128..ce50816b 100644 --- a/src/feature/create-album/components/CreateInputList.tsx +++ b/src/feature/create-album/components/CreateInputList.tsx @@ -75,13 +75,12 @@ export default function CreateInputList({ onErrorChange?.(error !== '' || eventNameError !== ''); }; - // 로컬 시간대 기준으로 어제 날짜를 YYYY-MM-DD로 계산 - const yesterdayDate = new Date(); - yesterdayDate.setDate(yesterdayDate.getDate() - 1); - const yyyy = yesterdayDate.getFullYear(); - const mm = String(yesterdayDate.getMonth() + 1).padStart(2, '0'); // 0-11이므로 +1 - const dd = String(yesterdayDate.getDate()).padStart(2, '0'); - const yesterday = `${yyyy}-${mm}-${dd}`; + // 로컬 시간대 기준으로 오늘 날짜를 YYYY-MM-DD로 계산 + const todayDate = new Date(); + const yyyy = todayDate.getFullYear(); + const mm = String(todayDate.getMonth() + 1).padStart(2, '0'); // 0-11이므로 +1 + const dd = String(todayDate.getDate()).padStart(2, '0'); + const today = `${yyyy}-${mm}-${dd}`; return (
@@ -98,7 +97,7 @@ export default function CreateInputList({ value={eventDate} onChange={onEventDateChange} placeholder='YYYY-MM-DD' - max={yesterday} + max={today} /> => { + try { + await mutateAsyncDelete({ albumId, photoId }); + queryClient.invalidateQueries({ queryKey: [EP.album.photos(albumId)] }); + setIsPhotoInfoOpen(false); + } catch (e) { + console.error(e); + Toast.alert('사진 삭제에 실패했습니다.'); + } + }; const handleDeepToggle = async (): Promise => { try { @@ -105,23 +133,6 @@ export default function FooterPhotoDetail({ return (
- - - - } - > - setIsPhotoInfoOpen(false)} - /> - - + + + + } + > + +
+ + {photoDetail?.canDelete && ( + + + + } + /> + )}
); } diff --git a/src/feature/photo-detail/components/SectionPhotoData.tsx b/src/feature/photo-detail/components/SectionPhotoData.tsx index c3b598ad..1a612e63 100644 --- a/src/feature/photo-detail/components/SectionPhotoData.tsx +++ b/src/feature/photo-detail/components/SectionPhotoData.tsx @@ -1,13 +1,7 @@ -import { EP } from '@/global/api/ep'; -import ConfirmModal from '@/global/components/modal/ConfirmModal'; -import { useQueryClient } from '@tanstack/react-query'; -import { useDeleteAlbumPhotoMutation } from '../hooks/useDeleteAlbumPhotoMutation'; -import { usePhotoDetailQuery } from '../hooks/usePhotoDetailQuery'; - interface SectionPhotoDataProps { - albumId: string; - photoId: number; - onAfterDelete?: () => void; + name?: string; + captureTime?: string; + createdAt?: string; } // 촬영 시각: 사진 EXIF 시간 그대로 표시 (타임존 변환 안 함) @@ -48,68 +42,30 @@ const formatKoreanDateTime = (isoString?: string): string => { }; export default function SectionPhotoData({ - albumId, - photoId, - onAfterDelete, + name, + captureTime, + createdAt, }: SectionPhotoDataProps) { - const queryClient = useQueryClient(); - const { data, isPending, isError } = usePhotoDetailQuery({ - albumId, - photoId, - }); - const { mutateAsync } = useDeleteAlbumPhotoMutation(); - - if (isPending) return null; - if (isError) return null; - - const handleDeleteClick = async () => { - try { - await mutateAsync({ albumId, photoId }); - queryClient.invalidateQueries({ queryKey: [EP.album.photos(albumId)] }); - } finally { - onAfterDelete?.(); - } - }; - return ( -
-
+
+
업로드한 사람
-
{data?.name}
+
{name}
촬영 시각
- {formatCaptureTime(data?.captureTime)} + {formatCaptureTime(captureTime)}
업로드 시각
- {formatKoreanDateTime(data?.createdAt)} + {formatKoreanDateTime(createdAt)}
- - {data?.canDelete && ( - - 사진 삭제하기 - - } - /> - )}
); } diff --git a/src/global/api/ep.ts b/src/global/api/ep.ts index 90995760..b695f366 100644 --- a/src/global/api/ep.ts +++ b/src/global/api/ep.ts @@ -104,7 +104,7 @@ export interface PreviewPhotoInfoSchema { "photoId": number; "imageUrl": string; export interface AuthExchangeResponseSchema { "accessToken": string; "refreshToken": string; "isOnboarded": boolean; "userId": number; "name": string; "email": string; } export interface CommonResponseAuthExchangeResponseSchema { "isSuccess"?: boolean; "code"?: number; "message"?: string; "result"?: AuthExchangeResponseSchema; } export interface CommonResponsePhotoPageResponseSchema { "isSuccess"?: boolean; "code"?: number; "message"?: string; "result"?: PhotoPageResponseSchema; } -export interface PhotoListResponseSchema { "name"?: string; "photoId": number; "profileImage": string; "imageUrl"?: string; "thumbnailUrl": string; "likeCnt": number; "isLiked": boolean; "isDownloaded": boolean; "isRecentlyDownloaded": boolean; } +export interface PhotoListResponseSchema { "name"?: string; "photoId": number; "profileImage": string; "imageUrl"?: string; "thumbnailUrl": string; "likeCnt": number; "isLiked": boolean; "isDownloaded": boolean; "isRecentlyDownloaded": boolean; "canDelete"?: boolean; } export interface PhotoPageResponseSchema { "responses": PhotoListResponseSchema[]; "listSize": number; "isFirst": boolean; "isLast": boolean; "hasNext": boolean; } export interface CommonResponsePhotoDetailResponseSchema { "isSuccess"?: boolean; "code"?: number; "message"?: string; "result"?: PhotoDetailResponseSchema; } export interface PhotoDetailResponseSchema { "name": string; "profileImage": string; "photoId": number; "imageUrl": string; "thumbnailUrl": string; "likesCnt": number; "isLiked": boolean; "isDownloaded": boolean; "isRecentlyDownloaded": boolean; "canDelete"?: boolean; "captureTime"?: string; "createdAt"?: string; } diff --git a/src/global/components/modal/ConfirmModal.tsx b/src/global/components/modal/ConfirmModal.tsx index 5a509259..68ed3983 100644 --- a/src/global/components/modal/ConfirmModal.tsx +++ b/src/global/components/modal/ConfirmModal.tsx @@ -79,7 +79,7 @@ export default function ConfirmModal({ {trigger} - + {title}