Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
39 changes: 31 additions & 8 deletions src/app/meet/[meetingId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Metadata } from 'next';
import Link from 'next/link';

import { getMeetingById } from '@/entities/meet/api/getMeetingById';
Expand All @@ -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<Metadata> {
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 {
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/entities/meet/dto/meet.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const participantDto = z.object({
id: z.number(),
name: z.string(),
voteDates: z.array(z.string()),
hasVoted: z.boolean(),
});

/**
Expand Down
8 changes: 4 additions & 4 deletions src/features/vote-results-calendar/ui/VoteResultsShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className='flex flex-col gap-6' ref={calendarRef}>
Expand All @@ -44,7 +44,7 @@ export function VoteResultsShell({
{selectedDate && (
<div
ref={detailRef}
className='animate-in slide-in-from-top-4 fade-in rounded-xl border border-slate-100 bg-white p-6 shadow-sm duration-300'
className='animate-in slide-in-from-top-4 fade-in scroll-mb-24 rounded-xl border border-slate-100 bg-white p-6 shadow-sm duration-300'
>
<div className='mb-6 flex items-start justify-between'>
<div>
Expand Down