Compare commits

...
Author SHA1 Message Date
sparkandClaude Opus 5.5 9a2148b2ed Archive site: more of the design (copy link, select in the large view, review and person details), and fix the large view's layout.
- Gallery: "Copiar ligação"; the large view selects photos for the download, steps with Anterior/Seguinte and
  shows the game.
- Pessoas: title; "confirmadas", and "por confirmar" only for those who review. Equipas: one line on what a team
  is, and its people.
- Pessoa: the recognition-off banner with "Reativar", "Rever N sugestões", "Zona de cuidado".
- Rever: the shortcuts on screen, the chosen person's card with "Opções de reconhecimento", and a page for those
  who may not review.
- The review cards' photo viewer had taken the gallery's class (.arq-lightbox) and broke the large view's layout:
  it is .arq-rlightbox now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017sovZz1NXBwx4VySojoyA1
2026-10-19 09:51:54 +00:00
spark 2c34d86742 Merge pull request 'Store each folder's gallery when the archive is scanned' (#47) from task/archive-one-gallery into main
ci / rust (push) Successful in 7m31s
ci / typescript (push) Successful in 10m7s
Store each folder's gallery when the archive is scanned
2026-10-19 10:35:38 +01:00
8 changed files with 262 additions and 21 deletions

No files matched your search

+17 -1
View File
@@ -192,11 +192,27 @@ export function ArchiveView({ info, start }: { info: ArchiveInfo; start?: View }
}}
onExpired={expired}
onChanged={() => setMeTick((n) => n + 1)}
onOpenPerson={(id) => go({ kind: "person", id })}
/>
) : tab === "review" && !me ? (
<div className="arq-wrap arq-body" />
) : tab === "review" ? (
<div className="arq-wrap arq-body">
<div className="arq-lock">
<Icon name="lock" size={48} />
<h1 className="arq-disp" style={{ margin: 0 }}>
Só para quem pode editar
</h1>
<p className="arq-muted" style={{ maxWidth: 520, margin: 0 }}>
Rever rostos é para quem tem permissão de edição nas pastas destas fotos. Se achas que devias ter, pede a quem gere o arquivo.
</p>
<button type="button" className="arq-btn" onClick={() => openTab("galleries")}>
Voltar às galerias
</button>
</div>
</div>
) : (
<Browse sourceId={info.id} token={token} tab={tab === "review" ? "galleries" : tab} onTab={openTab} onExpired={expired} onGallery={(id) => go({ kind: "gallery", id })} onPerson={(id) => go({ kind: "person", id })} />
<Browse sourceId={info.id} token={token} tab={tab} onTab={openTab} onExpired={expired} onGallery={(id) => go({ kind: "gallery", id })} onPerson={(id) => go({ kind: "person", id })} canReview={!!me?.canReview} />
)}
</main>
+35 -12
View File
@@ -21,7 +21,10 @@ export function Browse({
onExpired,
onGallery,
onPerson,
canReview = false,
}: {
/** The viewer edits on the cloud: sees the suggestions waiting for confirmation. */
canReview?: boolean;
sourceId: string;
token: string;
tab: Tab;
@@ -291,6 +294,7 @@ export function Browse({
{tab === "people" && (
<>
<h1 className="arq-disp arq-h1">Pessoas</h1>
{people && people.clubs.length > 1 && (
<div className="arq-club-pills" role="group" aria-label="Filtrar por equipa">
<button type="button" className="arq-pill" aria-pressed={!club} onClick={() => setClub(null)}>
@@ -344,8 +348,10 @@ export function Browse({
<strong>{p.name}</strong>
{p.club && <span className="arq-sm">{p.club}</span>}
<span className="arq-badges">
<span className="arq-badge ok">{p.photos} identificadas</span>
{p.probable > 0 && <span className="arq-badge maybe">{p.probable} prováveis</span>}
<span className="arq-badge ok">
{p.photos} {p.photos === 1 ? "confirmada" : "confirmadas"}
</span>
{canReview && p.probable > 0 && <span className="arq-badge maybe">{p.probable} por confirmar</span>}
</span>
</span>
</button>
@@ -370,20 +376,37 @@ export function Browse({
Equipas <small>{teams ? shownTeams.length : ""}</small>
</h2>
<div className="arq-panel">
<p className="arq-muted" style={{ margin: "0 0 12px" }}>
Cada equipa aparece uma vez, mesmo com vários nomes nas pastas. Abre os jogos da equipa ou as pessoas identificadas dela.
</p>
{!teams && !failed && <Loading />}
{teams && shownTeams.length === 0 && <p className="arq-empty">Nenhuma equipa com esse nome.</p>}
<div className="arq-teams">
{shownTeams.slice(0, teamsShown).map((t) => (
<button key={t.name} type="button" className="arq-teamcard" onClick={() => pickTeam(t.name)}>
<span className="arq-crest">{initials(t.name)}</span>
<span>
<strong>{t.name}</strong>
<small>
{t.galleries} {t.galleries === 1 ? "jogo" : "jogos"}
</small>
</span>
<Icon name="next" size={18} />
</button>
<div key={t.name} className="arq-teamcard-wrap">
<button type="button" className="arq-teamcard" onClick={() => pickTeam(t.name)}>
<span className="arq-crest">{initials(t.name)}</span>
<span>
<strong>{t.name}</strong>
<small>
{t.galleries} {t.galleries === 1 ? "jogo" : "jogos"}
</small>
</span>
<Icon name="next" size={18} />
</button>
<button
type="button"
className="arq-teamcard-people"
onClick={() => {
setClub(t.name);
setQ("");
onTab("people");
}}
>
<Icon name="people" size={16} />
Pessoas
</button>
</div>
))}
</div>
{shownTeams.length > teamsShown && (
@@ -195,6 +195,19 @@ export function Gallery({
<Icon name="check" size={18} />
{picked ? "Cancelar seleção" : "Selecionar fotos"}
</button>
<button
type="button"
className="arq-btn ghost on-hero"
onClick={() =>
void navigator.clipboard?.writeText(window.location.href).then(
() => setNote("Ligação copiada. Quem a abrir precisa de ter acesso a esta galeria."),
() => setNote(window.location.href),
)
}
>
<Icon name="link" size={18} />
Copiar ligação
</button>
</div>
{note && <p className="arq-hero-note">{note}</p>}
{g.cloudUrl && (
@@ -323,6 +336,29 @@ export function Gallery({
onPerson={onPerson}
review={me?.canReview ? { sourceId, onDone: () => forget(`/v1/archive/${sourceId}/`) } : undefined}
onDownload={(photoId) => save({ photoIds: [photoId] }, "one")}
selected={!!picked?.has(photos[index]!.id)}
onSelect={(photoId) => {
const next = new Set(picked ?? []);
if (next.has(photoId)) next.delete(photoId);
else if (next.size < MAX_PICKED) next.add(photoId);
setPicked(next);
}}
extra={() =>
isGame ? (
<>
<span className="arq-label">Jogo</span>
<span>
{g.home} vs {g.away}
{g.startsAt ? ` · ${shortDay.format(new Date(g.startsAt))}` : ""}
</span>
</>
) : (
<>
<span className="arq-label">Galeria</span>
<span>{g.title}</span>
</>
)
}
/>
)}
</>
+20 -1
View File
@@ -19,6 +19,8 @@ export function Lightbox({
extra,
review,
onDownload,
selected,
onSelect,
}: {
photos: ArchivePhoto[];
index: number;
@@ -33,6 +35,9 @@ export function Lightbox({
extra?: (p: ArchivePhoto) => ReactNode;
/** Saves this photo at web size. */
onDownload?: (photoId: string) => void;
/** This photo is in the gallery's selection (for a download), and the way to add or take it out. */
selected?: boolean;
onSelect?: (photoId: string) => void;
}) {
const current = photos[index]!;
const [showFaces, setShowFaces] = useState(true);
@@ -101,8 +106,14 @@ export function Lightbox({
{index + 1} / {photos.length}
</strong>
<span className="arq-grow" />
{onSelect && (
<button type="button" className={`arq-btn ${selected ? "accent" : "ghost"}`} aria-pressed={!!selected} aria-label={selected ? "Tirar da seleção" : "Selecionar"} onClick={() => onSelect(current.id)}>
<Icon name="check" size={18} />
<span className="arq-hide-sm">{selected ? "Tirar da seleção" : "Selecionar"}</span>
</button>
)}
{onDownload && (
<button type="button" className="arq-btn accent" onClick={() => onDownload(current.id)}>
<button type="button" className="arq-btn accent" aria-label="Descarregar" onClick={() => onDownload(current.id)}>
<Icon name="download" size={18} />
<span className="arq-hide-sm">Descarregar</span>
</button>
@@ -148,6 +159,14 @@ export function Lightbox({
)}
</div>
<aside className="arq-info">
<span className="arq-lb-nav">
<button type="button" className="arq-btn ghost" disabled={index === 0} onClick={() => onIndex(index - 1)}>
← Anterior
</button>
<button type="button" className="arq-btn ghost" disabled={index >= photos.length - 1} onClick={() => onIndex(index + 1)}>
Seguinte →
</button>
</span>
{current.level && (
<span>
<span className={`arq-badge ${current.level === "confirmed" ? "ok" : current.level === "probable" ? "maybe" : "sim"}`}>{LEVEL[current.level]}</span>
+21 -4
View File
@@ -144,7 +144,7 @@ export function PhotosOf({
</section>
<div className="arq-wrap arq-body">
<div className="arq-split" style={{ flexDirection: "row-reverse", flexWrap: "wrap" }}>
{who && view.kind === "person" && me?.canReview && <Editor sourceId={sourceId} token={token} person={who} onReview={() => onReview(who.id)} onExpired={onExpired} />}
{who && view.kind === "person" && me?.canReview && <Editor sourceId={sourceId} token={token} person={who} waiting={counts.probable} onReview={() => onReview(who.id)} onExpired={onExpired} />}
<div style={{ flex: "999 1 560px", minWidth: 0, display: "flex", flexDirection: "column", gap: 16 }}>
<div className="arq-pills scroll" role="group" aria-label="Mostrar">
<button type="button" className="arq-pill" aria-pressed={only === null} onClick={() => setOnly(null)}>
@@ -225,7 +225,7 @@ const ACTION: Record<string, string> = {
* and (whoever edits the whole archive) taking back every suggestion, dropping a wrong reference photo, or
* turning their recognition off, with the names already given or not.
*/
function Editor({ sourceId, token, person, onReview, onExpired }: { sourceId: string; token: string; person: { id: string; name: string }; onReview: () => void; onExpired: () => void }) {
function Editor({ sourceId, token, person, waiting, onReview, onExpired }: { sourceId: string; token: string; person: { id: string; name: string }; waiting: number; onReview: () => void; onExpired: () => void }) {
const [h, setH] = useState<PersonHistory | null>(null);
const [asking, setAsking] = useState(false);
const [removeConfirmed, setRemoveConfirmed] = useState(false);
@@ -260,7 +260,22 @@ function Editor({ sourceId, token, person, onReview, onExpired }: { sourceId: st
if (!h) return null;
const off = h.recognitionOff;
const base = `/v1/archive/${sourceId}/people/${person.id}`;
const reenable = () => void run(`${base}/recognition`, { method: "POST", body: JSON.stringify({ enabled: true }) }, "Reconhecimento ligado. Precisa de uma foto de referência ou de um rosto confirmado para voltar a sugerir.");
return (
<>
{off && (
<div className="arq-offbanner" role="status" style={{ flexBasis: "100%" }}>
<strong>
Reconhecimento facial desativado para {person.name}
{off.by ? ` (por ${off.by})` : ""}. Não aparece em sugestões; só se identifica à mão.
</strong>
{h.canManage && (
<button type="button" className="arq-btn" disabled={busy} onClick={reenable}>
Reativar
</button>
)}
</div>
)}
<aside className="arq-editor" aria-labelledby="arq-h-rec">
<div className="arq-box">
<h2 id="arq-h-rec" className="arq-disp">
@@ -272,7 +287,7 @@ function Editor({ sourceId, token, person, onReview, onExpired }: { sourceId: st
</span>
{!off && (
<button type="button" className="arq-btn" onClick={onReview}>
Rever os rostos de {person.name}
{waiting > 0 ? `Rever ${waiting} ${waiting === 1 ? "sugestão" : "sugestões"}` : `Rever os rostos de ${person.name}`}
</button>
)}
{h.canManage && (
@@ -288,8 +303,9 @@ function Editor({ sourceId, token, person, onReview, onExpired }: { sourceId: st
</button>
)}
<div className="arq-danger">
<span className="arq-label">Zona de cuidado</span>
{off ? (
<button type="button" className="arq-btn" disabled={busy} onClick={() => void run(`${base}/recognition`, { method: "POST", body: JSON.stringify({ enabled: true }) }, "Reconhecimento ligado. Precisa de uma foto de referência ou de um rosto confirmado para voltar a sugerir.")}>
<button type="button" className="arq-btn" disabled={busy} onClick={reenable}>
Ligar o reconhecimento outra vez
</button>
) : (
@@ -353,5 +369,6 @@ function Editor({ sourceId, token, person, onReview, onExpired }: { sourceId: st
</div>
)}
</aside>
</>
);
}
+22 -2
View File
@@ -19,7 +19,7 @@ type Action = "confirm" | "reject" | "ignore" | "undo";
* event). Confirm the suggestion, say "não é", mark a false positive, name an unnamed face, undo. Selected cards
* take the same action at once. Keys on a focused card: C confirm, N não é, F false positive.
*/
export function Review({ sourceId, token, me, person, onPerson, onExpired, onChanged }: { sourceId: string; token: string; me: Me; person: string | null; onPerson: (id: string | null) => void; onExpired: () => void; onChanged: () => void }) {
export function Review({ sourceId, token, me, person, onPerson, onExpired, onChanged, onOpenPerson }: { sourceId: string; token: string; me: Me; person: string | null; onPerson: (id: string | null) => void; onExpired: () => void; onChanged: () => void; onOpenPerson?: (id: string) => void }) {
const [status, setStatus] = useState<ReviewStatus>("suggested");
const [data, setData] = useState<ReviewResult | null>(null);
const [busy, setBusy] = useState<Set<string>>(new Set());
@@ -115,6 +115,26 @@ export function Review({ sourceId, token, me, person, onPerson, onExpired, onCha
</button>
))}
</div>
<p className="arq-shortcuts" style={{ margin: 0 }}>
Atalhos: <kbd>C</kbd> confirmar · <kbd>N</kbd> não é · <kbd>F</kbd> falso positivo · clica numa cara para a selecionar
</p>
{chosen && (
<div className="arq-chosen">
<PersonFace p={{ reference: chosen.reference, face: null, name: chosen.name }} size={64} />
<div style={{ flex: "1 1 200px", display: "flex", flexDirection: "column", gap: 2 }}>
<strong style={{ fontSize: 20 }}>{chosen.name}</strong>
<span className="arq-muted">
{[chosen.club, chosen.number ? `#${chosen.number}` : null, `${chosen.waiting} por rever`].filter(Boolean).join(" · ")}
</span>
</div>
{onOpenPerson && (
<button type="button" className="arq-btn ghost" onClick={() => onOpenPerson(chosen.id)}>
Opções de reconhecimento
</button>
)}
</div>
)}
{error && (
<p className="arq-alert" role="alert">
@@ -368,7 +388,7 @@ function Card({
)}
</div>
{open !== null && faces[open] && (
<div className="arq-lightbox" role="dialog" aria-modal="true" aria-label={who ? who.name : "Fotos do grupo"} onClick={() => setOpen(null)}>
<div className="arq-rlightbox" role="dialog" aria-modal="true" aria-label={who ? who.name : "Fotos do grupo"} onClick={() => setOpen(null)}>
<button type="button" className="arq-lightbox-x" onClick={() => setOpen(null)} aria-label="Fechar">
×
</button>
+109 -1
View File
@@ -1188,6 +1188,84 @@
text-align: left;
cursor: pointer;
}
.arq-teamcard-wrap {
position: relative;
display: flex;
}
.arq-teamcard-wrap .arq-teamcard {
flex: 1;
min-width: 0;
padding-right: 120px;
}
.arq-teamcard-wrap .arq-teamcard > svg {
display: none;
}
.arq-teamcard-people {
position: absolute;
right: 14px;
top: 50%;
transform: translateY(-50%);
display: inline-flex;
align-items: center;
gap: 6px;
min-height: 36px;
padding: 0 12px;
border: 0;
border-radius: 999px;
background: var(--chip);
color: var(--chip-ink);
font-weight: 700;
font-size: 13px;
cursor: pointer;
}
.arq-teamcard-people:hover {
box-shadow: inset 0 0 0 1px currentColor;
}
.arq-h1 {
margin: 0 0 4px;
font-size: clamp(32px, 5vw, 48px);
line-height: 1;
text-transform: uppercase;
}
.arq-shortcuts {
font-size: 13px;
color: var(--muted);
}
.arq-shortcuts kbd {
display: inline-block;
min-width: 20px;
padding: 1px 6px;
border-radius: 5px;
background: var(--chip);
color: var(--chip-ink);
font: 700 12px/18px inherit;
text-align: center;
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}
.arq-offbanner {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
padding: 14px 18px;
border-radius: var(--r);
background: #fff4c2;
color: #4a3b00;
}
.arq-offbanner strong {
flex: 1 1 260px;
}
.arq-lock {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
padding: 64px 16px;
text-align: center;
}
.arq-lock svg {
opacity: 0.6;
}
.arq-teamcard:hover {
box-shadow: 0 0 0 2px var(--ink);
}
@@ -1448,6 +1526,16 @@
gap: 14px;
font-size: 14px;
}
.arq-lb-nav {
display: flex;
gap: 8px;
}
.arq-lb-nav .arq-btn {
flex: 1;
color: #ffffff;
min-height: 40px;
padding: 0 12px;
}
.arq-lightbox .arq-label {
font-size: 12px;
font-weight: 700;
@@ -1651,7 +1739,8 @@
font-size: 12px;
color: var(--muted);
}
.arq-lightbox {
/* The review cards' photo viewer (not the gallery's large view, .arq-lightbox) */
.arq-rlightbox {
position: fixed;
inset: 0;
z-index: 40;
@@ -2107,3 +2196,22 @@
display: none;
}
}
/* Review: the person being reviewed */
.arq-chosen {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 14px;
padding: 14px 16px;
border-radius: var(--r);
background: var(--card);
box-shadow: 0 0 0 1px var(--line);
}
.arq-danger .arq-label {
font-size: 12px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
color: #b42318;
}
+2
View File
@@ -95,6 +95,8 @@ const PATHS = {
check: "M5 12l5 5 9-10",
ban: "M12 20a8 8 0 100-16 8 8 0 000 16zM6.5 6.5l11 11",
review: "M4 8V5h3M17 5h3v3M20 16v3h-3M7 19H4v-3M9 10h.01M15 10h.01M9 15c2 1.5 4 1.5 6 0",
lock: "M6 11h12v9H6zM8 11V8a4 4 0 018 0v3",
link: "M10 14a4 4 0 005.7 0l3-3a4 4 0 00-5.7-5.7l-1 1M14 10a4 4 0 00-5.7 0l-3 3a4 4 0 005.7 5.7l1-1",
} as const;
export function Icon({ name, size = 20 }: { name: keyof typeof PATHS; size?: number }) {