From b8548d029760ecfa59cafedd23899a91e6120b5f Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sat, 9 May 2026 00:51:08 +0900 Subject: Add predefined link types and artist roles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - app/lib/constants.ts: LINK_TYPES (12種) and ARTIST_ROLES (13種) - Band link forms: label input → type select (公式サイト, X, Instagram, ...) - Band member forms: role text → role select (Vocal, Guitar, Bass, ...) - Band detail: resolve link type key to display label via LINK_TYPE_LABEL Co-Authored-By: Claude Sonnet 4.6 --- app/lib/constants.ts | 36 ++++++++++++++++++++++++++++++++++++ app/routes/band-by-uuid.tsx | 3 ++- app/routes/band-edit.tsx | 24 ++++++++++++++++-------- app/routes/band-new.tsx | 25 +++++++++++++++++-------- 4 files changed, 71 insertions(+), 17 deletions(-) create mode 100644 app/lib/constants.ts diff --git a/app/lib/constants.ts b/app/lib/constants.ts new file mode 100644 index 0000000..8c9fb28 --- /dev/null +++ b/app/lib/constants.ts @@ -0,0 +1,36 @@ +export const LINK_TYPES = [ + { value: "official", label: "公式サイト" }, + { value: "x", label: "X" }, + { value: "instagram", label: "Instagram" }, + { value: "youtube", label: "YouTube" }, + { value: "spotify", label: "Spotify" }, + { value: "apple_music",label: "Apple Music" }, + { value: "wikipedia", label: "Wikipedia" }, + { value: "soundcloud", label: "SoundCloud" }, + { value: "bandcamp", label: "Bandcamp" }, + { value: "tiktok", label: "TikTok" }, + { value: "linktree", label: "Linktree" }, + { value: "other", label: "その他" }, +] as const; + +export type LinkTypeValue = (typeof LINK_TYPES)[number]["value"]; + +export const LINK_TYPE_LABEL: Record = Object.fromEntries( + LINK_TYPES.map((t) => [t.value, t.label]) +); + +export const ARTIST_ROLES = [ + "Vocal", + "Guitar", + "Bass", + "Drums", + "Keyboard", + "Synthesizer", + "Violin", + "Trumpet", + "Saxophone", + "Percussion", + "DJ", + "Producer", + "Support", +] as const; diff --git a/app/routes/band-by-uuid.tsx b/app/routes/band-by-uuid.tsx index 1945a57..94a7d3c 100644 --- a/app/routes/band-by-uuid.tsx +++ b/app/routes/band-by-uuid.tsx @@ -6,6 +6,7 @@ import { getBandArtists, getBandRevisions, } from "~/lib/db.server"; +import { LINK_TYPE_LABEL } from "~/lib/constants"; export async function loader({ params }: LoaderFunctionArgs) { const band = getBandById(params.uuid!); @@ -90,7 +91,7 @@ export default function BandDetail() { rel="noopener noreferrer" className="text-blue-400 hover:text-blue-300 transition-colors text-sm" > - {l.label} + {LINK_TYPE_LABEL[l.label] ?? l.label} ))} diff --git a/app/routes/band-edit.tsx b/app/routes/band-edit.tsx index 99d4ee7..50b8bd4 100644 --- a/app/routes/band-edit.tsx +++ b/app/routes/band-edit.tsx @@ -9,6 +9,7 @@ import { listArtists, updateBand, } from "~/lib/db.server"; +import { ARTIST_ROLES, LINK_TYPES } from "~/lib/constants"; export async function loader({ params }: LoaderFunctionArgs) { const band = getBandById(params.uuid!); @@ -159,12 +160,15 @@ export default function BandEdit() {
{links.map((link, i) => (
- setLinks(links.map((l, idx) => idx === i ? { ...l, label: e.target.value } : l))} - placeholder="ラベル (例: X)" - className="w-28 bg-gray-800 border border-gray-700 rounded px-3 py-2 text-gray-100 focus:outline-none focus:border-blue-500 text-sm" - /> + className="w-36 bg-gray-800 border border-gray-700 rounded px-3 py-2 text-gray-100 focus:outline-none focus:border-blue-500 text-sm" + > + {LINK_TYPES.map((t) => ( + + ))} + setLinks(links.map((l, idx) => idx === i ? { ...l, url: e.target.value } : l))} @@ -183,7 +187,7 @@ export default function BandEdit() {