Repository Public
1"use client";2import { useEffect, useMemo, useRef, useState } from "react";3import { api, getCsrf } from "@/lib/client-api";4import type { Album, LyricLine, Lyrics, Paged, Track } from "@/lib/types";5import { audioInfo, fmtTime } from "@/lib/format";6import { useLocale, useT } from "@/i18n";7import { Artwork, Async, Confirm, Empty, Sheet, useApi, useErrorText, useToast } from "@/components/ui";8import { IChevronDown, IChevronRight, IDown, IEdit, ILyrics, IRefresh, ISpinner, ITrash, IUp } from "@/components/icons";9import type { Key } from "@/i18n/messages";1011type Fields = { title: string; artist: string; album: string; albumArtist: string; trackNo: string; discNo: string; year: string; genre: string };12const EMPTY: Fields = { title: "", artist: "", album: "", albumArtist: "", trackNo: "", discNo: "", year: "", genre: "" };13const num = (s: string) => (s.trim() === "" ? null : Number(s));1415function Field({ id, label, value, onChange, type = "text", placeholder }: { id: string; label: string; value: string; onChange: (v: string) => void; type?: string; placeholder?: string }) {16 return <div><label className="label" htmlFor={id}>{label}</label><input id={id} className="input" type={type} inputMode={type === "number" ? "numeric" : undefined} value={value} placeholder={placeholder} onChange={(e) => onChange(e.target.value)} /></div>;17}1819/** Edit one track, or several at once (only the fields that were filled in are applied to the selection). */20function TrackEditor({ tracks, onClose, onSaved }: { tracks: Track[]; onClose: () => void; onSaved: () => void }) {21 const t = useT(); const toast = useToast(); const text = useErrorText();22 const single = tracks.length === 1 ? tracks[0] : null;23 const [f, setF] = useState<Fields>(EMPTY);24 const [busy, setBusy] = useState(false);25 useEffect(() => {26 setF(single ? { title: single.title, artist: single.artist.name, album: single.album.title, albumArtist: single.album.artistName, trackNo: single.trackNo?.toString() ?? "", discNo: String(single.discNo), year: single.year?.toString() ?? "", genre: single.genre ?? "" } : EMPTY);27 }, [single, tracks.length]);28 const set = (k: keyof Fields) => (v: string) => setF((x) => ({ ...x, [k]: v }));29 const save = async () => {30 const patch: Record<string, unknown> = {};31 if (single) {32 if (f.title.trim() !== single.title) patch.title = f.title.trim();33 if (f.artist.trim() !== single.artist.name) patch.artist = f.artist.trim();34 if (f.album.trim() !== single.album.title) patch.album = f.album.trim();35 if (f.albumArtist.trim() !== single.album.artistName) patch.albumArtist = f.albumArtist.trim();36 if (num(f.trackNo) !== single.trackNo) patch.trackNo = num(f.trackNo);37 if (f.discNo.trim() && Number(f.discNo) !== single.discNo) patch.discNo = Number(f.discNo);38 if (num(f.year) !== single.year) patch.year = num(f.year);39 if (f.genre.trim() !== (single.genre ?? "")) patch.genre = f.genre.trim();40 } else {41 for (const k of ["artist", "album", "albumArtist", "genre"] as const) if (f[k].trim()) patch[k] = f[k].trim();42 if (f.discNo.trim()) patch.discNo = Number(f.discNo);43 if (f.year.trim()) patch.year = Number(f.year);44 }45 if (Object.keys(patch).length === 0) return onClose();46 setBusy(true);47 try { await api("/api/v1/admin/tracks", { method: "PATCH", body: { ids: tracks.map((x) => x.id), patch } }); toast(t("admin.saved")); onSaved(); onClose(); }48 catch (e) { toast(text(e), "error"); } finally { setBusy(false); }49 };50 return (51 <Sheet open onClose={onClose} wide title={single ? t("admin.editTrack") : t("admin.editN", { n: tracks.length })}52 footer={<><button className="btn" onClick={onClose}>{t("common.cancel")}</button><button className="btn btn-primary" onClick={save} disabled={busy || (!!single && !f.title.trim())}>{busy && <ISpinner size={16} />}{t("common.save")}</button></>}>53 {!single && <p className="mb-4 text-sm leading-relaxed text-muted">{t("admin.batchHelp")}</p>}54 <div className="grid gap-3 sm:grid-cols-2">55 {single && <div className="sm:col-span-2"><Field id="e-title" label={t("f.title")} value={f.title} onChange={set("title")} /></div>}56 <Field id="e-artist" label={t("f.artist")} value={f.artist} onChange={set("artist")} placeholder={single ? "" : t("admin.unchanged")} />57 <Field id="e-aa" label={t("f.albumArtist")} value={f.albumArtist} onChange={set("albumArtist")} placeholder={single ? "" : t("admin.unchanged")} />58 <div className="sm:col-span-2"><Field id="e-album" label={t("f.album")} value={f.album} onChange={set("album")} placeholder={single ? "" : t("admin.unchanged")} /></div>59 {single && <Field id="e-no" label={t("f.trackNo")} type="number" value={f.trackNo} onChange={set("trackNo")} />}60 <Field id="e-disc" label={t("f.discNo")} type="number" value={f.discNo} onChange={set("discNo")} placeholder={single ? "" : t("admin.unchanged")} />61 <Field id="e-year" label={t("f.year")} type="number" value={f.year} onChange={set("year")} placeholder={single ? "" : t("admin.unchanged")} />62 <Field id="e-genre" label={t("f.genre")} value={f.genre} onChange={set("genre")} placeholder={single ? "" : t("admin.unchanged")} />63 </div>64 {single && <p className="mt-4 text-xs text-faint">{t("admin.moveHelp")}</p>}65 </Sheet>66 );67}6869function AlbumEditor({ album, onClose, onSaved }: { album: Album; onClose: () => void; onSaved: () => void }) {70 const t = useT(); const toast = useToast(); const text = useErrorText();71 const [f, setF] = useState({ title: album.title, artist: album.artist.name, year: album.year?.toString() ?? "", genre: album.genre ?? "" });72 const [busy, setBusy] = useState(false);73 const [art, setArt] = useState(album.artworkId);74 const file = useRef<HTMLInputElement>(null);75 const save = async () => {76 const patch: Record<string, unknown> = {};77 if (f.title.trim() !== album.title) patch.title = f.title.trim();78 if (f.artist.trim() !== album.artist.name) patch.artist = f.artist.trim();79 if (num(f.year) !== album.year) patch.year = num(f.year);80 if (f.genre.trim() !== (album.genre ?? "")) patch.genre = f.genre.trim();81 if (Object.keys(patch).length === 0) return onClose();82 setBusy(true);83 try { const r = await api<{ merged: boolean }>(`/api/v1/admin/albums/${album.id}`, { method: "PATCH", body: patch }); toast(t(r.merged ? "admin.merged" : "admin.saved")); onSaved(); onClose(); }84 catch (e) { toast(text(e), "error"); } finally { setBusy(false); }85 };86 const upload = async (img: File) => {87 setBusy(true);88 try {89 const res = await fetch(`/api/v1/admin/albums/${album.id}/artwork`, { method: "PUT", body: img, headers: { "Content-Type": "application/octet-stream", "X-CSRF-Token": getCsrf() ?? "" }, credentials: "same-origin" });90 const data = await res.json().catch(() => null);91 if (!res.ok) throw new (await import("@/lib/client-api")).ApiClientError(res.status, data?.error?.code ?? "http", data?.error?.message ?? "");92 setArt(data.artworkId); toast(t("admin.coverSaved")); onSaved();93 } catch (e) { toast(text(e), "error"); } finally { setBusy(false); }94 };95 return (96 <Sheet open onClose={onClose} wide title={t("admin.editAlbum")}97 footer={<><button className="btn" onClick={onClose}>{t("common.cancel")}</button><button className="btn btn-primary" onClick={save} disabled={busy || !f.title.trim() || !f.artist.trim()}>{busy && <ISpinner size={16} />}{t("common.save")}</button></>}>98 <div className="flex flex-col gap-5 sm:flex-row">99 <div className="mx-auto w-40 flex-none text-center sm:mx-0">100 <Artwork artworkId={art} seed={album.title} />101 <button className="btn btn-sm mt-2 w-full" onClick={() => file.current?.click()} disabled={busy}>{t("admin.changeCover")}</button>102 <input ref={file} type="file" accept="image/jpeg,image/png,image/webp" className="sr-only" tabIndex={-1} aria-hidden onChange={(e) => { const x = e.target.files?.[0]; if (x) void upload(x); e.target.value = ""; }} />103 <p className="mt-1.5 text-[0.7rem] leading-snug text-faint">{t("admin.coverHelp")}</p>104 </div>105 <div className="grid flex-1 gap-3 sm:grid-cols-2">106 <div className="sm:col-span-2"><Field id="a-title" label={t("f.album")} value={f.title} onChange={(v) => setF((x) => ({ ...x, title: v }))} /></div>107 <div className="sm:col-span-2"><Field id="a-artist" label={t("f.albumArtist")} value={f.artist} onChange={(v) => setF((x) => ({ ...x, artist: v }))} /></div>108 <Field id="a-year" label={t("f.year")} type="number" value={f.year} onChange={(v) => setF((x) => ({ ...x, year: v }))} />109 <Field id="a-genre" label={t("f.genre")} value={f.genre} onChange={(v) => setF((x) => ({ ...x, genre: v }))} />110 </div>111 </div>112 </Sheet>113 );114}115116117const LANGS = ["fr", "en", "es", "it", "de", "pt"] as const;118119/** Asks the worker to transcribe the selected tracks. */120function LyricsRequest({ tracks, onClose, onDone }: { tracks: Track[]; onClose: () => void; onDone: () => void }) {121 const t = useT(); const toast = useToast(); const text = useErrorText();122 const [language, setLanguage] = useState(""); const [overwrite, setOverwrite] = useState(false); const [busy, setBusy] = useState(false);123 const go = async () => {124 setBusy(true);125 try { const r = await api<{ queued: number; skipped: number }>("/api/v1/admin/lyrics/generate", { body: { ids: tracks.map((x) => x.id), language: language || null, overwrite } }); toast(t("lyrics.queuedN", { n: r.queued, skipped: r.skipped })); onDone(); onClose(); }126 catch (e) { toast(text(e), "error"); } finally { setBusy(false); }127 };128 return (129 <Sheet open onClose={onClose} title={t("lyrics.generateTitle", { n: tracks.length })} footer={<><button className="btn" onClick={onClose}>{t("common.cancel")}</button><button className="btn btn-primary" onClick={go} disabled={busy}>{busy && <ISpinner size={16} />}{t("lyrics.generate")}</button></>}>130 <p className="mb-4 text-sm leading-relaxed text-muted">{t("lyrics.generateBody")}</p>131 <label className="label" htmlFor="ly-lang">{t("lyrics.language")}</label>132 <select id="ly-lang" className="input" value={language} onChange={(e) => setLanguage(e.target.value)}>133 <option value="">{t("lyrics.langAuto")}</option>{LANGS.map((l) => <option key={l} value={l}>{t(`lang.${l}` as Key)}</option>)}</select>134 <label className="mt-4 flex items-start gap-2.5 text-sm"><input type="checkbox" className="mt-0.5 h-4 w-4 accent-[var(--accent)]" checked={overwrite} onChange={(e) => setOverwrite(e.target.checked)} /><span>{t("lyrics.overwrite")}</span></label>135 </Sheet>136 );137}138139/** Line-by-line correction of the transcribed text. Timings are kept. */140function LyricsEditor({ track, onClose, onSaved }: { track: Track; onClose: () => void; onSaved: () => void }) {141 const t = useT(); const toast = useToast(); const text = useErrorText();142 const res = useApi<Lyrics>(`/api/v1/library/tracks/${track.id}/lyrics`);143 const [lines, setLines] = useState<LyricLine[] | null>(null);144 const [busy, setBusy] = useState(false);145 useEffect(() => { if (res.data && lines === null) setLines(res.data.lines); }, [res.data, lines]);146 const save = async () => {147 setBusy(true);148 try { await api(`/api/v1/admin/tracks/${track.id}/lyrics`, { method: "PUT", body: { language: res.data?.language && (LANGS as readonly string[]).includes(res.data.language) ? res.data.language : null, lines: (lines ?? []).map((l) => ({ t: l.t, e: l.e, text: l.text })) } }); toast(t("admin.saved")); onSaved(); onClose(); }149 catch (e) { toast(text(e), "error"); } finally { setBusy(false); }150 };151 const remove = async () => { setBusy(true); try { await api(`/api/v1/admin/tracks/${track.id}/lyrics`, { method: "DELETE" }); onSaved(); onClose(); } catch (e) { toast(text(e), "error"); } finally { setBusy(false); } };152 return (153 <Sheet open onClose={onClose} wide title={`${t("lyrics.editTitle")} — ${track.title}`}154 footer={<><button className="btn btn-danger mr-auto" onClick={remove} disabled={busy || res.data?.state === "none"}>{t("lyrics.deleteAll")}</button><button className="btn" onClick={onClose}>{t("common.cancel")}</button><button className="btn btn-primary" onClick={save} disabled={busy || lines === null}>{busy && <ISpinner size={16} />}{t("common.save")}</button></>}>155 <p className="mb-3 text-sm leading-relaxed text-muted">{t("lyrics.editHelp")}</p>156 <Async res={res}>{() => (lines ?? []).length === 0 ? <p className="py-6 text-center text-sm text-muted">{t("lyrics.noneTitle")}</p> : (157 <ol className="space-y-1.5">{(lines ?? []).map((l, i) => (158 <li key={`${l.t}-${i}`} className="flex items-center gap-2">159 <span className="w-12 flex-none text-right text-xs tabular-nums text-faint">{fmtTime(l.t)}</span>160 <input className="input !min-h-9 !text-sm" aria-label={t("lyrics.lineAt", { time: fmtTime(l.t) })} value={l.text} maxLength={300} onChange={(e) => setLines((x) => x!.map((y, k) => (k === i ? { ...y, text: e.target.value } : y)))} />161 <button className="icon-btn !h-8 !w-8 text-muted" onClick={() => setLines((x) => x!.filter((_, k) => k !== i))} aria-label={t("lyrics.removeLine", { time: fmtTime(l.t) })}><ITrash size={15} /></button>162 </li>))}</ol>)}</Async>163 </Sheet>164 );165}166167function AlbumRow({ album, open, onToggle, onChanged }: { album: Album; open: boolean; onToggle: () => void; onChanged: () => void }) {168 const t = useT(); const locale = useLocale(); const toast = useToast(); const text = useErrorText();169 const res = useApi<{ album: Album; tracks: Track[] }>(open ? `/api/v1/library/albums/${album.id}` : null);170 const [sel, setSel] = useState<Set<string>>(new Set());171 const [edit, setEdit] = useState<Track[] | null>(null);172 const [editAlbum, setEditAlbum] = useState(false);173 const [del, setDel] = useState<{ kind: "album" } | { kind: "tracks"; tracks: Track[] } | null>(null);174 const [busy, setBusy] = useState(false);175 const [lyReq, setLyReq] = useState<Track[] | null>(null);176 const [lyEdit, setLyEdit] = useState<Track | null>(null);177 const tracks = res.data?.tracks ?? [];178 // While a transcription is in progress, refresh the album so its status chips move on their own.179 const transcribing = tracks.some((x) => x.lyricsState === "queued" || x.lyricsState === "working");180 useEffect(() => { if (!transcribing) return; const iv = setInterval(res.reload, 3000); return () => clearInterval(iv); }, [transcribing, res.reload]);181 const selected = useMemo(() => tracks.filter((x) => sel.has(x.id)), [tracks, sel]);182 const changed = () => { setSel(new Set()); res.reload(); onChanged(); };183 const move = async (i: number, d: -1 | 1) => {184 const order = tracks.slice(); [order[i], order[i + d]] = [order[i + d], order[i]];185 res.setData((x) => ({ ...x, tracks: order }));186 try { await api(`/api/v1/admin/albums/${album.id}/order`, { method: "PUT", body: { trackIds: order.map((x) => x.id) } }); res.reload(); }187 catch (e) { toast(text(e), "error"); res.reload(); }188 };189 const doDelete = async () => {190 if (!del) return;191 setBusy(true);192 try {193 const r = del.kind === "album" ? await api<{ deleted: number; fileErrors: number }>(`/api/v1/admin/albums/${album.id}/delete`, { body: { confirm: true } })194 : await api<{ deleted: number; fileErrors: number }>("/api/v1/admin/tracks/delete", { body: { ids: del.tracks.map((x) => x.id), confirm: true } });195 toast(t(r.fileErrors ? "admin.deletedWithErrors" : "admin.deletedN", { n: r.deleted }), r.fileErrors ? "error" : "info"); setDel(null); changed();196 } catch (e) { toast(text(e), "error"); } finally { setBusy(false); }197 };198 const reanalyse = async (ids: string[]) => { try { await api("/api/v1/admin/tracks/reanalyse", { body: { ids } }); toast(t("admin.reanalyseQueued", { n: ids.length })); } catch (e) { toast(text(e), "error"); } };199 return (200 <li id={`adm-album-${album.id}`}>201 <div className="flex items-center gap-3 px-3 py-2.5">202 <button className="flex min-w-0 flex-1 items-center gap-3 text-left" onClick={onToggle} aria-expanded={open}>203 {open ? <IChevronDown size={18} className="flex-none text-muted" /> : <IChevronRight size={18} className="flex-none text-muted" />}204 <Artwork artworkId={album.artworkId} seed={album.title} size={96} className="w-11 flex-none" rounded="rounded-lg" />205 <span className="min-w-0"><span className="block truncate text-sm font-semibold">{album.title}</span><span className="block truncate text-xs text-muted">{album.artist.name}{album.year ? ` · ${album.year}` : ""} · {t(album.trackCount === 1 ? "count.track" : "count.tracks", { n: album.trackCount })}</span></span>206 </button>207 <button className="icon-btn text-muted" onClick={() => setEditAlbum(true)} aria-label={`${t("admin.editAlbum")} : ${album.title}`}><IEdit size={18} /></button>208 <button className="icon-btn text-muted" onClick={() => setDel({ kind: "album" })} aria-label={`${t("admin.deleteAlbum")} : ${album.title}`}><ITrash size={18} /></button>209 </div>210 {open && (211 <div className="border-t border-line bg-bg/40 px-3 pb-3 pt-2">212 <Async res={res}>{() => (<>213 <div className="mb-2 flex flex-wrap items-center gap-2">214 <label className="flex items-center gap-2 text-xs font-semibold text-muted"><input type="checkbox" className="h-4 w-4 accent-[var(--accent)]" checked={tracks.length > 0 && sel.size === tracks.length} onChange={(e) => setSel(e.target.checked ? new Set(tracks.map((x) => x.id)) : new Set())} />{t("admin.selectAll")}</label>215 <span className="text-xs text-faint">{t("admin.nSelected", { n: sel.size })}</span>216 <span className="flex-1" />217 <button className="btn btn-sm" disabled={!sel.size} onClick={() => setEdit(selected)}><IEdit size={14} />{t("admin.editSel")}</button>218 <button className="btn btn-sm" disabled={!sel.size} onClick={() => void reanalyse(selected.map((x) => x.id))}><IRefresh size={14} />{t("admin.reanalyse")}</button>219 <button className="btn btn-sm" disabled={!sel.size} onClick={() => setLyReq(selected)}><ILyrics size={14} />{t("lyrics.title")}</button>220 <button className="btn btn-sm btn-danger" disabled={!sel.size} onClick={() => setDel({ kind: "tracks", tracks: selected })}><ITrash size={14} />{t("common.delete")}</button>221 </div>222 <ol className="divide-y divide-line/60">{tracks.map((tr, i) => (223 <li key={tr.id} className="flex items-center gap-2 py-1.5">224 <input type="checkbox" className="h-4 w-4 flex-none accent-[var(--accent)]" checked={sel.has(tr.id)} aria-label={t("admin.selectTrack", { title: tr.title })} onChange={(e) => setSel((s) => { const n = new Set(s); if (e.target.checked) n.add(tr.id); else n.delete(tr.id); return n; })} />225 <span className="w-9 flex-none text-center text-xs tabular-nums text-faint">{tr.discNo > 1 ? `${tr.discNo}-` : ""}{tr.trackNo ?? "–"}</span>226 <div className="min-w-0 flex-1">227 <p className="truncate text-sm">{tr.title}</p>228 <p className="truncate text-xs text-muted">{tr.artist.name} · {audioInfo(tr, locale)} · {fmtTime(tr.durationMs)}229 {tr.webPlayable !== "yes" && <span className={`chip ml-1.5 !py-0 ${tr.compatState === "ready" ? "chip-ok" : tr.compatState === "error" ? "chip-err" : "chip-warn"}`}>{t(tr.compatState === "ready" ? "admin.compatReady" : tr.compatState === "disabled" ? "admin.compatOff" : tr.compatState === "error" ? "admin.compatError" : "admin.compatPending")}</span>}230 {tr.lyricsState && <span className={`chip ml-1.5 !py-0 ${tr.lyricsState === "ready" ? "chip-ok" : tr.lyricsState === "error" ? "chip-err" : tr.lyricsState === "empty" ? "" : "chip-accent"}`}>{t(`lyrics.s.${tr.lyricsState}` as Key)}</span>}</p>231 </div>232 <button className="icon-btn !h-8 !w-8 text-muted" disabled={i === 0 || tracks[i - 1].discNo !== tr.discNo} onClick={() => void move(i, -1)} aria-label={t("queue.moveUp", { title: tr.title })}><IUp size={16} /></button>233 <button className="icon-btn !h-8 !w-8 text-muted" disabled={i === tracks.length - 1 || tracks[i + 1].discNo !== tr.discNo} onClick={() => void move(i, 1)} aria-label={t("queue.moveDown", { title: tr.title })}><IDown size={16} /></button>234 <button className="icon-btn !h-8 !w-8 text-muted" onClick={() => setLyEdit(tr)} aria-label={`${t("lyrics.editTitle")} : ${tr.title}`}><ILyrics size={16} /></button>235 <button className="icon-btn !h-8 !w-8 text-muted" onClick={() => setEdit([tr])} aria-label={`${t("admin.editTrack")} : ${tr.title}`}><IEdit size={16} /></button>236 </li>))}</ol>237 </>)}</Async>238 </div>239 )}240 {edit && <TrackEditor tracks={edit} onClose={() => setEdit(null)} onSaved={changed} />}241 {lyReq && <LyricsRequest tracks={lyReq} onClose={() => setLyReq(null)} onDone={res.reload} />}242 {lyEdit && <LyricsEditor track={lyEdit} onClose={() => setLyEdit(null)} onSaved={res.reload} />}243 {editAlbum && <AlbumEditor album={album} onClose={() => setEditAlbum(false)} onSaved={changed} />}244 <Confirm open={!!del} onClose={() => setDel(null)} onConfirm={doDelete} busy={busy} danger title={t(del?.kind === "album" ? "admin.deleteAlbum" : "admin.deleteTracks")} confirmLabel={t("admin.deleteForever")}245 body={<>246 <p>{del?.kind === "album" ? t("admin.deleteAlbumBody", { title: album.title, n: album.trackCount }) : t("admin.deleteTracksBody", { n: del?.kind === "tracks" ? del.tracks.length : 0 })}</p>247 {del?.kind === "tracks" && <ul className="mt-2 max-h-40 list-disc overflow-y-auto pl-5 text-ink">{del.tracks.map((x) => <li key={x.id}>{x.title}</li>)}</ul>}248 <p className="mt-3 font-semibold text-danger">{t("admin.deleteWarning")}</p>249 </>} />250 </li>251 );252}253254export function LibraryPanel({ focusAlbum }: { focusAlbum: string | null }) {255 const t = useT();256 const res = useApi<Paged<Album>>("/api/v1/library/albums?sort=artist&limit=100");257 const [open, setOpen] = useState<string | null>(focusAlbum);258 const [q, setQ] = useState("");259 useEffect(() => { if (focusAlbum && res.data) document.getElementById(`adm-album-${focusAlbum}`)?.scrollIntoView({ block: "center" }); }, [focusAlbum, res.data]);260 return (261 <div className="max-w-4xl">262 <div className="mb-3"><label htmlFor="adm-q" className="sr-only">{t("admin.filterAlbums")}</label><input id="adm-q" type="search" className="input max-w-sm" placeholder={t("admin.filterAlbums")} value={q} onChange={(e) => setQ(e.target.value)} /></div>263 <Async res={res}>{(d) => {264 const n = q.trim().toLowerCase();265 const items = n ? d.items.filter((a) => `${a.title} ${a.artist.name}`.toLowerCase().includes(n)) : d.items;266 return items.length === 0 ? <Empty title={t(d.items.length ? "admin.noMatch" : "lib.empty")} /> : (<>267 <ul className="card divide-y divide-line">{items.map((a) => <AlbumRow key={a.id} album={a} open={open === a.id} onToggle={() => setOpen(open === a.id ? null : a.id)} onChanged={res.reload} />)}</ul>268 {d.total > d.items.length && <p className="mt-3 text-center text-xs text-muted">{t("fav.more", { shown: d.items.length, total: d.total })}</p>}269 </>);270 }}</Async>271 </div>272 );273}274