diff options
| author | yyamashita <yyamashita@mosquit.one> | 2026-05-09 00:46:32 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@mosquit.one> | 2026-05-09 00:46:32 +0900 |
| commit | d944f11581553c5e038b33fa4558566713f6d1f4 (patch) | |
| tree | 78558a7c0ed3fbd16e215dfb309c0d5e98380bb2 /app/routes/band-edit.tsx | |
| parent | 446ffe83a2043636ffe99691454e843ef9fb179f (diff) | |
Add band description/status fields and redesign index page
- bands table: add description (TEXT) and status (TEXT DEFAULT 'active')
via ALTER TABLE migrations (active / hiatus / disbanded)
- Home page: minimal monochrome index listing name, area, status
- Band detail: show description below title, status alongside area
- Band new/edit forms: textarea for description, select for status
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app/routes/band-edit.tsx')
| -rw-r--r-- | app/routes/band-edit.tsx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/app/routes/band-edit.tsx b/app/routes/band-edit.tsx index 70e1d60..99d4ee7 100644 --- a/app/routes/band-edit.tsx +++ b/app/routes/band-edit.tsx @@ -27,6 +27,8 @@ export async function action({ params, request }: ActionFunctionArgs) { const name = (fd.get("name") as string).trim(); const slug = (fd.get("slug") as string).trim(); const area = (fd.get("area") as string).trim() || null; + const description = (fd.get("description") as string).trim() || null; + const status = (fd.get("status") as string) || "active"; const message = (fd.get("message") as string).trim(); const links: { label: string; url: string }[] = JSON.parse( (fd.get("links") as string) || "[]" @@ -42,7 +44,7 @@ export async function action({ params, request }: ActionFunctionArgs) { if (Object.keys(errors).length > 0) return { errors }; try { - updateBand(band.id, { slug, name, area, links, artists, message, ip_address: getIpAddress(request) }); + updateBand(band.id, { slug, name, area, description, status, links, artists, message, ip_address: getIpAddress(request) }); } catch (e) { if (e instanceof Error && e.message.includes("UNIQUE constraint failed: bands.slug")) { return { errors: { slug: "このslugは既に使用されています" } }; @@ -130,6 +132,29 @@ export default function BandEdit() { </div> <div> + <label className="block text-sm font-medium text-gray-300 mb-1">ステータス</label> + <select + name="status" + defaultValue={band.status} + className="bg-gray-800 border border-gray-700 rounded px-3 py-2 text-gray-100 focus:outline-none focus:border-blue-500" + > + <option value="active">活動中</option> + <option value="hiatus">活動休止</option> + <option value="disbanded">解散</option> + </select> + </div> + + <div> + <label className="block text-sm font-medium text-gray-300 mb-1">説明</label> + <textarea + name="description" + rows={3} + defaultValue={band.description ?? ""} + className="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-gray-100 focus:outline-none focus:border-blue-500 resize-none" + /> + </div> + + <div> <label className="block text-sm font-medium text-gray-300 mb-2">リンク</label> <div className="space-y-2"> {links.map((link, i) => ( |
