diff --git a/src/app/log/[id]/page.tsx b/src/app/log/[id]/page.tsx new file mode 100644 index 0000000..949a6eb --- /dev/null +++ b/src/app/log/[id]/page.tsx @@ -0,0 +1,68 @@ +'use client'; + +import { useEffect, useState, use } from 'react'; +import { useRouter } from 'next/navigation'; +import Link from 'next/link'; +import { getHistory } from '@/lib/store'; +import { Voyage } from '@/types'; + +export default function LogDetailPage({ params }: { params: Promise<{ id: string }> }) { + // Next.js 15: params is a Promise + const resolvedParams = use(params); + const router = useRouter(); + const [log, setLog] = useState(null); + + useEffect(() => { + const history = getHistory(); + const found = history.find(item => item.id === resolvedParams.id); + if (found) setLog(found); + }, [resolvedParams.id]); + + if (!log) return
Loading or Not Found...
; + + return ( +
+
+ ← 목록으로 +

{log.missionText}

+
+ {new Date(log.startedAt).toLocaleString()} + + {log.routeName} ({log.durationMinutes}m) +
+
+ +
+
+

결과 상태

+

+ {log.status === 'completed' && '✅ 계획대로'} + {log.status === 'partial' && '🌓 부분 진행'} + {log.status === 'reoriented' && '🧭 방향 재설정'} + {log.status === 'aborted' && '🚨 조기 귀환'} + {log.status === 'in_progress' && '진행 중'} +

+
+ +
+
+

확보한 것

+

{log.debriefProgress || '-'}

+
+ +
+

다음 행동

+

{log.nextAction || '-'}

+
+
+ + {log.notes && ( +
+

초기 메모

+

"{log.notes}"

+
+ )} +
+
+ ); +} diff --git a/src/app/log/page.tsx b/src/app/log/page.tsx new file mode 100644 index 0000000..538adf6 --- /dev/null +++ b/src/app/log/page.tsx @@ -0,0 +1,62 @@ +'use client'; + +import { useEffect, useState } from 'react'; +import Link from 'next/link'; +import { getHistory } from '@/lib/store'; +import { Voyage, VoyageStatus } from '@/types'; + +export default function LogListPage() { + const [logs, setLogs] = useState([]); + + useEffect(() => { + setLogs(getHistory()); + }, []); + + const getStatusLabel = (s: VoyageStatus) => { + switch(s) { + case 'completed': return '✅ 계획대로'; + case 'partial': return '🌓 부분 진행'; + case 'reoriented': return '🧭 방향 재설정'; + case 'aborted': return '🚨 조기 귀환'; + default: return '진행 중'; + } + }; + + return ( +
+

나의 항해 기록

+ + {logs.length === 0 ? ( +
+

아직 기록된 항해가 없습니다.

+ + 첫 항해 떠나기 + +
+ ) : ( +
+ {logs.map((log) => ( + +
+ + {new Date(log.startedAt).toLocaleDateString()} + + + {getStatusLabel(log.status)} + +
+

+ {log.missionText} +

+

{log.routeName} · {log.durationMinutes}min

+ + ))} +
+ )} +
+ ); +}