From 9a2148b2edeb3703f15466eca6df7dacc464bb23 Mon Sep 17 00:00:00 2001 From: spark Date: Mon, 19 Oct 2026 09:51:54 +0000 Subject: [PATCH 1/2] Archive site: more of the design (copy link, select in the large view, review and person details), and fix the large view's layout. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 Claude-Session: https://claude.ai/code/session_017sovZz1NXBwx4VySojoyA1 --- .../site/src/app/arquivo/[id]/ArchiveView.tsx | 18 ++- apps/site/src/app/arquivo/[id]/Browse.tsx | 47 ++++++-- apps/site/src/app/arquivo/[id]/Gallery.tsx | 36 ++++++ apps/site/src/app/arquivo/[id]/Lightbox.tsx | 21 +++- apps/site/src/app/arquivo/[id]/PhotosOf.tsx | 25 +++- apps/site/src/app/arquivo/[id]/Review.tsx | 24 +++- apps/site/src/app/arquivo/[id]/archive.css | 110 +++++++++++++++++- apps/site/src/app/arquivo/[id]/parts.tsx | 2 + 8 files changed, 262 insertions(+), 21 deletions(-) diff --git a/apps/site/src/app/arquivo/[id]/ArchiveView.tsx b/apps/site/src/app/arquivo/[id]/ArchiveView.tsx index 8318496..19d3074 100644 --- a/apps/site/src/app/arquivo/[id]/ArchiveView.tsx +++ b/apps/site/src/app/arquivo/[id]/ArchiveView.tsx @@ -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 ? (
+ ) : tab === "review" ? ( +
+
+ +

+ Só para quem pode editar +

+

+ 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. +

+ +
+
) : ( - go({ kind: "gallery", id })} onPerson={(id) => go({ kind: "person", id })} /> + go({ kind: "gallery", id })} onPerson={(id) => go({ kind: "person", id })} canReview={!!me?.canReview} /> )} diff --git a/apps/site/src/app/arquivo/[id]/Browse.tsx b/apps/site/src/app/arquivo/[id]/Browse.tsx index 59aca2a..293dcba 100644 --- a/apps/site/src/app/arquivo/[id]/Browse.tsx +++ b/apps/site/src/app/arquivo/[id]/Browse.tsx @@ -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" && ( <> +

Pessoas

{people && people.clubs.length > 1 && (
@@ -370,20 +376,37 @@ export function Browse({ Equipas {teams ? shownTeams.length : ""}
+

+ Cada equipa aparece uma vez, mesmo com vários nomes nas pastas. Abre os jogos da equipa ou as pessoas identificadas dela. +

{!teams && !failed && } {teams && shownTeams.length === 0 &&

Nenhuma equipa com esse nome.

}
{shownTeams.slice(0, teamsShown).map((t) => ( - +
+ + +
))}
{shownTeams.length > teamsShown && ( diff --git a/apps/site/src/app/arquivo/[id]/Gallery.tsx b/apps/site/src/app/arquivo/[id]/Gallery.tsx index d95e6f7..8023308 100644 --- a/apps/site/src/app/arquivo/[id]/Gallery.tsx +++ b/apps/site/src/app/arquivo/[id]/Gallery.tsx @@ -195,6 +195,19 @@ export function Gallery({ {picked ? "Cancelar seleção" : "Selecionar fotos"} +
{note &&

{note}

} {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 ? ( + <> + Jogo + + {g.home} vs {g.away} + {g.startsAt ? ` · ${shortDay.format(new Date(g.startsAt))}` : ""} + + + ) : ( + <> + Galeria + {g.title} + + ) + } /> )} diff --git a/apps/site/src/app/arquivo/[id]/Lightbox.tsx b/apps/site/src/app/arquivo/[id]/Lightbox.tsx index 3b19ccc..005079e 100644 --- a/apps/site/src/app/arquivo/[id]/Lightbox.tsx +++ b/apps/site/src/app/arquivo/[id]/Lightbox.tsx @@ -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} + {onSelect && ( + + )} {onDownload && ( - @@ -148,6 +159,14 @@ export function Lightbox({ )}
)}
@@ -333,13 +581,22 @@ export function Browse({ Limpar )} + {canManage && + club && + people.clubs + .find((c) => c.name === club) + ?.also?.map((a) => ( + + ))}
)} {!people && !failed && } {emptyPeople &&

{emptyPeople}

}
{shownPeople.slice(0, peopleShown).map((p) => ( - diff --git a/apps/site/src/app/arquivo/[id]/Gallery.tsx b/apps/site/src/app/arquivo/[id]/Gallery.tsx index 8023308..8838e97 100644 --- a/apps/site/src/app/arquivo/[id]/Gallery.tsx +++ b/apps/site/src/app/arquivo/[id]/Gallery.tsx @@ -19,7 +19,10 @@ export function Gallery({ onExpired, onFace, onPerson, + onReview, }: { + /** Opens the face review on this gallery (those who review). */ + onReview?: (galleryId: string, title: string) => void; id: string; sourceId: string; me: Me | null; @@ -109,6 +112,12 @@ export function Gallery({ Galerias + {g?.season && ( + <> + + Época {g.season} + + )} {g?.competition && ( <> @@ -154,13 +163,24 @@ export function Gallery({ const total = g.total ?? photos.length; const isGame = !!(g.home && g.away); const when = [g.startsAt ? shortDay.format(new Date(g.startsAt)) : null, g.section].filter(Boolean).join(" · "); + const place = [g.venue, g.city && !(g.venue ?? "").includes(g.city) ? g.city : null].filter(Boolean).join(", "); return ( <>
{crumbs} - {when && {when}} + {(when || place) && ( + + {when} + {place && ( + + + {place} + + )} + + )} {isGame ? (
@@ -209,6 +229,13 @@ export function Gallery({ Copiar ligação
+ {!!g.pending && onReview && ( + + )} {note &&

{note}

} {g.cloudUrl && ( @@ -287,6 +314,11 @@ export function Gallery({ aria-label={p.players.join(", ") || p.name} > + {!picked && !!p.pending && ( + + {p.pending} + + )} {picked && {picked.has(p.id) ? : null}} {p.players.length > 0 && ( @@ -351,6 +383,12 @@ export function Gallery({ {g.home} vs {g.away} {g.startsAt ? ` · ${shortDay.format(new Date(g.startsAt))}` : ""} + {place && ( + <> + Local + {place} + + )} ) : ( <> diff --git a/apps/site/src/app/arquivo/[id]/Lightbox.tsx b/apps/site/src/app/arquivo/[id]/Lightbox.tsx index 005079e..a758e2b 100644 --- a/apps/site/src/app/arquivo/[id]/Lightbox.tsx +++ b/apps/site/src/app/arquivo/[id]/Lightbox.tsx @@ -44,7 +44,7 @@ export function Lightbox({ const [acting, setActing] = useState(null); const [refused, setRefused] = useState(null); - const act = (f: PhotoFace, action: "confirm" | "reject" | "ignore") => { + const act = (f: PhotoFace, action: "confirm" | "reject" | "ignore" | "undo") => { if (!review || !f.groupId) return; setActing(f.id); setRefused(null); @@ -98,6 +98,8 @@ export function Lightbox({ }, [index, photos.length, onIndex]); const faces = (current.faces ?? []).filter((f) => f.box); + const sure = (f: PhotoFace) => (f.level === "probable" && typeof f.score === "number" ? ` · ${Math.round(f.score * 100)}% de certeza` : ""); + const STATE: Record = { confirmed: "Confirmado", probable: "Sugestão", ignored: "Falso positivo" }; const aspect = current.width && current.height ? current.width / current.height : 1.5; return (
@@ -138,9 +140,9 @@ export function Lightbox({ className={`arq-face-box ${f.level ?? "unknown"}`} style={{ left: `${f.box!.x0 * 100}%`, top: `${f.box!.y0 * 100}%`, width: `${(f.box!.x1 - f.box!.x0) * 100}%`, height: `${(f.box!.y1 - f.box!.y0) * 100}%` }} onClick={() => onFace(f.id)} - aria-label={f.person ? `${f.person.name}${f.level === "probable" ? " (provável)" : ""}: mais fotos` : "Mais fotos desta cara"} + aria-label={f.level === "ignored" ? "Falso positivo" : f.person ? `${f.person.name}${f.level === "probable" ? " (sugestão)" : ""}: mais fotos` : "Mais fotos desta cara"} > - {f.person && {f.person.name}} + {f.person && f.level !== "ignored" && {f.person.name}} ))} {(faces.length === 0 || !showFaces) && current.face && ( @@ -178,14 +180,30 @@ export function Lightbox({
    {faces.map((f) => (
  • - - {review && f.groupId && f.level && ( + {review && f.groupId && f.level === "ignored" && ( + + + + )} + {review && f.groupId && f.level && f.level !== "ignored" && ( {f.level === "probable" && (
+ {(h.references !== undefined || h.rejected !== undefined) && ( +
+ O que o reconhecimento sabe +
+ + {h.confirmedGroups ?? 0} + {h.confirmedGroups === 1 ? "rosto confirmado" : "rostos confirmados"} + + + {h.rejected ?? 0} + “Não é” + +
+ {!!h.references?.length && ( + <> + Fotos de referência +
+ {h.references.map((r) => ( + + {r.kind === "official" ? ( + + ) : ( + + )} + {r.kind === "official" && Oficial} + {(r.kind === "confirmed" || h.canManage) && !off && ( + + )} + + ))} +
+ Uma foto errada aqui puxa sugestões erradas: retira-a com ✕. + + )} +
+ )} {h.actions.length > 0 && (
Histórico diff --git a/apps/site/src/app/arquivo/[id]/Review.tsx b/apps/site/src/app/arquivo/[id]/Review.tsx index 89f1628..f29d3c1 100644 --- a/apps/site/src/app/arquivo/[id]/Review.tsx +++ b/apps/site/src/app/arquivo/[id]/Review.tsx @@ -19,7 +19,32 @@ 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, onOpenPerson }: { sourceId: string; token: string; me: Me; person: string | null; onPerson: (id: string | null) => void; onExpired: () => void; onChanged: () => void; onOpenPerson?: (id: string) => void }) { +export function Review({ + sourceId, + token, + me, + person, + gallery = null, + onPerson, + onGallery, + onOpenGallery, + onExpired, + onChanged, + onOpenPerson, +}: { + sourceId: string; + token: string; + me: Me; + person: string | null; + /** Âmbito: one gallery's faces (null: every folder the viewer edits). */ + gallery?: string | null; + onPerson: (id: string | null) => void; + onGallery?: (id: string | null) => void; + onOpenGallery?: (id: string) => void; + onExpired: () => void; + onChanged: () => void; + onOpenPerson?: (id: string) => void; +}) { const [status, setStatus] = useState("suggested"); const [data, setData] = useState(null); const [busy, setBusy] = useState>(new Set()); @@ -37,6 +62,7 @@ export function Review({ sourceId, token, me, person, onPerson, onExpired, onCha setSelected(new Set()); const params = new URLSearchParams({ status, limit: "60" }); if (person) params.set("person", person); + if (gallery) params.set("gallery", gallery); call(`/v1/archive/${sourceId}/review?${params}`, token).then( ({ body }) => !cancel && setData(body), (err) => { @@ -48,7 +74,7 @@ export function Review({ sourceId, token, me, person, onPerson, onExpired, onCha return () => { cancel = true; }; - }, [sourceId, token, status, person, onExpired, attempt]); + }, [sourceId, token, status, person, gallery, onExpired, attempt]); const act = useCallback( async (ids: string[], action: Action, personId?: string) => { @@ -90,6 +116,10 @@ export function Review({ sourceId, token, me, person, onPerson, onExpired, onCha }); const chosen = data?.people.find((p) => p.id === person) ?? null; const ids = [...selected]; + // Progress in the scope: faces with an answer (confirmed, "não é", false positive) of all there are to answer. + const answered = data ? data.counts.confirmed + data.counts.rejected + data.counts.ignored : 0; + const open = data ? data.counts.suggested + data.counts.unnamed : 0; + const progress = answered + open > 0 ? Math.round((answered / (answered + open)) * 100) : 100; return (
@@ -107,6 +137,39 @@ export function Review({ sourceId, token, me, person, onPerson, onExpired, onCha )}
+
+ Âmbito + + {gallery ? ( + <> + {data?.gallery?.title ?? "Esta galeria"} + {onOpenGallery && ( + + )} + {onGallery && ( + + )} + + ) : ( + Todas as pastas onde podes editar + )} + + {data && ( + + + + + + {answered} de {answered + open} revistos · {progress}% + + + )} +
+
{STATUS.map(([s, label]) => (