From e9e576abd9d6c6030aa4bb290e869890831488ad Mon Sep 17 00:00:00 2001 From: yyamashita Date: Mon, 11 May 2026 00:06:52 +0900 Subject: Add lists feature (band recommendation lists with history) New lists, list_entries, list_revisions tables; full CRUD routes under /lists; nav link in root. Co-Authored-By: Claude Sonnet 4.6 --- app/routes/list-history.tsx | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 app/routes/list-history.tsx (limited to 'app/routes/list-history.tsx') diff --git a/app/routes/list-history.tsx b/app/routes/list-history.tsx new file mode 100644 index 0000000..c47614b --- /dev/null +++ b/app/routes/list-history.tsx @@ -0,0 +1,48 @@ +import { data, Link, useLoaderData } from "react-router"; +import type { LoaderFunctionArgs } from "react-router"; +import { getBandListById, getListRevisions } from "~/lib/db.server"; + +export async function loader({ params }: LoaderFunctionArgs) { + const list = getBandListById(params.uuid!); + if (!list) throw data("Not found", { status: 404 }); + const revisions = getListRevisions(list.id); + return { list, revisions }; +} + +export default function ListHistory() { + const { list, revisions } = useLoaderData(); + return ( +
+
+ ← +

{list.title} — 編集履歴

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

履歴がありません。

+ ) : ( +
    + {revisions.map((rev, i) => { + let snap: { title?: string; entries?: unknown[] } = {}; + try { snap = JSON.parse(rev.snapshot); } catch { /* ignore */ } + return ( +
  1. +
    +
    +

    {rev.message}

    +

    {rev.created_at} · {rev.ip_address}

    +
    + {i === 0 && 最新} +
    +
    +

    タイトル: {snap.title ?? "—"}

    +

    エントリ数: {snap.entries?.length ?? 0}件

    +
    +
  2. + ); + })} +
+ )} +
+ ); +} -- cgit v1.2.3