diff --git a/src/app/[lng]/(common)/(needSidebar)/notice/[id]/AddAdditionalNotice.tsx b/src/app/[lng]/(common)/(needSidebar)/notice/[id]/AddAdditionalNotice.tsx index 5e22d249..6a715427 100644 --- a/src/app/[lng]/(common)/(needSidebar)/notice/[id]/AddAdditionalNotice.tsx +++ b/src/app/[lng]/(common)/(needSidebar)/notice/[id]/AddAdditionalNotice.tsx @@ -6,11 +6,12 @@ import 'react-datetime-picker/dist/DateTimePicker.css'; import { Dayjs } from 'dayjs'; import { RefObject, useState } from 'react'; + import { PropsWithLng } from '@/app/i18next'; import { useTranslation } from '@/app/i18next/client'; import AddIcon from '@/assets/icons/add.svg'; -interface AddAddtionalNoticesProps { +interface AddAdditionalNoticesProps { noticeId: number; originallyHasDeadline: string | Dayjs | null; supportedLanguage: string[]; @@ -25,7 +26,7 @@ const AddAdditionalNotice = ({ supportedLanguage, originallyHasDeadline, lng, -}: AddAddtionalNoticesProps & PropsWithLng) => { +}: AddAdditionalNoticesProps & PropsWithLng) => { const [content, setContent] = useState(''); const [englishContent, setEnglishContent] = useState(''); diff --git a/src/app/[lng]/(common)/(needSidebar)/notice/[id]/AdditionalNotices.tsx b/src/app/[lng]/(common)/(needSidebar)/notice/[id]/AdditionalNotices.tsx index 02e6ae1f..71dea9c2 100644 --- a/src/app/[lng]/(common)/(needSidebar)/notice/[id]/AdditionalNotices.tsx +++ b/src/app/[lng]/(common)/(needSidebar)/notice/[id]/AdditionalNotices.tsx @@ -1,19 +1,19 @@ import dayjs from 'dayjs'; import { Content, NoticeDetail } from '@/api/notice/notice'; -import { PropsWithLng, T } from '@/app/i18next'; +import { createTranslation, PropsWithLng } from '@/app/i18next'; interface AdditionalNoticesProps { notice: NoticeDetail; additionalContents: Content[]; - t: T; } const AdditionalNotices = async ({ notice, additionalContents, - t, -}: AdditionalNoticesProps & PropsWithLng) => { + lng, +}: PropsWithLng) => { + const { t } = await createTranslation(lng); return (
{additionalContents.map((content, index) => { diff --git a/src/app/[lng]/(common)/(needSidebar)/notice/[id]/ImageStack.tsx b/src/app/[lng]/(common)/(needSidebar)/notice/[id]/ImageStack.tsx index ef9e2c3e..cd91a750 100644 --- a/src/app/[lng]/(common)/(needSidebar)/notice/[id]/ImageStack.tsx +++ b/src/app/[lng]/(common)/(needSidebar)/notice/[id]/ImageStack.tsx @@ -9,13 +9,13 @@ import ShowcaseModal from './ShowcaseModal'; interface ImageStackProps { width?: number; - srcs: string[]; + sources: string[]; alt: string; } const ImageStack = ({ width, - srcs, + sources, alt, lng, }: ImageStackProps & PropsWithLng) => { @@ -32,7 +32,7 @@ const ImageStack = ({ return ( <>
- {srcs.map((src, i) => ( + {sources.map((src, i) => (
setIsShowcaseOpen(false)} diff --git a/src/app/[lng]/(common)/(needSidebar)/notice/[id]/page.tsx b/src/app/[lng]/(common)/(needSidebar)/notice/[id]/page.tsx index b1ce1ab1..533286e9 100644 --- a/src/app/[lng]/(common)/(needSidebar)/notice/[id]/page.tsx +++ b/src/app/[lng]/(common)/(needSidebar)/notice/[id]/page.tsx @@ -43,20 +43,31 @@ interface DetailedNoticePageProps { const DetailedNoticePage = async ({ params: { id, lng }, }: DetailedNoticePageProps) => { - const { t } = await createTranslation(lng, 'translation'); const notice = await getNotice(Number.parseInt(id), lng).catch(() => null); if (!notice) return notFound(); const title = notice.title; + const additionalContents = Object.values( + notice.additionalContents.reduce< + Record + >( + (prev, curr) => ({ + ...prev, + [curr.id]: prev[curr.id]?.lang === lng ? prev[curr.id] : curr, + }), + {}, + ), + ); + return (
- {/* DESKTOP VIEW IMAGESTACK */} + {/* DESKTOP VIEW IMAGE STACK */}
{notice.imageUrls.length > 0 && ( - + )}
@@ -67,12 +78,12 @@ const DetailedNoticePage = async ({ lng={lng} /> - {/* MOBILE VIEW IMAGESTACK */} + {/* MOBILE VIEW IMAGE STACK */}
{notice.imageUrls.length > 0 && ( @@ -84,9 +95,8 @@ const DetailedNoticePage = async ({
diff --git a/src/app/[lng]/(write)/write/AttatchPhotoArea.tsx b/src/app/[lng]/(write)/write/AttachPhotoArea.tsx similarity index 100% rename from src/app/[lng]/(write)/write/AttatchPhotoArea.tsx rename to src/app/[lng]/(write)/write/AttachPhotoArea.tsx diff --git a/src/app/[lng]/(write)/write/NoticeEditor.tsx b/src/app/[lng]/(write)/write/NoticeEditor.tsx index 9b2a662d..6096a6ed 100644 --- a/src/app/[lng]/(write)/write/NoticeEditor.tsx +++ b/src/app/[lng]/(write)/write/NoticeEditor.tsx @@ -34,7 +34,7 @@ import { NOTICE_LOCAL_STORAGE_KEY } from '@/utils/constants'; import { WarningSwal } from '@/utils/swals'; import { calculateRemainingTime } from '@/utils/utils'; -import AttachPhotoArea, { FileWithUrl } from './AttatchPhotoArea'; +import AttachPhotoArea, { FileWithUrl } from './AttachPhotoArea'; import DeepLButton from './DeepLButton'; import EditableTimer from './EditableTimer'; import handleNoticeSubmit from './handle-notice-submit'; @@ -487,7 +487,7 @@ const NoticeEditor = ({