Compare commits

...
Author SHA1 Message Date
spark e2864338fc Move the crop instructions into an in-app guide.
ci / rust (pull_request) Successful in 7m59s
ci / typescript (pull_request) Failing after 9m57s
The develop panel keeps the tools. A small i opens the chapter, and the same page covers the rest of the work.
2026-10-20 09:50:40 +01:00
spark 2279b02786 Merge pull request 'Filter the filmstrip by flag, stars and colour' (#65) from task/filmstrip-filter into main
ci / rust (push) Successful in 7m38s
ci / typescript (push) Failing after 9m57s
2026-10-20 09:06:33 +01:00
spark 0e6a1361da Give the filmstrip the same flag, star and colour filter as the grid.
ci / rust (pull_request) Successful in 7m33s
ci / typescript (pull_request) Failing after 9m37s
The open photo stays in the strip, and the choice is the one the library already keeps.
2026-10-20 09:06:17 +01:00
spark d6e3078124 Merge pull request 'Stop pulling highlights that were not measured' (#64) from task/softer-highlights into main
ci / rust (push) Successful in 8m46s
ci / typescript (push) Failing after 10m50s
2026-10-19 23:45:16 +01:00
spark e41fcd7ae1 Stop greying whites with a highlight pull that was never measured on the photo.
ci / rust (pull_request) Successful in 8m40s
ci / typescript (pull_request) Failing after 10m36s
Auto always asked for highlights −66 and shadows +52, a raw-file recipe. On a camera JPEG that flattens faces. The pull now stops at −20 and the lift at +30, and one slider can be copied on its own.
2026-10-19 23:45:02 +01:00
spark 4fd156671d Merge pull request 'Edit on this computer when the link drops' (#63) from task/library-sync into main
ci / rust (push) Successful in 7m20s
ci / typescript (push) Failing after 9m30s
2026-10-19 20:20:09 +01:00
18 changed files with 403 additions and 70 deletions

No files matched your search

+11 -8
View File
@@ -49,15 +49,18 @@ export function noiseReduction(iso: number | null | undefined): Record<string, n
} }
/** /**
* How much of a measured tone slider to keep. Exposure and contrast stay at `strength` (the event's 75%). * Highlights and shadows from Auto are one fixed recipe (the average Lightroom chose on raw files), not a
* In reportage a blown highlight is pulled and a blocked shadow is opened at the full amount the meter asked, * reading of this photo. On a camera JPEG the full figure greys a white banner and flattens a face.
* and only in that direction: a dark highlight is not lifted, a bright shadow is not crushed. * Exposure and contrast stay at `strength`. The highlight pull and the shadow lift stop at these.
*/ */
export function toneApplied(key: string, measured: number, strength: number, reportage: boolean): number { const HIGHLIGHT_PULL = 20;
if (reportage && key === "light.highlights" && measured < 0) return measured; const SHADOW_LIFT = 30;
if (reportage && key === "light.whites" && measured < 0) return measured;
if (reportage && key === "light.shadows" && measured > 0) return measured; export function toneApplied(key: string, measured: number, strength: number): number {
return measured * strength; let value = measured * strength;
if ((key === "light.highlights" || key === "light.whites") && value < -HIGHLIGHT_PULL) value = -HIGHLIGHT_PULL;
if (key === "light.shadows" && value > SHADOW_LIFT) value = SHADOW_LIFT;
return Math.round(value * 100) / 100;
} }
/** Local contrast and sharpening. Their kernel is a fraction of the whole frame, so a tight crop shows them enlarged. */ /** Local contrast and sharpening. Their kernel is a fraction of the whole frame, so a tight crop shows them enlarged. */
+1 -1
View File
@@ -117,7 +117,7 @@ export class AutopilotService {
if (engine && (settings.tone || settings.whiteBalance || settings.level)) { if (engine && (settings.tone || settings.whiteBalance || settings.level)) {
const auto = await engine.auto(preview, null); const auto = await engine.auto(preview, null);
rawAngle = auto.angle; rawAngle = auto.angle;
values = measuredValues(auto.values, settings, reportage, photo.iso, style?.offsets ?? {}); values = measuredValues(auto.values, settings, photo.iso, style?.offsets ?? {});
} }
const angle = levelAngle(rawAngle, settings.level); const angle = levelAngle(rawAngle, settings.level);
const load = this.deps.detector(); const load = this.deps.detector();
+2 -2
View File
@@ -30,11 +30,11 @@ export function levelAngle(angle: number | null, enabled: boolean): number {
/** /**
* White balance, tone and the finishing look, before the crop scales detail. Null when none of those are on: * White balance, tone and the finishing look, before the crop scales detail. Null when none of those are on:
* the same gate the server uses (it measures only when tone, white balance or level is enabled). * the same gate the server uses (it measures only when tone, white balance or level is enabled).
* Highlight and shadow figures are capped in `toneApplied`: Auto's recipe is not a reading of this photo.
*/ */
export function measuredValues( export function measuredValues(
auto: Record<string, number>, auto: Record<string, number>,
settings: PlanSettings, settings: PlanSettings,
reportage: boolean,
iso: number | null, iso: number | null,
offsets: Record<string, number>, offsets: Record<string, number>,
): Record<string, number> | null { ): Record<string, number> | null {
@@ -43,7 +43,7 @@ export function measuredValues(
if (settings.whiteBalance) for (const k of WB_KEYS) if (auto[k] !== undefined) values[k] = auto[k]! + (offsets[k] ?? 0); if (settings.whiteBalance) for (const k of WB_KEYS) if (auto[k] !== undefined) values[k] = auto[k]! + (offsets[k] ?? 0);
if (settings.tone) { if (settings.tone) {
for (const k of TONE_KEYS) { for (const k of TONE_KEYS) {
const v = toneApplied(k, auto[k] ?? 0, settings.toneStrength, reportage) + (offsets[k] ?? 0); const v = toneApplied(k, auto[k] ?? 0, settings.toneStrength) + (offsets[k] ?? 0);
if (v) values[k] = Math.round(v * 100) / 100; if (v) values[k] = Math.round(v * 100) / 100;
} }
} }
+7 -8
View File
@@ -12,14 +12,13 @@ describe("autopilot look", () => {
expect(Object.keys(agency).some((k) => k.startsWith("vignette."))).toBe(false); expect(Object.keys(agency).some((k) => k.startsWith("vignette."))).toBe(false);
}); });
it("opens blocked shadows and pulls blown highlights in full for reportage, and only that way", () => { it("keeps the fixed highlight and shadow recipe from greying a JPEG", () => {
expect(toneApplied("light.highlights", -40, 0.75, true)).toBe(-40); expect(toneApplied("light.highlights", -66, 0.75)).toBe(-20);
expect(toneApplied("light.shadows", 35, 0.75, true)).toBe(35); expect(toneApplied("light.shadows", 52, 0.75)).toBe(30);
expect(toneApplied("light.whites", -20, 0.75, true)).toBe(-20); expect(toneApplied("light.whites", -40, 0.75)).toBe(-20);
expect(toneApplied("light.highlights", 10, 0.75, true)).toBe(7.5); expect(toneApplied("light.highlights", -10, 0.75)).toBe(-7.5);
expect(toneApplied("light.shadows", -10, 0.75, true)).toBe(-7.5); expect(toneApplied("light.contrast", 68, 0.75)).toBe(51);
expect(toneApplied("light.exposure", 0.4, 0.75, true)).toBeCloseTo(0.3); expect(toneApplied("light.exposure", -0.25, 0.75)).toBeCloseTo(-0.19);
expect(toneApplied("light.highlights", -40, 0.75, false)).toBe(-30);
}); });
it("keeps structure and sharpen in proportion to the frame a crop keeps", () => { it("keeps structure and sharpen in proportion to the frame a crop keeps", () => {
+2
View File
@@ -6,6 +6,7 @@ import { ArchivePage } from "./pages/ArchivePage.js";
import { DevelopPage } from "./pages/DevelopPage.js"; import { DevelopPage } from "./pages/DevelopPage.js";
import { DeliveryPage } from "./pages/DeliveryPage.js"; import { DeliveryPage } from "./pages/DeliveryPage.js";
import { FacesQueuePage } from "./pages/FacesQueuePage.js"; import { FacesQueuePage } from "./pages/FacesQueuePage.js";
import { HelpPage } from "./pages/HelpPage.js";
import { NumbersPage } from "./pages/NumbersPage.js"; import { NumbersPage } from "./pages/NumbersPage.js";
import { PrintPage } from "./pages/PrintPage.js"; import { PrintPage } from "./pages/PrintPage.js";
import { ShopPage } from "./pages/ShopPage.js"; import { ShopPage } from "./pages/ShopPage.js";
@@ -38,6 +39,7 @@ function Gate() {
<Route path="numbers" element={<NumbersPage />} /> <Route path="numbers" element={<NumbersPage />} />
<Route path="members" element={<MembersPage />} /> <Route path="members" element={<MembersPage />} />
<Route path="preferences" element={<PreferencesPage />} /> <Route path="preferences" element={<PreferencesPage />} />
<Route path="help" element={<HelpPage />} />
<Route path="*" element={<p className="p-6 text-sm text-muted">{t.notFound}</p>} /> <Route path="*" element={<p className="p-6 text-sm text-muted">{t.notFound}</p>} />
</Route> </Route>
<Route path="/login" element={<Navigate to="/" replace />} /> <Route path="/login" element={<Navigate to="/" replace />} />
+17
View File
@@ -0,0 +1,17 @@
import { Link } from "react-router";
import { t } from "../i18n.js";
/** A small "i" that opens one chapter of the in-app guide. The tool panel stays free of the explanation. */
export function HelpLink({ section, label }: { section: string; label: string }) {
const name = `${t.help.menu}: ${label}`;
return (
<Link
to={`/help#${section}`}
aria-label={name}
title={name}
className="inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-[#5a5a5a] text-[10px] leading-none text-faint hover:border-ink hover:text-ink"
>
i
</Link>
);
}
+67 -18
View File
@@ -1,14 +1,34 @@
import { controlsForModule, type Module } from "@photoreport/contracts";
import { useState } from "react"; import { useState } from "react";
import type { Module } from "@photoreport/contracts";
import { t } from "../i18n.js"; import { t } from "../i18n.js";
import { HelpLink } from "../components/HelpLink.js";
import { SYNC_MODULES } from "./copySettings.js"; import { SYNC_MODULES } from "./copySettings.js";
/** Copy chosen groups from the active photo onto the other selected ones. Crop starts off. */ const BASIC_IDS = controlsForModule("basic").map((c) => c.id);
export function SyncSettingsButton({ count, disabled, onApply }: { count: number; disabled?: boolean; onApply: (modules: Module[]) => Promise<void> }) {
export interface SyncPick {
controls: string[];
crop: boolean;
}
function labelOf(id: string): string {
const labels = t.dev.labels as Record<string, string>;
return labels[id] ?? id;
}
/** Copy chosen controls from the active photo onto the other selected ones. Crop starts off. Basic starts on, and each of its sliders can be ticked alone. */
export function SyncSettingsButton({ count, disabled, onApply }: { count: number; disabled?: boolean; onApply: (pick: SyncPick) => Promise<void> }) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [picked, setPicked] = useState<Module[]>(["basic"]); const [picked, setPicked] = useState<string[]>(BASIC_IDS);
const [crop, setCrop] = useState(false);
const [busy, setBusy] = useState(false); const [busy, setBusy] = useState(false);
const toggle = (module: Module) => setPicked((cur) => (cur.includes(module) ? cur.filter((m) => m !== module) : [...cur, module])); const has = (id: string) => picked.includes(id);
const toggle = (id: string) => setPicked((cur) => (cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id]));
const toggleModule = (module: Module) => {
const ids = controlsForModule(module).map((c) => c.id);
const all = ids.every((id) => picked.includes(id));
setPicked((cur) => (all ? cur.filter((id) => !ids.includes(id)) : [...new Set([...cur, ...ids])]));
};
return ( return (
<span className="relative"> <span className="relative">
<button <button
@@ -20,25 +40,54 @@ export function SyncSettingsButton({ count, disabled, onApply }: { count: number
{t.dev.sync} ({count}) {t.dev.sync} ({count})
</button> </button>
{open && ( {open && (
<div className="absolute right-0 z-20 mt-1 w-56 border border-black bg-raised p-2 text-[12px] text-ink shadow-lg"> <div className="absolute right-0 z-20 mt-1 w-64 border border-black bg-raised p-2 text-[12px] text-ink shadow-lg">
<p className="mb-2 text-[11px] text-muted">{t.dev.syncHelp}</p> <div className="mb-2 flex items-start gap-2">
<ul className="flex max-h-64 flex-col gap-1 overflow-auto"> <p className="text-[11px] text-muted">{t.dev.syncHelp}</p>
{SYNC_MODULES.map((module) => ( <HelpLink section="sincronizar" label={t.help.sincronizar.title} />
<li key={module}> </div>
<label className="flex items-center gap-2"> <ul className="flex max-h-72 flex-col gap-1 overflow-auto">
<input type="checkbox" checked={picked.includes(module)} onChange={() => toggle(module)} /> {SYNC_MODULES.map((module) => {
{t.modules[module]} const ids = controlsForModule(module).map((c) => c.id);
</label> if (module === "crop") {
</li> return (
))} <li key={module}>
<label className="flex items-center gap-2">
<input type="checkbox" checked={crop} onChange={() => setCrop((v) => !v)} />
{t.modules[module]}
</label>
</li>
);
}
const all = ids.length > 0 && ids.every((id) => has(id));
return (
<li key={module}>
<label className="flex items-center gap-2">
<input type="checkbox" checked={all} onChange={() => toggleModule(module)} />
{t.modules[module]}
</label>
{module === "basic" && (
<ul className="mt-1 flex flex-col gap-1 pl-5">
{ids.map((id) => (
<li key={id}>
<label className="flex items-center gap-2">
<input type="checkbox" checked={has(id)} onChange={() => toggle(id)} />
{labelOf(id)}
</label>
</li>
))}
</ul>
)}
</li>
);
})}
</ul> </ul>
<button <button
type="button" type="button"
className="mt-2 h-7 w-full bg-accent font-semibold text-white disabled:opacity-40" className="mt-2 h-7 w-full bg-accent font-semibold text-white disabled:opacity-40"
disabled={busy || !picked.length} disabled={busy || (!picked.length && !crop)}
onClick={() => { onClick={() => {
setBusy(true); setBusy(true);
void onApply(picked) void onApply({ controls: picked, crop })
.then(() => setOpen(false)) .then(() => setOpen(false))
.finally(() => setBusy(false)); .finally(() => setBusy(false));
}} }}
+9 -8
View File
@@ -8,11 +8,12 @@ import { cropOf, localOutbox } from "./session.js";
/** Groups the photographer can copy. Crop is listed and starts off. */ /** Groups the photographer can copy. Crop is listed and starts off. */
export const SYNC_MODULES: Module[] = MODULES.filter((m) => m === "crop" || controlsForModule(m).length > 0); export const SYNC_MODULES: Module[] = MODULES.filter((m) => m === "crop" || controlsForModule(m).length > 0);
/** Only the controls in the chosen groups. Other controls on the target photo stay as they are. */ /** Only the chosen controls. Other controls on the target photo stay as they are. */
export function syncDevelopCommand(modules: readonly Module[], value: (id: string) => number): EditCommand | null { export function syncDevelopCommand(controlIds: readonly string[], value: (id: string) => number): EditCommand | null {
const wanted = new Set(controlIds);
const values: Record<string, number> = {}; const values: Record<string, number> = {};
for (const c of CONTROLS) { for (const c of CONTROLS) {
if (c.module === "crop" || !modules.includes(c.module)) continue; if (c.module === "crop" || !wanted.has(c.id)) continue;
const v = value(c.id); const v = value(c.id);
if (Number.isFinite(v)) values[c.id] = v; if (Number.isFinite(v)) values[c.id] = v;
} }
@@ -25,11 +26,11 @@ export function syncCropCommand(settings: string): EditCommand {
return { command: "crop.set", params: { rect: crop.rect, angle: crop.angle, aspect: crop.aspect } }; return { command: "crop.set", params: { rect: crop.rect, angle: crop.angle, aspect: crop.aspect } };
} }
export function commandsFrom(modules: readonly Module[], settings: string, value: (id: string) => number): EditCommand[] { export function commandsFrom(controlIds: readonly string[], crop: boolean, settings: string, value: (id: string) => number): EditCommand[] {
const out: EditCommand[] = []; const out: EditCommand[] = [];
const develop = syncDevelopCommand(modules, value); const develop = syncDevelopCommand(controlIds, value);
if (develop) out.push(develop); if (develop) out.push(develop);
if (modules.includes("crop")) out.push(syncCropCommand(settings)); if (crop) out.push(syncCropCommand(settings));
return out; return out;
} }
@@ -61,10 +62,10 @@ export async function settingsOf(api: ApiClient, photoId: string): Promise<strin
return settings; return settings;
} }
export async function commandsForPhoto(api: ApiClient, photoId: string, modules: readonly Module[]): Promise<EditCommand[]> { export async function commandsForPhoto(api: ApiClient, photoId: string, controlIds: readonly string[], crop: boolean): Promise<EditCommand[]> {
const engine = await loadEngine(); const engine = await loadEngine();
const settings = await settingsOf(api, photoId); const settings = await settingsOf(api, photoId);
return commandsFrom(modules, settings, (id) => engine.value(settings, id)); return commandsFrom(controlIds, crop, settings, (id) => engine.value(settings, id));
} }
/** Queue the commands for the other selected photos. They go out with the socket, and follow a local photo. */ /** Queue the commands for the other selected photos. They go out with the socket, and follow a local photo. */
+79 -2
View File
@@ -1035,7 +1035,7 @@ export const t = {
autoCropHelp: "Recorte automático à volta de quem a foto é: a bola e quem a disputa, ou o grupo principal, sem cortar corpos a meio.", autoCropHelp: "Recorte automático à volta de quem a foto é: a bola e quem a disputa, ou o grupo principal, sem cortar corpos a meio.",
autoCropNone: "Não encontrei um assunto claro nesta foto para recortar.", autoCropNone: "Não encontrei um assunto claro nesta foto para recortar.",
autoCropMissing: "O recorte automático ainda não está instalado neste servidor.", autoCropMissing: "O recorte automático ainda não está instalado neste servidor.",
levelHelp: "Endireita a foto pelo horizonte ou pelas linhas verticais (como o Auto do Lightroom).", levelHelp: "Endireita a foto pelo horizonte ou pelas linhas verticais.",
levelNone: "Não encontrei horizonte nem linhas verticais claras nesta foto: endireita com o ângulo.", levelNone: "Não encontrei horizonte nem linhas verticais claras nesta foto: endireita com o ângulo.",
flagState: "Marcação", flagState: "Marcação",
straighten: "Endireitar", straighten: "Endireitar",
@@ -1043,7 +1043,7 @@ export const t = {
paste: "Colar ajustes", paste: "Colar ajustes",
pasted: (n: number) => `Ajustes colados em ${n} ${n === 1 ? "foto" : "fotos"}`, pasted: (n: number) => `Ajustes colados em ${n} ${n === 1 ? "foto" : "fotos"}`,
sync: "Sincronizar ajustes", sync: "Sincronizar ajustes",
syncHelp: "Copia os grupos escolhidos da foto activa para as outras seleccionadas. O recorte fica de fora até o ligares.", syncHelp: "Copia o que estiver marcado da foto activa para as outras seleccionadas. Dentro de Básico podes marcar só um ajuste, por exemplo os realces. O recorte fica de fora até o ligares.",
syncApply: "Aplicar", syncApply: "Aplicar",
synced: (n: number) => `Ajustes sincronizados em ${n} ${n === 1 ? "foto" : "fotos"}`, synced: (n: number) => `Ajustes sincronizados em ${n} ${n === 1 ? "foto" : "fotos"}`,
noAccess: "Só podes revelar fotos que enviaste.", noAccess: "Só podes revelar fotos que enviaste.",
@@ -1067,6 +1067,83 @@ export const t = {
"crop.angle": "Ângulo", "crop.angle": "Ângulo",
} as Record<string, string>, } as Record<string, string>,
}, },
help: {
menu: "Ajuda",
title: "Ajuda",
intro: "O painel de trabalho fica só com as ferramentas. O que a app faz está aqui, para ler quando precisares.",
biblioteca: {
title: "Biblioteca",
paras: [
"Os eventos ficam à esquerda e as fotos no centro.",
"P marca a foto como escolhida, X rejeita e U tira a marca. 0 a 5 são as estrelas.",
"6 é vermelho, 7 amarelo, 8 verde e 9 azul. Carregar outra vez na mesma cor tira-a.",
"No Mac, Cmd+1 a Cmd+5 metem a cor (Cmd+5 é roxo) e Ctrl+1 a Ctrl+5 as estrelas. No Windows, Ctrl+1 a Ctrl+5 a cor e Alt+1 a Alt+5 as estrelas. T marca a escolhida, e outra vez tira.",
"Ctrl ou Cmd+A seleciona as fotos que estão à vista, não o texto da página.",
],
},
filtro: {
title: "Filtro",
caption: "A tira com Escolhidas e pelo menos 2 estrelas.",
paras: [
"A barrinha por cima das fotos, na grelha e no Revelar: Todas, Escolhidas, Sem marca, Sem rejeitadas, Rejeitadas, estrelas e cores. Combinam.",
"As estrelas querem dizer pelo menos essa. Carregar outra vez na estrela acesa apaga o filtro. A cor faz o mesmo.",
"Na tira do Revelar não há envio nem «sem jogador». Isso fica na grelha.",
"A foto que tens aberta continua na tira mesmo que não passe no filtro. Limpar filtro repõe a grelha e a tira.",
],
},
revelar: {
title: "Revelar",
paras: [
"As setas mudam de foto. A barra \\ troca o antes e o depois. Z vê a 100% e, nessa vista, arrastas para te deslocares.",
"Ctrl ou Cmd+Z anula. Com Shift, ou Ctrl ou Cmd+Y, refaz.",
"G volta à grelha nesta foto. E abre a lupa. Ctrl ou Cmd com Alt e 1 faz o mesmo que G.",
"R abre o recorte. W é o conta-gotas: clicas numa zona que devia ser cinzenta ou branca. Shift+A aplica o automático.",
"Ctrl ou Cmd+A, aqui, seleciona as fotos da tira.",
],
},
recorte: {
title: "Recorte",
caption: "Cantos e lados mudam o tamanho. Por dentro moves o recorte. Por fora rodas a foto.",
paras: [
"Enter conclui e Esc cancela. Ctrl ou Cmd com Alt e R repõe o recorte e o ângulo.",
"Auto recorta à volta de quem a foto é: a bola e quem a disputa, ou o grupo principal, sem cortar um corpo a meio.",
"Nivelar endireita pelo horizonte ou por uma linha vertical. Se não houver uma linha clara, moves o ângulo.",
],
},
sincronizar: {
title: "Sincronizar ajustes",
caption: "Só os realces seguem. O recorte fica de fora.",
paras: [
"Na tira, Shift seleciona de uma foto até à outra. Ctrl ou Cmd junta ou tira uma.",
"Sincronizar ajustes copia o que estiver marcado, da foto activa para as outras seleccionadas.",
"Em Básico podes desmarcar o grupo e deixar só um ajuste, por exemplo os realces. O recorte não vai até o marcares.",
"Uma foto que já tenha sido enviada volta a sair para esse destino cerca de um minuto depois da última alteração, com o mesmo nome, e substitui o ficheiro. A cópia dos originais não volta a sair.",
],
},
envio: {
title: "Enviar",
paras: [
"Selecionas as fotos e o destino. Podes mandar as selecionadas, só as melhores do jogo, ou o resto.",
"O resto são as outras escolhidas e as outras fotos das mesmas sequências. As melhores não se repetem. Rejeitadas nunca vão.",
"As melhores são momentos de jogo, nítidas e espalhadas pelo tempo, sem repetidas. Numa sequência fica a de frente e com os olhos abertos, quando dá para distinguir. As que têm estrelas passam à frente.",
"Enviar de novo manda outra vez as que esse destino já tinha recebido.",
],
},
ligacao: {
title: "Sem ligação",
paras: [
"Sem rede vês as pré-visualizações e editas. A alteração fica neste computador e segue quando a ligação voltar.",
"Podes deixar o original neste computador. Sobe uma pré-visualização, e o ficheiro grande só vai quando for preciso: ver a 100% ou um envio feito no servidor.",
],
},
chegada: {
title: "Quando a foto chega",
paras: [
"As fotos que chegam por FTP ou pelo ingest da app são editadas ao chegar (recorte, nivelar, tom) e as melhores de cada sequência ficam escolhidas. Tudo pode ser desfeito no Revelar. Fotos importadas à mão não são tocadas.",
"No teu computador, os nomes das pessoas só ficam guardados quando o evento tem adversário. Num estágio ou numa reportagem, identificar caras fica no servidor.",
],
},
},
modules: { modules: {
crop: "Recorte", crop: "Recorte",
basic: "Básico", basic: "Básico",
+10 -6
View File
@@ -10,14 +10,14 @@ const COLORS = ["RED", "YELLOW", "GREEN", "BLUE", "PURPLE"] as const satisfies r
const chip = (on: boolean) => (on ? "font-semibold text-ink" : "text-faint hover:text-muted"); const chip = (on: boolean) => (on ? "font-semibold text-ink" : "text-faint hover:text-muted");
/** /**
* Photo Mechanic / Lightroom style filter bar: flag, stars (at least), colour, delivery state and photos without * Flag, stars (at least) and colour, plus delivery and photos without players on the grid. All combinable.
* players, all combinable. Clicking an active stars or colour choice again turns it off. * The filmstrip uses `compact`: flag, stars and colour only. Clicking an active stars or colour choice again turns it off.
*/ */
export function FilterBar(props: { filter: LibraryFilter; onChange: (f: LibraryFilter) => void }) { export function FilterBar(props: { filter: LibraryFilter; onChange: (f: LibraryFilter) => void; compact?: boolean }) {
const { filter: f, onChange } = props; const { filter: f, onChange, compact = false } = props;
const set = (patch: Partial<LibraryFilter>) => onChange({ ...f, ...patch }); const set = (patch: Partial<LibraryFilter>) => onChange({ ...f, ...patch });
return ( return (
<div role="group" aria-label={t.filter} className="flex flex-wrap items-center gap-x-3 gap-y-1"> <div role="group" aria-label={t.filter} className={`flex items-center gap-x-3 gap-y-1 ${compact ? "flex-nowrap" : "flex-wrap"}`}>
<span className="text-faint">{t.filter}:</span> <span className="text-faint">{t.filter}:</span>
{FLAGS.map((flag) => ( {FLAGS.map((flag) => (
<button key={flag} onClick={() => set({ flag })} aria-pressed={f.flag === flag} className={chip(f.flag === flag)}> <button key={flag} onClick={() => set({ flag })} aria-pressed={f.flag === flag} className={chip(f.flag === flag)}>
@@ -52,7 +52,8 @@ export function FilterBar(props: { filter: LibraryFilter; onChange: (f: LibraryF
/> />
))} ))}
</span> </span>
<span aria-hidden="true" className="text-line">|</span> {!compact && <span aria-hidden="true" className="text-line">|</span>}
{!compact && (
<label className="flex items-center gap-1"> <label className="flex items-center gap-1">
<span className="text-faint">{t.deliveryFilter}</span> <span className="text-faint">{t.deliveryFilter}</span>
<select <select
@@ -67,9 +68,12 @@ export function FilterBar(props: { filter: LibraryFilter; onChange: (f: LibraryF
))} ))}
</select> </select>
</label> </label>
)}
{!compact && (
<button onClick={() => set({ noPlayers: !f.noPlayers })} aria-pressed={f.noPlayers} className={chip(f.noPlayers)}> <button onClick={() => set({ noPlayers: !f.noPlayers })} aria-pressed={f.noPlayers} className={chip(f.noPlayers)}>
{t.noPlayersFilter} {t.noPlayersFilter}
</button> </button>
)}
{!isAll(f) && ( {!isAll(f) && (
<button onClick={() => onChange(ALL_PHOTOS)} className="text-accent hover:underline"> <button onClick={() => onChange(ALL_PHOTOS)} className="text-accent hover:underline">
{t.clearFilter} {t.clearFilter}
+1 -1
View File
@@ -34,7 +34,7 @@ export async function planLocalAutopilot(args: {
// Both have to be here. A crop without the tone, or the reverse, would stop the server doing the rest. // Both have to be here. A crop without the tone, or the reverse, would stop the server doing the rest.
if (!measured || !detections) return; if (!measured || !detections) return;
const angle = levelAngle(measured.angle, settings.level); const angle = levelAngle(measured.angle, settings.level);
const values = measuredValues(measured.values, settings, reportage, args.iso ?? null, style?.offsets ?? {}); const values = measuredValues(measured.values, settings, args.iso ?? null, style?.offsets ?? {});
const planned = planFrame({ const planned = planFrame({
detections, detections,
width: args.width, width: args.width,
+3 -4
View File
@@ -40,12 +40,11 @@ describe("shared detector decode", () => {
describe("sync chosen groups", () => { describe("sync chosen groups", () => {
it("writes the chosen controls and leaves the crop for its own command", () => { it("writes the chosen controls and leaves the crop for its own command", () => {
const cmd = syncDevelopCommand(["basic"], (id) => (id === "light.exposure" ? 0.4 : 0)); const cmd = syncDevelopCommand(["light.highlights"], (id) => (id === "light.highlights" ? -20 : 0));
expect(cmd?.command).toBe("develop.set"); expect(cmd?.command).toBe("develop.set");
if (cmd?.command !== "develop.set") return; if (cmd?.command !== "develop.set") return;
expect(cmd.params.values["light.exposure"]).toBe(0.4); expect(cmd.params.values).toEqual({ "light.highlights": -20 });
expect(cmd.params.values["crop.angle"]).toBeUndefined(); expect(syncDevelopCommand([], () => 1)).toBeNull();
expect(syncDevelopCommand(["crop"], () => 1)).toBeNull();
}); });
}); });
+23 -8
View File
@@ -3,6 +3,7 @@ import { type DeliveryTarget, hasRole } from "@photoreport/sdk";
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react"; import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
import { useLocation, useNavigate, useParams } from "react-router"; import { useLocation, useNavigate, useParams } from "react-router";
import { useAuth } from "../auth.js"; import { useAuth } from "../auth.js";
import { HelpLink } from "../components/HelpLink.js";
import { type EngineModule, loadEngine } from "../develop/engine.js"; import { type EngineModule, loadEngine } from "../develop/engine.js";
import { DevelopPanels, Section, Slider } from "../develop/Panels.js"; import { DevelopPanels, Section, Slider } from "../develop/Panels.js";
import { type Crop, cropOf, DevelopSession, localOutbox } from "../develop/session.js"; import { type Crop, cropOf, DevelopSession, localOutbox } from "../develop/session.js";
@@ -11,12 +12,13 @@ import { commandsFrom, queueSync } from "../develop/copySettings.js";
import { clampUnit, constrainRotated, fitAspect, GUIDES, type Guide, rotateAspect } from "../develop/crop.js"; import { clampUnit, constrainRotated, fitAspect, GUIDES, type Guide, rotateAspect } from "../develop/crop.js";
import { engineAuto, Viewer } from "../develop/Viewer.js"; import { engineAuto, Viewer } from "../develop/Viewer.js";
import { IptcInfo } from "../library/IptcInfo.js"; import { IptcInfo } from "../library/IptcInfo.js";
import { activePhoto, savedFilter, setActivePhoto } from "../library/active.js"; import { activePhoto, savedFilter, saveFilter, setActivePhoto } from "../library/active.js";
import { FilterBar } from "../library/FilterBar.js";
import { cache } from "../offline/cache.js"; import { cache } from "../offline/cache.js";
import { localPhotos } from "../offline/local.js"; import { localPhotos } from "../offline/local.js";
import { isNetworkError, offlineQueue } from "../offline/queue.js"; import { isNetworkError, offlineQueue } from "../offline/queue.js";
import { patchPhotos, useOfflineSync } from "../offline/sync.js"; import { patchPhotos, useOfflineSync } from "../offline/sync.js";
import { applyPatch, isMac, type LibraryFilter, matchesFilter, patchForKey, pmPatchForKey } from "../library/store.js"; import { ALL_PHOTOS, applyPatch, isMac, type LibraryFilter, matchesFilter, patchForKey, pmPatchForKey } from "../library/store.js";
import { t } from "../i18n.js"; import { t } from "../i18n.js";
import { useLibraryLive } from "../library/realtime.js"; import { useLibraryLive } from "../library/realtime.js";
import { isDesktop, localOriginalToView, prefs } from "../platform.js"; import { isDesktop, localOriginalToView, prefs } from "../platform.js";
@@ -151,9 +153,18 @@ export function DevelopPage() {
const here = localPhotos.list().filter((p) => (scope === "inbox" ? p.eventId === null : p.eventId === scope) && !all.some((q) => q.sha256 === p.sha256)); const here = localPhotos.list().filter((p) => (scope === "inbox" ? p.eventId === null : p.eventId === scope) && !all.some((q) => q.sha256 === p.sha256));
return here.length ? [...all, ...here].sort((a, b) => (a.capturedAt ?? "").localeCompare(b.capturedAt ?? "")) : all; return here.length ? [...all, ...here].sort((a, b) => (a.capturedAt ?? "").localeCompare(b.capturedAt ?? "")) : all;
}, [all, localVersion, scope]); // eslint-disable-line react-hooks/exhaustive-deps }, [all, localVersion, scope]); // eslint-disable-line react-hooks/exhaustive-deps
// The filmstrip follows the library's filter, like Lightroom's (the open photo stays even if it doesn't match). // The filmstrip follows the same filter as the grid. The open photo stays even when it does not match.
const filterJson = JSON.stringify(savedFilter(orgId)); const [filter, setFilter] = useState<LibraryFilter>(() => (orgId ? savedFilter(orgId) : ALL_PHOTOS));
const filter = useMemo(() => JSON.parse(filterJson) as LibraryFilter, [filterJson]); useEffect(() => {
if (orgId) setFilter(savedFilter(orgId));
}, [orgId]);
const changeFilter = useCallback(
(next: LibraryFilter) => {
setFilter(next);
saveFilter(orgId, next);
},
[orgId],
);
useEffect(() => { useEffect(() => {
if (!withLocal) return; if (!withLocal) return;
const ready = withLocal.filter((p) => p.status === "READY"); const ready = withLocal.filter((p) => p.status === "READY");
@@ -686,9 +697,9 @@ export function DevelopPage() {
</option> </option>
))} ))}
</select> </select>
<HelpLink section="recorte" label={t.help.recorte.title} />
</label> </label>
</div> </div>
<p className="mb-2 text-[11px] text-faint">{t.dev.cropHelp}</p>
{angle && ( {angle && (
<div className="flex items-end gap-2"> <div className="flex items-end gap-2">
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
@@ -741,9 +752,9 @@ export function DevelopPage() {
<SyncSettingsButton <SyncSettingsButton
count={[...selected].filter((id) => id !== current.id).length} count={[...selected].filter((id) => id !== current.id).length}
disabled={!canEdit || !session?.loaded} disabled={!canEdit || !session?.loaded}
onApply={async (modules) => { onApply={async ({ controls, crop }) => {
if (!session?.loaded || !current) return; if (!session?.loaded || !current) return;
const commands = commandsFrom(modules, session.settings, (id) => session.value(id)); const commands = commandsFrom(controls, crop, session.settings, (id) => session.value(id));
const ids = [...selected].filter((id) => id !== current.id); const ids = [...selected].filter((id) => id !== current.id);
if (!commands.length || !ids.length) return; if (!commands.length || !ids.length) return;
queueSync(orgId, ids, commands); queueSync(orgId, ids, commands);
@@ -777,6 +788,10 @@ export function DevelopPage() {
</aside> </aside>
</div> </div>
<div className="flex h-7 shrink-0 items-center gap-2 overflow-x-auto border-t border-line bg-chrome px-2 text-[11px]">
<FilterBar compact filter={filter} onChange={changeFilter} />
<HelpLink section="filtro" label={t.help.filtro.title} />
</div>
<div ref={strip} className="flex h-[92px] shrink-0 gap-1 overflow-x-auto border-t border-line bg-chrome p-1.5" aria-label="Fotos do evento"> <div ref={strip} className="flex h-[92px] shrink-0 gap-1 overflow-x-auto border-t border-line bg-chrome p-1.5" aria-label="Fotos do evento">
{photos.map((p) => ( {photos.map((p) => (
<button <button
+28
View File
@@ -0,0 +1,28 @@
import { render, screen } from "@testing-library/react";
import { MemoryRouter } from "react-router";
import { describe, expect, it } from "vitest";
import { HelpLink } from "../components/HelpLink.js";
import { HelpPage } from "./HelpPage.js";
describe("help", () => {
it("teaches the crop from the guide, with the screen it belongs to", () => {
render(
<MemoryRouter>
<HelpPage />
</MemoryRouter>,
);
expect(screen.getByRole("heading", { name: "Recorte" })).toBeTruthy();
expect(screen.getByText(/Shift mantém a forma/)).toBeTruthy();
expect(screen.getByText("Bloquear")).toBeTruthy();
expect(screen.getByText(/Só os realces seguem/)).toBeTruthy();
});
it("opens a chapter from the small i", () => {
render(
<MemoryRouter>
<HelpLink section="recorte" label="Recorte" />
</MemoryRouter>,
);
expect(screen.getByRole("link", { name: "Ajuda: Recorte" }).getAttribute("href")).toBe("/help#recorte");
});
});
+135
View File
@@ -0,0 +1,135 @@
import { useEffect, type ReactNode } from "react";
import { Link, useLocation } from "react-router";
import { t } from "../i18n.js";
import { FilterBar } from "../library/FilterBar.js";
import { ALL_PHOTOS } from "../library/store.js";
import { PageHeader } from "./Shell.js";
const CHAPTERS = ["biblioteca", "filtro", "revelar", "recorte", "sincronizar", "envio", "ligacao", "chegada"] as const;
type ChapterId = (typeof CHAPTERS)[number];
const HANDLES = [
"left-0 top-0",
"left-1/2 top-0 -translate-x-1/2",
"right-0 top-0",
"left-0 top-1/2 -translate-y-1/2",
"right-0 top-1/2 -translate-y-1/2",
"bottom-0 left-0",
"bottom-0 left-1/2 -translate-x-1/2",
"bottom-0 right-0",
];
function chapter(id: ChapterId) {
return t.help[id];
}
/** The crop tool as it sits in Revelar, so the guide shows the screen instead of only describing it. */
function CropExample() {
return (
<figure className="my-3 max-w-md border border-line bg-[#1a1a1b]">
<div className="relative aspect-[3/2] w-full bg-[#2a2c28]">
<div className="absolute inset-[18%] border border-white/80">
{HANDLES.map((pos) => (
<span key={pos} className={`absolute h-1.5 w-1.5 bg-white ${pos}`} />
))}
</div>
</div>
<div className="flex flex-wrap items-center gap-1 border-t border-line bg-chrome p-2 text-[11px]">
<span className="border border-black bg-cell-on px-2 py-1 text-ink">{t.dev.cropLock}</span>
<span className="border border-black bg-cell px-2 py-1 text-muted">{t.dev.cropSwap}</span>
<span className="border border-black bg-cell px-2 py-1 text-muted">{t.dev.cropReset}</span>
<span className="ml-auto text-faint">{t.dev.guides}</span>
<span className="border border-black bg-cell px-2 py-1 text-ink">{t.dev.guideNames.grid}</span>
</div>
<figcaption className="px-2 py-1 text-[11px] text-faint">{t.help.recorte.caption}</figcaption>
</figure>
);
}
function FilterExample() {
return (
<figure className="my-3 overflow-x-auto border border-line bg-chrome px-2 py-1.5 text-[11px]">
<div className="pointer-events-none">
<FilterBar compact filter={{ ...ALL_PHOTOS, flag: "PICK", minRating: 2 }} onChange={() => {}} />
</div>
<figcaption className="pt-1 text-faint">{t.help.filtro.caption}</figcaption>
</figure>
);
}
function SyncExample() {
const rows: { id: keyof typeof t.dev.labels; on: boolean }[] = [
{ id: "light.exposure", on: false },
{ id: "light.contrast", on: false },
{ id: "light.highlights", on: true },
{ id: "light.shadows", on: false },
{ id: "light.whites", on: false },
{ id: "light.blacks", on: false },
];
return (
<figure className="my-3 w-56 border border-black bg-raised p-2 text-[12px] text-ink">
<p>{t.modules.basic}</p>
<ul className="mt-1 flex flex-col gap-1 pl-4">
{rows.map((row) => (
<li key={row.id} className="flex items-center gap-2">
<span aria-hidden="true">{row.on ? "☑" : "☐"}</span>
{t.dev.labels[row.id]}
</li>
))}
</ul>
<p className="mt-2 flex items-center gap-2">
<span aria-hidden="true">☐</span>
{t.modules.crop}
</p>
<figcaption className="mt-2 text-[11px] text-faint">{t.help.sincronizar.caption}</figcaption>
</figure>
);
}
const FIGURES: Partial<Record<ChapterId, () => ReactNode>> = {
filtro: FilterExample,
recorte: CropExample,
sincronizar: SyncExample,
};
/** The guide: one chapter per job, with the screen it belongs to. */
export function HelpPage() {
const { hash } = useLocation();
useEffect(() => {
const id = hash.replace(/^#/, "");
if (id) document.getElementById(id)?.scrollIntoView();
}, [hash]);
return (
<>
<PageHeader title={t.help.title} />
<div className="mx-auto max-w-3xl px-6 py-6">
<p className="text-sm text-muted">{t.help.intro}</p>
<nav aria-label={t.help.title} className="mt-4 flex flex-wrap gap-x-4 gap-y-1 text-[13px]">
{CHAPTERS.map((id) => (
<Link key={id} to={`/help#${id}`} className="text-faint hover:text-ink">
{chapter(id).title}
</Link>
))}
</nav>
{CHAPTERS.map((id) => {
const item = chapter(id);
const Figure = FIGURES[id];
return (
<section key={id} id={id} className="mt-8 scroll-mt-6 border-t border-line pt-4">
<h2 className="text-sm font-semibold">{item.title}</h2>
{Figure && <Figure />}
<div className="mt-2 flex flex-col gap-2 text-[13px] leading-relaxed text-muted">
{id === "recorte" && <p>{t.dev.cropHelp}</p>}
{item.paras.map((para) => (
<p key={para}>{para}</p>
))}
</div>
</section>
);
})}
</div>
</>
);
}
+2 -2
View File
@@ -566,8 +566,8 @@ export function LibraryPage() {
{canCull && focus && selection.length > 1 && ( {canCull && focus && selection.length > 1 && (
<SyncSettingsButton <SyncSettingsButton
count={selection.filter((p) => p.id !== focus.id).length} count={selection.filter((p) => p.id !== focus.id).length}
onApply={async (modules) => { onApply={async ({ controls, crop }) => {
const commands = await commandsForPhoto(api, focus.id, modules); const commands = await commandsForPhoto(api, focus.id, controls, crop);
const ids = selection.map((p) => p.id).filter((id) => id !== focus.id); const ids = selection.map((p) => p.id).filter((id) => id !== focus.id);
if (!commands.length || !ids.length) return; if (!commands.length || !ids.length) return;
queueSync(orgId, ids, commands); queueSync(orgId, ids, commands);
+3
View File
@@ -126,6 +126,9 @@ export function Shell() {
{t.members} {t.members}
</NavLink> </NavLink>
)} )}
<NavLink to="/help" className="block px-3 py-2 hover:bg-raised">
{t.help.menu}
</NavLink>
<NavLink to="/preferences" className="block px-3 py-2 hover:bg-raised"> <NavLink to="/preferences" className="block px-3 py-2 hover:bg-raised">
{t.preferences} {t.preferences}
</NavLink> </NavLink>
+3 -2
View File
@@ -117,8 +117,9 @@ every photo of a match. They never go over a measured control.
(never under a third), so a tight portrait does not grow a halo. There is never a vignette or a local change (§1). (never under a third), so a tight portrait does not grow a halo. There is never a vignette or a local change (§1).
Defaults follow the agencies: white balance on (neutral whites) and 75% of the automatic tone (full range, Defaults follow the agencies: white balance on (neutral whites) and 75% of the automatic tone (full range,
pure blacks). In reportage the measured highlights and whites are pulled in full when they are too bright, and pure blacks). Highlights and shadows in that automatic tone are one fixed recipe from raw files, not a reading
the measured shadows are opened in full when they are blocked. Neither slider is pushed the other way. of the photo. On a camera JPEG the full recipe greys whites and flattens faces, so the highlight pull stops at
−20 and the shadow lift at +30.
Uploads made by hand in the browser are not touched. Anything the autopilot did can be undone, changed or reset Uploads made by hand in the browser are not touched. Anything the autopilot did can be undone, changed or reset
in Revelar. in Revelar.