feat: Add band name to show pages and fix multi-band UX issues
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
This commit is contained in:
parent
d3557fedbb
commit
9914fdb802
3 changed files with 26 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ from typing import List
|
|||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from sqlmodel import Session, select
|
||||
from database import get_session
|
||||
from models import Show, Tag, EntityTag
|
||||
from models import Show, Tag, EntityTag, Vertical
|
||||
from schemas import ShowCreate, ShowRead, ShowUpdate, TagRead
|
||||
from auth import get_current_user
|
||||
|
||||
|
|
@ -93,6 +93,10 @@ def read_show(slug: str, session: Session = Depends(get_session)):
|
|||
show_data = ShowRead.model_validate(show)
|
||||
show_data.tags = tags
|
||||
|
||||
# Get vertical for band name
|
||||
vertical = session.get(Vertical, show.vertical_id)
|
||||
show_data.vertical = vertical
|
||||
|
||||
# Sort performances by position
|
||||
sorted_perfs = sorted(show.performances, key=lambda p: p.position)
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,15 @@ class SongUpdate(SQLModel):
|
|||
original_artist: Optional[str] = None
|
||||
notes: Optional[str] = None
|
||||
|
||||
# --- Vertical Schema (simple for embedding) ---
|
||||
class VerticalSimple(SQLModel):
|
||||
id: int
|
||||
name: str
|
||||
slug: str
|
||||
description: Optional[str] = None
|
||||
logo_url: Optional[str] = None
|
||||
accent_color: Optional[str] = None
|
||||
|
||||
# --- Show Schemas ---
|
||||
class ShowBase(SQLModel):
|
||||
date: datetime
|
||||
|
|
@ -163,6 +172,7 @@ class GroupPostRead(GroupPostBase):
|
|||
class ShowRead(ShowBase):
|
||||
id: int
|
||||
slug: Optional[str] = None
|
||||
vertical: Optional["VerticalSimple"] = None
|
||||
venue: Optional["VenueRead"] = None
|
||||
tour: Optional["TourRead"] = None
|
||||
tags: List["TagRead"] = []
|
||||
|
|
|
|||
|
|
@ -72,6 +72,16 @@ export default async function ShowDetailPage({ params }: { params: Promise<{ slu
|
|||
</Button>
|
||||
</Link>
|
||||
<div>
|
||||
{/* Band Name - Most Important */}
|
||||
{show.vertical && (
|
||||
<Link
|
||||
href={`/bands/${show.vertical.slug}`}
|
||||
className="inline-flex items-center gap-2 text-sm font-semibold text-primary hover:underline mb-1"
|
||||
>
|
||||
<Music2 className="h-4 w-4" />
|
||||
{show.vertical.name}
|
||||
</Link>
|
||||
)}
|
||||
<h1 className="text-2xl sm:text-3xl font-bold tracking-tight">
|
||||
{new Date(show.date).toLocaleDateString()}
|
||||
</h1>
|
||||
|
|
@ -247,7 +257,7 @@ export default async function ShowDetailPage({ params }: { params: Promise<{ slu
|
|||
<Music2 className="h-12 w-12 text-muted-foreground/30 mb-4" />
|
||||
<p className="text-muted-foreground font-medium">No Setlist Documented</p>
|
||||
<p className="text-sm text-muted-foreground/70 mt-1 max-w-sm">
|
||||
This show's setlist hasn't been added yet. Early Goose shows (2014-2016) often weren't documented.
|
||||
This show's setlist hasn't been added yet. Early shows often weren't documented.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue