diff --git a/web/src/App.tsx b/web/src/App.tsx index d8f10e4..0443bfd 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -5,6 +5,7 @@ import { ThemeProvider, useTheme } from "./theme"; import { LoginPage } from "./pages/LoginPage"; import { HomePage } from "./pages/HomePage"; import { BandPage } from "./pages/BandPage"; +import { SessionPage } from "./pages/SessionPage"; import { SongPage } from "./pages/SongPage"; import { SettingsPage } from "./pages/SettingsPage"; import { InvitePage } from "./pages/InvitePage"; @@ -63,6 +64,14 @@ export default function App() { } /> + + + + } + /> (); + const qc = useQueryClient(); + const [editingMeta, setEditingMeta] = useState(false); + const [labelInput, setLabelInput] = useState(""); + const [notesInput, setNotesInput] = useState(""); + + const { data: session, isLoading } = useQuery({ + queryKey: ["session", sessionId], + queryFn: () => api.get(`/bands/${bandId}/sessions/${sessionId}`), + enabled: !!sessionId && !!bandId, + }); + + const updateMutation = useMutation({ + mutationFn: (data: { label?: string; notes?: string }) => + api.patch(`/bands/${bandId}/sessions/${sessionId}`, data), + onSuccess: () => { + qc.invalidateQueries({ queryKey: ["session", sessionId] }); + setEditingMeta(false); + }, + }); + + function startEdit() { + setLabelInput(session?.label ?? ""); + setNotesInput(session?.notes ?? ""); + setEditingMeta(true); + } + + if (isLoading) return
Loading...
; + if (!session) return
Session not found
; + + return ( +
+
+ + ← Back to Band + + + {/* Header */} +
+
+
+

+ {formatDate(session.date)} +

+ {session.label && ( +

{session.label}

+ )} +

+ {session.recording_count} recording{session.recording_count !== 1 ? "s" : ""} +

+
+ {!editingMeta && ( + + )} +
+ + {session.notes && !editingMeta && ( +

{session.notes}

+ )} + + {editingMeta && ( +
+ + setLabelInput(e.target.value)} + placeholder="e.g. pre-gig warmup" + style={{ width: "100%", padding: "7px 10px", background: "var(--bg-inset)", border: "1px solid var(--border)", borderRadius: 6, color: "var(--text)", fontSize: 13, boxSizing: "border-box", marginBottom: 10 }} + /> + +