Skip to content

Commit 4f01d61

Browse files
committed
🎨Using event components
1 parent 3253bc3 commit 4f01d61

File tree

3 files changed

+19
-106
lines changed

3 files changed

+19
-106
lines changed

src/routes/Event.tsx

Lines changed: 9 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { useEffect, useState } from 'react';
22
import { useNavigate, useParams } from 'react-router';
33
import { toast } from 'sonner';
4+
import EventDetailContent from '../components/EventDetailContent';
5+
import GuestSummaryList from '../components/GuestSummaryList';
46
import type { Events } from '../types/schema';
5-
import { formatEventDate } from '../utils/date';
67
// import useAuth from '../hooks/useAuth';
78

89
// shadcn UI 컴포넌트
@@ -17,15 +18,13 @@ import {
1718
AlertDialogTitle,
1819
AlertDialogTrigger,
1920
} from '@/components/ui/alert-dialog';
20-
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
2121
import { Button } from '@/components/ui/button';
2222
import {
2323
DropdownMenu,
2424
DropdownMenuContent,
2525
DropdownMenuItem,
2626
DropdownMenuTrigger,
2727
} from '@/components/ui/dropdown-menu';
28-
import { ScrollArea } from '@/components/ui/scroll-area';
2928

3029
// SVG 아이콘 컴포넌트
3130
const IconChevronLeft = () => (
@@ -204,45 +203,11 @@ export default function Event() {
204203

205204
{/* 2. 메인 콘텐츠*/}
206205
<div className="max-w-2xl min-w-[320px] mx-auto w-[90%] px-6 flex flex-col items-start gap-10">
207-
{/* 일정 정보 (왼쪽 정렬) */}
208-
<div className="text-left space-y-3 w-full">
209-
<p className="text-lg sm:text-xl font-bold text-black">
210-
일시 {formatEventDate(schedule.start_at)}
211-
</p>
212-
<p className="text-lg sm:text-xl font-bold text-black">
213-
장소 {schedule.location || '미정'}
214-
</p>
215-
</div>
216-
217-
{/* 신청 현황 버튼 */}
218-
<button
219-
onClick={() => navigate('guests')}
220-
className="flex items-center text-lg font-bold group hover:opacity-70 transition-opacity"
221-
>
222-
{schedule.capacity}명 중{' '}
223-
<span className="text-black ml-2 font-extrabold">
224-
{/* 신청 인원 필드 필요 */} 8명 신청
225-
</span>
226-
<div className="rotate-180 ml-2 group-hover:translate-x-1 transition-transform text-black">
227-
<IconChevronLeft />
228-
</div>
229-
</button>
230-
231-
{/* 상세 설명 */}
232-
<ScrollArea className="h-40 w-full rounded-md border-none">
233-
<p className="text-base text-gray-500 leading-relaxed whitespace-pre-wrap pr-4">
234-
{schedule.description}
235-
</p>
236-
</ScrollArea>
206+
{/* 일정 정보 */}
207+
<EventDetailContent schedule={schedule} />
237208

238209
{/* 모집 마감 및 링크 블록 */}
239210
<div className="w-full flex flex-col items-start">
240-
<p className="text-lg font-bold mb-6 text-black">
241-
{schedule.registration_deadline
242-
? `${formatEventDate(schedule.registration_deadline)} 모집 마감`
243-
: '상시 모집'}
244-
</p>
245-
246211
<div className="w-full bg-[#F8F9FA] rounded-3xl p-10 flex flex-col items-center gap-6 border border-gray-100">
247212
<div className="flex flex-col items-center gap-4 text-center">
248213
<div className="text-gray-400 scale-125">
@@ -263,40 +228,11 @@ export default function Event() {
263228
</div>
264229

265230
{/* 참여자 명단 섹션 */}
266-
<div className="w-full">
267-
<div className="flex justify-between items-center mb-8 px-2">
268-
<h2 className="font-bold text-2xl text-black">
269-
{/* 신청 인원 필드 필요 */}
270-
참여자 명단(8)
271-
</h2>
272-
<Button
273-
variant="link"
274-
onClick={() => navigate('guests')}
275-
className="text-base font-bold text-black p-0 h-auto"
276-
>
277-
더보기
278-
</Button>
279-
</div>
280-
281-
{/* 링크 복사 블록과 같은 너비의 명단 박스 */}
282-
<div className="border-2 border-black p-10 bg-white">
283-
<div className="grid grid-cols-4 gap-8">
284-
{displayGuests.map((p, idx) => (
285-
<div key={idx} className="flex flex-col items-center gap-4">
286-
<Avatar className="w-16 h-16 border-none">
287-
<AvatarImage src={p.img} />
288-
<AvatarFallback className="bg-black text-white text-xs">
289-
{p.name}
290-
</AvatarFallback>
291-
</Avatar>
292-
<span className="text-sm font-bold text-gray-700">
293-
{p.name}
294-
</span>
295-
</div>
296-
))}
297-
</div>
298-
</div>
299-
</div>
231+
<GuestSummaryList
232+
guests={displayGuests}
233+
totalCount={8}
234+
eventId={schedule.id}
235+
/>
300236
</div>
301237
</div>
302238
);

src/routes/EventRegisterSuccess.tsx

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { Button } from '@/components/ui/button';
2-
import { ScrollArea } from '@/components/ui/scroll-area';
32
import { useEffect, useState } from 'react';
43
import { useNavigate, useParams } from 'react-router';
4+
import EventDetailContent from '../components/EventDetailContent';
55
import type { Events } from '../types/schema';
6-
import { formatEventDate } from '../utils/date';
76

87
// shadcn UI 컴포넌트
98
import {
@@ -45,7 +44,7 @@ export default function EventRegisterSuccess() {
4544
id: Number(id) || 1,
4645
title: '제2회 기획 세미나',
4746
description:
48-
'일정 설명 일정설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명일정 설명 일정 설명 일정설명',
47+
'일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 일정설명 ...',
4948
location: '서울대',
5049
start_at: '2026-02-02T18:00:00Z',
5150
end_at: '2026-02-02T20:00:00Z',
@@ -87,34 +86,10 @@ export default function EventRegisterSuccess() {
8786
<h1 className="text-2xl sm:text-3xl font-bold flex-1 truncate text-black">
8887
{schedule.title}
8988
</h1>
90-
<p className="text-lg sm:text-xl font-bold text-black">
91-
일시 {formatEventDate(schedule.start_at)}
92-
</p>
93-
<p className="text-lg sm:text-xl font-bold text-black">
94-
장소 {schedule.location || '미정'}
95-
</p>
9689
</div>
9790

98-
{/* 신청 현황 버튼 */}
99-
<button
100-
onClick={() => navigate('guests')}
101-
className="flex items-center text-lg font-bold group hover:opacity-70 transition-opacity"
102-
>
103-
{schedule.capacity}명 중{' '}
104-
<span className="text-black ml-2 font-extrabold">
105-
{/* 신청 인원 필드 필요 */} 8명 신청
106-
</span>
107-
<div className="rotate-180 ml-2 group-hover:translate-x-1 transition-transform text-black">
108-
<IconChevronLeft />
109-
</div>
110-
</button>
111-
112-
{/* 상세 설명 */}
113-
<ScrollArea className="h-40 w-full rounded-md border-none">
114-
<p className="text-base text-gray-500 leading-relaxed whitespace-pre-wrap pr-4">
115-
{schedule.description}
116-
</p>
117-
</ScrollArea>
91+
{/* 일정 정보 */}
92+
<EventDetailContent schedule={schedule} />
11893

11994
{/* 취소 버튼 */}
12095
<AlertDialog>
@@ -123,7 +98,7 @@ export default function EventRegisterSuccess() {
12398
variant="secondary"
12499
className="w-full h-16 rounded-2xl bg-[#333333] hover:bg-black text-xl font-bold text-white transition-all shadow-lg active:scale-[0.98]"
125100
>
126-
강제취소
101+
취소하기
127102
</Button>
128103
</AlertDialogTrigger>
129104
<AlertDialogContent>

src/routes/Guests.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const IconChevronLeft = () => (
3636
interface GuestResponse {
3737
registration_id: number;
3838
name: string;
39-
email: string;
39+
email: string | null;
4040
profile_image: string | null;
4141
}
4242

@@ -77,7 +77,7 @@ export default function Guests() {
7777
{
7878
registration_id: 5,
7979
name: '이름5',
80-
email: '이메일@example.com',
80+
email: null,
8181
profile_image: null,
8282
},
8383
{
@@ -146,7 +146,9 @@ export default function Guests() {
146146
<span className="text-xl font-bold text-black">
147147
{guest.name}
148148
</span>
149-
<span className="text-gray-400 text-lg">{guest.email}</span>
149+
{guest.email ? (
150+
<span className="text-gray-400 text-lg">{guest.email}</span>
151+
) : null}
150152
</div>
151153
</div>
152154

0 commit comments

Comments
 (0)