From 1a8a159a71fd018bab0e14d9df952c53ae5ea062 Mon Sep 17 00:00:00 2001 From: yyamashita Date: Fri, 15 May 2026 00:08:25 +0900 Subject: Add bands/artists index pages and redirect top page - / now redirects to /bands - /bands shows band list with "+ Band" link - /artists shows artist list with "+ Artist" link - Nav simplified to Bands / Artists only Co-Authored-By: Claude Sonnet 4.6 --- app/root.tsx | 5 ++--- app/routes.ts | 2 ++ app/routes/artist-index.tsx | 33 +++++++++++++++++++++++++++++++++ app/routes/band-index.tsx | 36 ++++++++++++++++++++++++++++++++++++ app/routes/home.tsx | 28 +++------------------------- 5 files changed, 76 insertions(+), 28 deletions(-) create mode 100644 app/routes/artist-index.tsx create mode 100644 app/routes/band-index.tsx diff --git a/app/root.tsx b/app/root.tsx index 242ffe2..e30abe8 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -49,9 +49,8 @@ export default function App() { diff --git a/app/routes.ts b/app/routes.ts index b02a70a..0a2c028 100644 --- a/app/routes.ts +++ b/app/routes.ts @@ -6,11 +6,13 @@ export default [ route("/api/artists", "routes/api-artists.tsx"), route("/api/export", "routes/api-export.tsx"), route("/api/import", "routes/api-import.tsx"), + route("/bands", "routes/band-index.tsx"), route("/bands/new", "routes/band-new.tsx"), route("/bands/of/:uuid", "routes/band-by-uuid.tsx"), route("/bands/named/:slug", "routes/band-by-slug.tsx"), route("/bands/of/:uuid/edit", "routes/band-edit.tsx"), route("/bands/of/:uuid/history", "routes/band-history.tsx"), + route("/artists", "routes/artist-index.tsx"), route("/artists/new", "routes/artist-new.tsx"), route("/artists/of/:uuid", "routes/artist-by-uuid.tsx"), route("/artists/named/:slug", "routes/artist-by-slug.tsx"), diff --git a/app/routes/artist-index.tsx b/app/routes/artist-index.tsx new file mode 100644 index 0000000..9981567 --- /dev/null +++ b/app/routes/artist-index.tsx @@ -0,0 +1,33 @@ +import { Link, useLoaderData } from "react-router"; +import { listArtists } from "~/lib/db.server"; + +export function loader() { + return { artists: listArtists() }; +} + +export default function ArtistIndex() { + const { artists } = useLoaderData(); + return ( +
+
+

Artists

+ + Artist +
+ + {artists.length === 0 ? ( +

+ アーティストがまだありません。{" "} + 追加する +

+ ) : ( +
    + {artists.map((artist) => ( +
  • + {artist.name} +
  • + ))} +
+ )} +
+ ); +} diff --git a/app/routes/band-index.tsx b/app/routes/band-index.tsx new file mode 100644 index 0000000..0b47da5 --- /dev/null +++ b/app/routes/band-index.tsx @@ -0,0 +1,36 @@ +import { Link, useLoaderData } from "react-router"; +import { listBands } from "~/lib/db.server"; + +export function loader() { + return { bands: listBands() }; +} + +export default function BandIndex() { + const { bands } = useLoaderData(); + return ( +
+
+

Bands

+ + Band +
+ + {bands.length === 0 ? ( +

+ バンドがまだありません。{" "} + 追加する +

+ ) : ( +
    + {bands.map((band) => ( +
  • + {band.name} + {band.status === "hiatus" && ( + 活動休止 + )} +
  • + ))} +
+ )} +
+ ); +} diff --git a/app/routes/home.tsx b/app/routes/home.tsx index ef6912d..9795ba8 100644 --- a/app/routes/home.tsx +++ b/app/routes/home.tsx @@ -1,31 +1,9 @@ -import { Link, useLoaderData } from "react-router"; -import { listBands } from "~/lib/db.server"; +import { redirect } from "react-router"; export function loader() { - return { bands: listBands() }; + return redirect("/bands"); } export default function Home() { - const { bands } = useLoaderData(); - return ( -
- {bands.length === 0 ? ( -

- バンドがまだありません。{" "} - 追加する -

- ) : ( -
    - {bands.map((band) => ( -
  • - {band.name} - {band.status === "hiatus" && ( - 活動休止 - )} -
  • - ))} -
- )} -
- ); + return null; } -- cgit v1.2.3