diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 57a4dc8..5c5dc61 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -14,8 +14,8 @@ const geistMono = Geist_Mono({ }); export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', + title: 'MOIT | 모두의 만남을 잇다, 모잇', + description: '모잇으로 모임 일정을 쉽게 조율해보세요', }; export default function RootLayout({ diff --git a/src/app/meet/[meetingId]/page.tsx b/src/app/meet/[meetingId]/page.tsx index 75f48fd..c9cc82a 100644 --- a/src/app/meet/[meetingId]/page.tsx +++ b/src/app/meet/[meetingId]/page.tsx @@ -1,3 +1,4 @@ +import { Metadata } from 'next'; import Link from 'next/link'; import { getMeetingById } from '@/entities/meet/api/getMeetingById'; @@ -10,16 +11,44 @@ import { VoteResultDataView } from '@/widgets/vote-result/ui/VoteResultDataView' import ParticipantHeader from './ParticipantHeader'; +interface PageProps { + params: Promise<{ + meetingId: string; + }>; +} + +export async function generateMetadata({ + params, +}: PageProps): Promise { + const { meetingId } = await params; + + try { + const meetingData = await getMeetingById(meetingId); + return { + title: `${meetingData.hostName}님이 초대한 ${meetingData.title}`, + description: 'MOIT | 모두의 만남을 잇다, 모잇', + }; + } catch { + return { + title: 'MOIT | 모두의 만남을 잇다, 모잇', + description: '모잇으로 모임 일정을 쉽게 조율해보세요', + }; + } +} + // Transform Logic function getStatsFromParticipants( candidateDates: string[], participants: Participant[], ) { + // 투표한 참여자만 필터링 + const votedParticipants = participants.filter((p) => p.hasVoted); + return candidateDates.map((date) => { const can: Person[] = []; const cannot: Person[] = []; - participants.forEach((p) => { + votedParticipants.forEach((p) => { if (p.voteDates.includes(date)) { can.push({ id: String(p.id), name: p.name }); } else { @@ -35,13 +64,7 @@ function getStatsFromParticipants( }); } -interface ResultPageProps { - params: Promise<{ - meetingId: string; - }>; -} - -export default async function ResultPage({ params }: ResultPageProps) { +export default async function ResultPage({ params }: PageProps) { const { meetingId } = await params; // Fetch meeting data from API const meetingData = await getMeetingById(meetingId); diff --git a/src/entities/meet/dto/meet.dto.ts b/src/entities/meet/dto/meet.dto.ts index 83808ac..b8effb1 100644 --- a/src/entities/meet/dto/meet.dto.ts +++ b/src/entities/meet/dto/meet.dto.ts @@ -35,6 +35,7 @@ export const participantDto = z.object({ id: z.number(), name: z.string(), voteDates: z.array(z.string()), + hasVoted: z.boolean(), }); /** diff --git a/src/features/vote-results-calendar/ui/VoteResultsShell.tsx b/src/features/vote-results-calendar/ui/VoteResultsShell.tsx index 9b8fae7..582fefd 100644 --- a/src/features/vote-results-calendar/ui/VoteResultsShell.tsx +++ b/src/features/vote-results-calendar/ui/VoteResultsShell.tsx @@ -26,12 +26,12 @@ export function VoteResultsShell({ // Scroll to detail when opened useEffect(() => { if (selectedDate && detailRef.current) { - calendarRef?.current?.scrollIntoView({ + detailRef.current.scrollIntoView({ behavior: 'smooth', - block: 'start', + block: 'end', }); } - }, [selectedDate, calendarRef]); + }, [selectedDate]); return (
@@ -44,7 +44,7 @@ export function VoteResultsShell({ {selectedDate && (