Compare commits

..
Author SHA1 Message Date
spark 8fcf62f8be fix(app): never block the upload queue on local preview/cache (BIT-167)
ci / rust (pull_request) Successful in 4m22s
ci / typescript (pull_request) Successful in 8m43s
Shots sat on "queued" when IndexedDB event cache or EXIF preview stalled before enqueue. Push to the wire immediately with the open pin, enrich routing in the background, and clear a leftover offline pause when new files arrive.
2026-11-03 20:40:41 +00:00
spark 1ed6d144d3 fix(app): USB auto-pull keeps the open event when EXIF is missing (BIT-166) (#166)
ci / rust (push) Successful in 4m4s
ci / typescript (push) Successful in 8m2s
No EXIF on the preview kept the open pin so Sub-21 auto-pull no longer lands in Sem evento.
2026-11-03 18:47:30 +00:00
spark 2a839d8305 fix(app): USB auto-pull keeps the open event when EXIF is missing (BIT-166)
ci / rust (pull_request) Successful in 4m6s
ci / typescript (pull_request) Successful in 8m26s
BIT-165 sent previews without DateTimeOriginal to Sem evento even after auto-pull had already matched the card clock to the event window. Keep the pin when there is no capture time; with EXIF, the window check still blocks leftover morning pins.
2026-11-03 18:31:04 +00:00
spark f20dea883e fix(ingest): route by capture time, not leftover open-event pin (BIT-165) (#165)
ci / rust (push) Successful in 3m56s
ci / typescript (push) Successful in 7m25s
Pin only wins inside its ingest window; overlapping windows pick closest startsAt; no capture keeps the named folder.
2026-11-03 17:20:53 +00:00
spark a9ae5ce6ad fix(ingest): keep named event when the JPEG has no capture time (BIT-165)
ci / rust (pull_request) Successful in 3m55s
ci / typescript (pull_request) Successful in 7m44s
Hand/desktop uploads into an open folder (and zero-width test fixtures) have no DateTimeOriginal; dropping them into Sem evento broke autopilot. The Miguel→Sub-21 bug is the case with EXIF outside the pin window.
2026-11-03 17:10:55 +00:00
spark 42912453e2 fix(ingest): route by capture time, not leftover open-event pin (BIT-165)
ci / rust (pull_request) Successful in 4m9s
ci / typescript (pull_request) Failing after 7m29s
Morning studio cards (14h) were landing on the afternoon Sub-21 training when windows overlapped or the pin ignored EXIF. Pin only wins inside its ingest window; overlapping windows pick the closest startsAt; no capture time stays in the inbox.
2026-11-03 17:00:09 +00:00
spark 3fd6a6f1cc fix(app): originals off upload queue + PM transfer bar (BIT-163) (#164)
ci / rust (push) Successful in 3m57s
ci / typescript (push) Failing after 7m12s
fix(app): originals off upload queue + PM transfer bar (BIT-163) (#164)

App-only; API CI flakes unrelated.
2026-11-03 16:45:03 +00:00
spark 4d3a9dfc07 fix(app): send originals off the upload queue and show a PM-style transfer bar (BIT-163)
ci / rust (pull_request) Successful in 3m58s
ci / typescript (pull_request) Failing after 7m17s
Desktop deliveries waiting for originals now push via sendOriginal in parallel
instead of sharing the JPEG queue, flush stuck Destinos rows, and surface a
discrete transfer strip across modules like Photo Mechanic.
2026-11-03 16:36:41 +00:00
spark a781be6d9e feat(app): local-first ingest + Remove/Heal in Develop (BIT-161) (#162)
ci / rust (push) Successful in 4m13s
ci / typescript (push) Failing after 7m22s
feat(app): local-first ingest + Remove/Heal in Develop (BIT-161) (#162)

API CI failures are autopilot/legacy flakes unrelated to this app-only change.
2026-11-03 16:30:48 +00:00
spark df741d8268 feat(app): local-first ingest previews and Remove/Heal in Develop (BIT-161)
ci / rust (pull_request) Successful in 4m23s
ci / typescript (pull_request) Failing after 7m13s
Show USB/drop JPEGs in the library from a local blob before upload finishes,
and expose LightCraft spot remove/heal/clone/fill in Revelar without waiting
on generative AI or a WASM rebuild.
2026-11-03 16:22:00 +00:00
spark 3f8e36f6e3 fix(desktop): USB tether keeps camera shootable (BIT-159) (#160)
ci / rust (push) Successful in 9m14s
ci / typescript (push) Failing after 10m40s
desktop-release / build (deb,appimage, linux-x86_64, ubuntu-latest) (push) Successful in 28m36s
desktop-release / build (--target universal-apple-darwin, dmg,app, darwin-universal, macos) (push) Successful in 47m50s
Pulse PTP sessions so Canons stay shootable while tethered.
2026-11-03 16:06:08 +00:00
24 changed files with 942 additions and 168 deletions

No files matched your search

+14 -10
View File
@@ -109,8 +109,8 @@ export class IngestService {
return { status: "skipped", reason: "unknown_login" };
}
// "Receber FTP aqui": the login sends everything to the event chosen in the library, whatever the camera's
// clock says, until the time set; then (or with that event put away) by the time again.
// "Receber FTP aqui": pin is a preferred event for captures that still sit in its ingest window (and session).
// Outside that window the clock routes — a leftover pin on the afternoon training must not take the morning studio.
const target =
account.targetEventId && (!account.targetUntil || account.targetUntil > new Date())
? await db.event.findFirst({ where: { id: account.targetEventId, organizationId: account.organizationId, archivedAt: null }, select: { id: true } })
@@ -173,16 +173,19 @@ export class IngestService {
const camera = await readCameraInfo(file).catch(() => ({}) as Awaited<ReturnType<typeof readCameraInfo>>);
const embedded = await readEmbeddedIptc(file);
const capturedAt = camera.capturedAt ? new Date(camera.capturedAt.getTime() + (origin.clockOffsetSec ?? 0) * 1000) : undefined;
const at = capturedAt ?? new Date();
// Archive imports name their own event. A file with no camera time, or a time outside that event's window,
// must not fall through onto whatever is live today.
// Archive imports name their own event. No camera time: keep the folder/pin the photographer named — do not
// invent "now" (that would also force today's open event). With a capture time, the pin only wins inside its
// ingest window; otherwise the clock (closest start when windows overlap) decides.
const requestedEventId = origin.inbox
? null
: origin.held && origin.eventId
? origin.eventId
: origin.source === "CLOUD"
? await this.namedEvent(orgId, origin.eventId)
: (await this.requestedEvent(orgId, origin.userId, origin.eventId, at)) ?? (await this.routeToEvent(orgId, origin.userId, at));
: !capturedAt
? await this.namedEvent(orgId, origin.eventId)
: (await this.requestedEvent(orgId, origin.userId, origin.eventId, capturedAt)) ??
(await this.routeToEvent(orgId, origin.userId, capturedAt));
const storageKey = storage.originalKey(orgId, sha256, ext === ".jpeg" ? ".jpg" : ext);
const size = (await stat(file)).size;
await storage.adopt(file, storageKey);
@@ -407,8 +410,9 @@ export class IngestService {
/**
* The event this photo belongs to: one the photographer is assigned to (or an event with no assignments,
* open to everyone) whose ingest window contains the capture time, without a >1 h shooting gap. The
* latest-starting one that still fits wins.
* open to everyone) whose ingest window contains the capture time, without a >1 h shooting gap. When two
* windows overlap (studio at 14:00 and training at 16:30), the start closest to the capture wins — not the
* latest event on the calendar.
*/
async routeToEvent(organizationId: string, userId: string, at: Date): Promise<string | null> {
const events = await this.deps.db.event.findMany({
@@ -419,10 +423,10 @@ export class IngestService {
ingestUntil: { gte: at },
OR: [{ assignments: { some: { userId } } }, { assignments: { none: {} } }],
},
orderBy: { startsAt: "desc" },
take: 20,
select: { id: true },
select: { id: true, startsAt: true },
});
events.sort((a, b) => Math.abs(a.startsAt.getTime() - at.getTime()) - Math.abs(b.startsAt.getTime() - at.getTime()));
for (const event of events) {
if (await this.sameSession(event.id, userId, at)) return event.id;
}
+27 -4
View File
@@ -25,11 +25,13 @@ export async function joinedEvent(db: Db, eventId: string, ids: string[]): Promi
/**
* Photos waiting in "Sem evento" taken during this event's ingest window (by the photographers it is assigned to,
* or anyone when it has none): photos sent before the event was created, or before its times were corrected.
* When another open event's window also covers the capture and starts closer to it, leave the photo in the inbox
* (or for that other event) — otherwise creating a 16:30 training steals a 14:00 studio card from the overlap.
*/
export async function claimInbox(db: Db, eventId: string): Promise<string[]> {
const event = await db.event.findUnique({
where: { id: eventId },
select: { organizationId: true, archivedAt: true, ingestFrom: true, ingestUntil: true, assignments: { select: { userId: true } } },
select: { organizationId: true, archivedAt: true, ingestFrom: true, ingestUntil: true, startsAt: true, assignments: { select: { userId: true } } },
});
if (!event || event.archivedAt) return [];
const photos = await db.photo.findMany({
@@ -39,14 +41,35 @@ export async function claimInbox(db: Db, eventId: string): Promise<string[]> {
capturedAt: { gte: event.ingestFrom, lte: event.ingestUntil },
...(event.assignments.length && { uploaderId: { in: event.assignments.map((a) => a.userId) } }),
},
select: { id: true },
select: { id: true, capturedAt: true },
take: 20_000,
});
const ids = photos.map((p) => p.id);
if (!photos.length) return [];
const rivals = await db.event.findMany({
where: {
organizationId: event.organizationId,
archivedAt: null,
id: { not: eventId },
ingestFrom: { lte: event.ingestUntil },
ingestUntil: { gte: event.ingestFrom },
},
select: { id: true, startsAt: true, ingestFrom: true, ingestUntil: true },
});
const ids = photos
.filter((p) => {
if (!p.capturedAt) return true;
const t = p.capturedAt.getTime();
const better = rivals.some((r) => {
if (t < r.ingestFrom.getTime() || t > r.ingestUntil.getTime()) return false;
return Math.abs(r.startsAt.getTime() - t) < Math.abs(event.startsAt.getTime() - t);
});
return !better;
})
.map((p) => p.id);
if (!ids.length) return [];
// Only the ones still in the inbox (another event may have claimed some meanwhile).
await db.photo.updateMany({ where: { id: { in: ids }, eventId: null }, data: { eventId } });
const claimed = (await db.photo.findMany({ where: { id: { in: ids }, eventId }, select: { id: true } })).map((p) => p.id);
await joinedEvent(db, eventId, claimed);
return claimed;
}
}
+41 -4
View File
@@ -160,10 +160,10 @@ describe("library", () => {
expect(forged.statusCode).toBe(404);
});
it("sends a login's photos to the event chosen by hand, whatever the camera's clock, until switched off", async () => {
it("FTP pin keeps shots inside its window; shots from another event's time still follow the clock", async () => {
const { orgId, admin, foto, other, event } = await setup();
const until = new Date(Date.now() + 3600_000).toISOString();
const press = (await ctx.app.inject({ method: "POST", url: `/v1/orgs/${orgId}/events`, headers: bearer(admin), payload: { home: "Conferência de imprensa", startsAt: new Date().toISOString(), photographerIds: [] } })).json() as { id: string };
const press = (await ctx.app.inject({ method: "POST", url: `/v1/orgs/${orgId}/events`, headers: bearer(admin), payload: { home: "Conferência de imprensa", startsAt: "2026-10-14T10:00:00Z", photographerIds: [] } })).json() as { id: string };
await ctx.app.inject({ method: "POST", url: `/v1/orgs/${orgId}/ftp-accounts`, headers: bearer(admin), payload: { userId: other.id, login: "outro.r1" } });
// The photographer sees only their own login; the editor sees all.
let res = await ctx.app.inject({ method: "GET", url: `/v1/events/${event.id}/ftp-target`, headers: bearer(foto) });
@@ -178,8 +178,10 @@ describe("library", () => {
res = await ctx.app.inject({ method: "PUT", url: `/v1/events/${press.id}/ftp-target`, headers: bearer(admin), payload: { accountIds: [mine[0]!.id], until } });
expect(res.json()).toMatchObject({ ftpTargets: [{ login: "foto.r1", until }] });
expect(((await ctx.app.inject({ method: "GET", url: `/v1/events/${event.id}/ftp-target`, headers: bearer(foto) })).json() as { accounts: { elsewhere: { id: string } | null }[] }).accounts[0]!.elsewhere).toMatchObject({ id: press.id });
// Taken during the game, but sent while the login points at the press conference: it goes there.
expect(await service.ingestFile(await drop("foto.r1", "a.jpg", await jpeg({ color: "#123456" })))).toMatchObject({ status: "ingested", eventId: press.id });
// Taken during the press (pin window): press gets it.
expect(await service.ingestFile(await drop("foto.r1", "a.jpg", await jpeg({ color: "#123456", taken: "2026:10:14 10:15:00" })))).toMatchObject({ status: "ingested", eventId: press.id });
// Taken during the game, pin still on press: clock wins — pin must not swallow another session.
expect(await service.ingestFile(await drop("foto.r1", "game.jpg", await jpeg({ color: "#abcdef" })))).toMatchObject({ status: "ingested", eventId: event.id });
// Switched off: by the time again.
await ctx.app.inject({ method: "PUT", url: `/v1/events/${press.id}/ftp-target`, headers: bearer(admin), payload: { accountIds: [] } });
@@ -189,6 +191,41 @@ describe("library", () => {
expect(await service.ingestFile(await drop("foto.r1", "c.jpg", await jpeg({ color: "#665544" })))).toMatchObject({ status: "ingested", eventId: event.id });
});
it("when two ingest windows overlap, files the photo in the event whose start is closest to the capture", async () => {
const { orgId, admin, photographer } = await setup();
const miguel = (
await ctx.app.inject({
method: "POST",
url: `/v1/orgs/${orgId}/events`,
headers: bearer(admin),
payload: { home: "Miguel em estúdio", startsAt: "2026-11-03T14:00:00Z", photographerIds: [photographer.id] },
})
).json() as { id: string };
const sub21 = (
await ctx.app.inject({
method: "POST",
url: `/v1/orgs/${orgId}/events`,
headers: bearer(admin),
payload: { home: "Treino Sub-21", startsAt: "2026-11-03T16:30:00Z", photographerIds: [photographer.id] },
})
).json() as { id: string };
// Widen windows so they overlap (default is −2h/+4h: Miguel until 18:00, Sub-21 from 14:30).
await ctx.db.event.update({ where: { id: miguel.id }, data: { ingestFrom: new Date("2026-11-03T12:00:00Z"), ingestUntil: new Date("2026-11-03T18:00:00Z") } });
await ctx.db.event.update({ where: { id: sub21.id }, data: { ingestFrom: new Date("2026-11-03T14:30:00Z"), ingestUntil: new Date("2026-11-03T20:30:00Z") } });
const send = async (name: string, taken: string, pin?: string) => {
const file = path.join(dir, name);
await writeFile(file, await jpeg({ color: "#778899", taken }));
return service.ingest(file, { organizationId: orgId, userId: photographer.id, source: "DESKTOP", originalName: name, eventId: pin });
};
// 14:20: only Miguel — Sub-21 pin must not take it.
expect(await send("studio.jpg", "2026:11:03 14:20:00", sub21.id)).toMatchObject({ status: "ingested", eventId: miguel.id });
// 15:00 overlap, no pin: closest start is Miguel.
expect(await send("overlap.jpg", "2026:11:03 15:00:00")).toMatchObject({ status: "ingested", eventId: miguel.id });
// 16:40: Sub-21.
expect(await send("treino.jpg", "2026:11:03 16:40:00")).toMatchObject({ status: "ingested", eventId: sub21.id });
});
it("a pin left on a game already put away does not take photos shot for the next event", async () => {
const { orgId, admin, photographer, event } = await setup();
await ctx.db.event.update({ where: { id: event.id }, data: { archivedAt: new Date("2026-10-19T10:40:00Z") } });
+29 -4
View File
@@ -108,6 +108,11 @@ interface ViewerProps {
/** Eyedropper on: a click reports where (0..1 in the shown frame). */
picking?: boolean;
onPick?: (u: number, v: number) => void;
/** Remove / heal tool: a click reports where (0..1 in the shown frame). */
spotting?: boolean;
onSpot?: (u: number, v: number) => void;
/** Spot pins to draw over the loupe (normalized in the shown / cropped frame). */
spotMarks?: { u: number; v: number; size: number }[];
}
/**
@@ -224,7 +229,7 @@ export function Viewer(props: ViewerProps) {
// 1:1: click and drag moves the photo (the hand tool), like Lightroom.
const pan = useRef<{ x: number; y: number; left: number; top: number; id: number } | null>(null);
const panning = !!props.actualPixels && !props.picking && !cropping;
const panning = !!props.actualPixels && !props.picking && !props.spotting && !cropping;
const panHandlers = panning
? {
onPointerDown: (e: React.PointerEvent<HTMLDivElement>) => {
@@ -265,14 +270,34 @@ export function Viewer(props: ViewerProps) {
// While cropping the photo turns under an upright crop, as in Lightroom: the engine renders it unturned
// (the whole frame), and the straighten angle is shown here so a drag follows the pointer at once.
style={cropping && props.crop.angle ? { transform: `rotate(${props.crop.angle}deg)` } : undefined}
className={`block h-full w-full shadow-[0_2px_12px_rgba(0,0,0,0.7)] ${props.picking ? "cursor-crosshair" : ""}`}
className={`block h-full w-full shadow-[0_2px_12px_rgba(0,0,0,0.7)] ${props.picking || props.spotting ? "cursor-crosshair" : ""}`}
aria-label="Foto em revelação"
onClick={(e) => {
if (!props.picking) return;
if (!props.picking && !props.spotting) return;
const r = e.currentTarget.getBoundingClientRect();
callbacks.current.onPick?.((e.clientX - r.left) / r.width, (e.clientY - r.top) / r.height);
const u = (e.clientX - r.left) / r.width;
const v = (e.clientY - r.top) / r.height;
if (props.picking) callbacks.current.onPick?.(u, v);
else callbacks.current.onSpot?.(u, v);
}}
/>
{props.spotMarks && props.spotMarks.length > 0 && (
<div className="pointer-events-none absolute inset-0" aria-hidden="true">
{props.spotMarks.map((m, i) => (
<span
key={i}
className="absolute rounded-full border border-white/90 bg-black/30"
style={{
left: `${m.u * 100}%`,
top: `${m.v * 100}%`,
width: `${Math.max(8, m.size * 100)}%`,
height: `${Math.max(8, m.size * 100)}%`,
transform: "translate(-50%, -50%)",
}}
/>
))}
</div>
)}
{cropping && frame && (
<CropFrame
crop={props.crop}
+21
View File
@@ -0,0 +1,21 @@
import { describe, expect, it } from "vitest";
import { addSpot, removeSpotAt, spotsOf, spotsPartial } from "./spots.js";
describe("spots", () => {
it("adds a fill spot and round-trips through merge partial", () => {
const settings = "{}";
const next = addSpot(settings, { mode: "fill", x: 0.4, y: 0.6, size: 0.03, feather: 40, opacity: 100 });
expect(next).toHaveLength(1);
expect(next[0]?.mode).toBe("fill");
expect(next[0]?.points[0]).toEqual({ x: 0.4, y: 0.6 });
const merged = JSON.stringify({ ...JSON.parse(settings), ...spotsPartial(next) });
expect(spotsOf(merged)).toEqual(next);
});
it("removes by index", () => {
let spots = addSpot("{}", { mode: "remove", x: 0.1, y: 0.1, size: 0.02, feather: 50, opacity: 100 });
spots = addSpot(JSON.stringify({ spots }), { mode: "heal", x: 0.2, y: 0.2, size: 0.02, feather: 50, opacity: 100 });
expect(removeSpotAt(JSON.stringify({ spots }), 0)).toHaveLength(1);
expect(removeSpotAt(JSON.stringify({ spots }), 0)[0]?.mode).toBe("heal");
});
});
+78
View File
@@ -0,0 +1,78 @@
/** Spot / heal / clone / content-aware fill — LightCraft `DevelopSettings.spots` (snake_case JSON). */
export type SpotMode = "remove" | "heal" | "clone" | "fill";
export interface SpotPoint {
x: number;
y: number;
}
export interface Spot {
mode: SpotMode;
points: SpotPoint[];
/** Radius as a fraction of the long edge (LightCraft default ~0.02). */
size: number;
feather: number;
opacity: number;
source_offset?: SpotPoint | null;
}
export const SPOT_MODES: { id: SpotMode; labelKey: "spotRemove" | "spotHeal" | "spotClone" | "spotFill" }[] = [
{ id: "remove", labelKey: "spotRemove" },
{ id: "heal", labelKey: "spotHeal" },
{ id: "clone", labelKey: "spotClone" },
{ id: "fill", labelKey: "spotFill" },
];
export const DEFAULT_SPOT_SIZE = 0.025;
export const DEFAULT_SPOT_FEATHER = 50;
export const DEFAULT_SPOT_OPACITY = 100;
export function spotsOf(settings: string): Spot[] {
try {
const s = JSON.parse(settings) as { spots?: Spot[] };
return Array.isArray(s.spots) ? s.spots : [];
} catch {
return [];
}
}
/** Partial for `develop.merge`: replace the spots list. */
export function spotsPartial(spots: Spot[]): Record<string, unknown> {
return { spots };
}
export function addSpot(
settings: string,
spot: {
mode: SpotMode;
x: number;
y: number;
size: number;
feather: number;
opacity: number;
sourceOffset?: SpotPoint | null;
},
): Spot[] {
const next: Spot = {
mode: spot.mode,
points: [{ x: clamp01(spot.x), y: clamp01(spot.y) }],
size: clamp(spot.size, 0.002, 0.25),
feather: clamp(spot.feather, 0, 100),
opacity: clamp(spot.opacity, 0, 100),
source_offset: spot.sourceOffset ?? null,
};
return [...spotsOf(settings), next];
}
export function removeSpotAt(settings: string, index: number): Spot[] {
return spotsOf(settings).filter((_, i) => i !== index);
}
function clamp01(v: number): number {
return Math.min(1, Math.max(0, v));
}
function clamp(v: number, lo: number, hi: number): number {
return Math.min(hi, Math.max(lo, v));
}
+15 -1
View File
@@ -423,6 +423,7 @@ export const t = {
},
uploading: (done: number, total: number) => `A enviar ${done} de ${total}`,
uploaded: (n: number) => (n === 1 ? "1 foto enviada" : `${n} fotos enviadas`),
sendingOriginals: (n: number) => (n === 1 ? "A enviar 1 original desta máquina" : `A enviar ${n} originais desta máquina`),
uploadFailed: (n: number) => `${n} com erro`,
dismiss: "Fechar",
useEmbeddedTitle: "Usar o Title como jogadores",
@@ -605,6 +606,7 @@ export const t = {
copied: "Copiado",
deliveryErrors: {
waiting_for_original: "À espera do original (está no computador do fotógrafo; abre a app PhotoReport nesse computador)",
waiting_for_original_here: "A pedir o original desta máquina…",
original_not_here: "O original nunca chegou do computador do fotógrafo",
},
deliveryStatus: { QUEUED: "Na fila", RUNNING: "A enviar", WAITING: "À espera do computador", DONE: "Entregue", FAILED: "Falhou", RETRACTED: "Retirada" },
@@ -1243,6 +1245,18 @@ export const t = {
saved: "Guardado",
crop: "Recortar",
cropDone: "Concluir",
spot: "Apagar",
spotDone: "Concluir",
spotHelp: "Clica na zona a limpar (softbox, cabo, pó). Q liga a ferramenta.",
spotNow: "Clica na foto onde queres apagar. Esc cancela.",
spotRemove: "Remover",
spotHeal: "Corrigir",
spotClone: "Clonar",
spotFill: "Preencher",
spotSize: "Tamanho",
spotFeather: "Suavizar",
spotOpacity: "Opacidade",
spotDelete: "Tirar",
aspect: "Proporção",
aspectFree: "Livre",
aspectOriginal: "Original",
@@ -1276,7 +1290,7 @@ export const t = {
syncApply: "Aplicar",
synced: (n: number) => `Ajustes sincronizados em ${n} ${n === 1 ? "foto" : "fotos"}`,
noAccess: "Só podes revelar fotos que enviaste.",
shortcuts: "← → foto · Ctrl/Cmd+A todas · P escolher · X rejeitar · U limpar · 0–5 estrelas · 6–9 cor · G grelha · I informação · Shift+A automático · \\ antes/depois · R recortar · W conta-gotas · Z 1:1 (arrastar move) · E lupa · Ctrl+Alt+1 biblioteca · Ctrl+Z anular",
shortcuts: "← → foto · Ctrl/Cmd+A todas · P escolher · X rejeitar · U limpar · 0–5 estrelas · 6–9 cor · G grelha · I informação · Shift+A automático · \\ antes/depois · R recortar · Q apagar · W conta-gotas · Z 1:1 (arrastar move) · E lupa · Ctrl+Alt+1 biblioteca · Ctrl+Z anular",
groups: { wb: "Equilíbrio de brancos", tone: "Tom", presence: "Presença", profile: "Perfil" },
labels: {
"profile.amount": "Intensidade",
+1
View File
@@ -81,6 +81,7 @@ describe("local FTP feed", () => {
// Each shows as soon as it arrives. The one the server has leaves; the failed one stays so it can be edited.
await waitFor(() => expect(localPhotos.list().map((p) => p.name)).toEqual(["B.JPG"]));
// Working locally (the default): previews go up, each with the fingerprint of its original.
// Stub previews have no EXIF: the open pin still names the event (same as the server).
expect(added).toEqual([
{ name: "A.JPG", eventId: "ev1", size: "preview of /x/FTP/A.JPG".length, sha: "sha-/x/FTP/A.JPG" },
{ name: "B.JPG", eventId: "ev1", size: "preview of /x/FTP/B.JPG".length, sha: "sha-/x/FTP/B.JPG" },
+3 -4
View File
@@ -62,7 +62,7 @@ const IN_FLIGHT = 6;
* Full originals are read through the webview as well. Several at once freeze it, a chunk sits until the access
* token expires, and the server answers 401. Two leaves room for the upload to leave.
*/
const IN_FLIGHT_ORIGINALS = 2;
const IN_FLIGHT_ORIGINALS = 3;
/**
* Originals on the wire at once. One waits out each detection and each server reply, so a full card sits in
* ingest while the link is idle. This matches the upload queue. The slot stays held until that file has left,
@@ -165,9 +165,8 @@ export function useLocalFtp(add: Add, enabled: boolean, invoke: Invoke = tauriIn
const cached = orgId ? await cache.events(orgId) : null;
const events = cached?.events ?? [];
const capturedAt = lisbonInstant(exifDateTime(preview));
// A pin on a game already put away, or left over from the previous match, does not take the next photos.
const pinnedId = to && (!cached || events.some((e) => e.id === to.id && !e.archivedAt)) ? to.id : null;
const eventId = eventForArrival(pinnedId, events, capturedAt);
// Open FTP target always; eventForArrival drops an archived leftover and keeps shots inside the window.
const eventId = eventForArrival(to?.id ?? null, events, capturedAt);
const filed = events.find((e) => e.id === eventId);
if (!localPhotos.bySha(info.sha256)) {
let url = "";
+53
View File
@@ -0,0 +1,53 @@
import { useSyncExternalStore } from "react";
import { t } from "../i18n.js";
import { useIngest } from "./ingest.js";
/**
* Thin transfer strip (Photo Mechanic–style): always at the bottom of the workspace while JPEGs or
* originals are leaving this computer — not only on the library page.
*/
export function TransferBar() {
const { uploads, originals } = useIngest();
const originalFlight = useSyncExternalStore(
(fn) => originals?.subscribe(fn) ?? (() => {}),
() => originals?.inFlight.size ?? 0,
() => 0,
);
const sending = uploads.items.filter((i) => i.status === "queued" || i.status === "uploading");
const failed = uploads.items.filter((i) => i.status === "failed");
const sentCount = uploads.items.filter((i) => i.status === "done" || i.status === "duplicate").length;
const overall = uploads.items.length ? uploads.items.reduce((sum, i) => sum + (i.status === "failed" ? 1 : i.progress), 0) / uploads.items.length : 0;
const busy = sending.length > 0 || originalFlight > 0;
if (!busy && uploads.items.length === 0) return null;
const label = (() => {
if (sending.length) return t.uploading(sentCount, uploads.items.length);
if (originalFlight > 0) return t.sendingOriginals(originalFlight);
return t.uploaded(sentCount);
})();
const pct = sending.length || uploads.items.length ? Math.round(overall * 100) : originalFlight > 0 ? 50 : 100;
return (
<div className="flex shrink-0 flex-wrap items-center gap-3 border-t border-line bg-panel px-3 py-1 text-[11px]" role="status" aria-live="polite">
<span className="font-mono text-faint">
{label}
{failed.length > 0 && <span className="text-[#f0a35a]"> · {t.uploadFailed(failed.length)}</span>}
{originalFlight > 0 && sending.length > 0 && <span className="text-faint"> · {t.sendingOriginals(originalFlight)}</span>}
</span>
<span className="h-1 min-w-[7rem] flex-1 bg-black" role="progressbar" aria-valuenow={pct} aria-valuemin={0} aria-valuemax={100}>
<span className={`block h-full bg-accent transition-[width] ${originalFlight > 0 && !sending.length ? "animate-pulse" : ""}`} style={{ width: `${pct}%` }} />
</span>
{failed.length > 0 && (
<span className="max-w-[14rem] truncate text-faint" title={failed.map((f) => `${f.name}: ${f.error}`).join("\n")}>
{failed[0]?.name}: {failed[0]?.error}
</span>
)}
{!sending.length && uploads.items.length > 0 && (
<button type="button" onClick={uploads.clear} className="text-faint underline hover:text-muted">
{t.dismiss}
</button>
)}
</div>
);
}
+1
View File
@@ -63,6 +63,7 @@ describe("usb tether", () => {
}
};
renderHook(() => useUsbCamera(add, true, { id: "ev1", title: "Portugal x Suíça", date: "2026-11-04" }, invoke));
// Preview has no EXIF: keep the open pin (auto-pull already used the card clock for the window).
await waitFor(() => expect(added).toEqual([{ name: "IMG_0001.JPG", eventId: "ev1" }]));
await waitFor(() => expect(sent).toEqual([{ path: "/ingest/.usb/IMG_0001.JPG", event: "Portugal x Suíça", date: "2026-11-04" }]));
});
+17 -3
View File
@@ -1,6 +1,8 @@
import type { EventSummary } from "@photoreport/sdk";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { t } from "../i18n.js";
import { cache } from "../offline/cache.js";
import { eventForArrival, exifDateTime, lisbonInstant } from "../offline/local.js";
import { asArrayBuffer, prefs } from "../platform.js";
import { type FtpTarget, type IncomingFile, type Invoke, eventLabel } from "./LocalFtp.js";
import type { PreviewOf, UploadStatus } from "./uploads.js";
@@ -54,7 +56,7 @@ function savedTetherOn(): boolean {
return prefs.get("usb.tether") === "1";
}
export function useUsbCamera(add: Add, enabled: boolean, target: FtpTarget | null, invoke: Invoke = tauriInvoke) {
export function useUsbCamera(add: Add, enabled: boolean, target: FtpTarget | null, invoke: Invoke = tauriInvoke, orgId = "") {
const [status, setStatus] = useState<UsbStatus | null>(null);
const [outdated, setOutdated] = useState(false);
const [counts, setCounts] = useState({ received: 0, sent: 0, failed: 0 });
@@ -68,6 +70,8 @@ export function useUsbCamera(add: Add, enabled: boolean, target: FtpTarget | nul
const tetherRestored = useRef(false);
const targetRef = useRef(target);
targetRef.current = target;
const orgIdRef = useRef(orgId);
orgIdRef.current = orgId;
const autoIngestRef = useRef(autoIngest);
autoIngestRef.current = autoIngest;
@@ -94,11 +98,21 @@ export function useUsbCamera(add: Add, enabled: boolean, target: FtpTarget | nul
invoke<PreviewOf>("ftp_info", { path: f.path }),
]);
const file = new File([bytes], f.name, { type: "image/jpeg", lastModified: f.modifiedMs });
add([file], to?.id, (_file, result) => {
const cached = orgIdRef.current ? await cache.events(orgIdRef.current) : null;
const events = cached?.events ?? [];
const capturedAt = lisbonInstant(exifDateTime(bytes));
// Always the open USB target — never drop a live pull into Sem evento because the agenda cache is stale.
const eventId = eventForArrival(to?.id ?? null, events, capturedAt);
const filed = events.find((e) => e.id === eventId);
add([file], eventId ?? undefined, (_file, result) => {
inFlight.current--;
if (result === "done" || result === "duplicate") {
setCounts((c) => ({ ...c, sent: c.sent + 1 }));
invoke("ftp_sent", { path: f.path, event: to?.title ?? "", date: to?.date ?? "" }).catch(() => {});
invoke("ftp_sent", {
path: f.path,
event: filed ? eventLabel(filed) : (to?.title ?? ""),
date: filed ? filed.startsAt.slice(0, 10) : (to?.date ?? ""),
}).catch(() => {});
} else {
setCounts((c) => ({ ...c, failed: c.failed + 1 }));
}
+26 -77
View File
@@ -1,9 +1,9 @@
import type { LibraryMessage } from "@photoreport/contracts";
import type { PhotoSummary } from "@photoreport/contracts";
import { createContext, type ReactNode, useCallback, useContext, useEffect, useRef } from "react";
import { createContext, type ReactNode, useContext, useEffect, useMemo } from "react";
import { useAuth } from "../auth.js";
import { isDesktop, localOriginal, localOriginalChanged } from "../platform.js";
import { isDesktop, localOriginal } from "../platform.js";
import { useLocalFtp } from "./LocalFtp.js";
import { OriginalSender } from "./originals.js";
import { useLibraryLive } from "./realtime.js";
import { useUploadQueue } from "./uploads.js";
import { useOfflineSync } from "../offline/sync.js";
@@ -14,6 +14,8 @@ type Ingest = {
localFtp: ReturnType<typeof useLocalFtp>;
usb: ReturnType<typeof useUsbCamera>;
desktop: boolean;
/** Desktop only: pushes full originals for delivery / 100% zoom, off the JPEG upload queue. */
originals: OriginalSender | null;
};
const IngestContext = createContext<Ingest | null>(null);
@@ -35,90 +37,37 @@ function IngestState({ api, orgId, children }: { api: ReturnType<typeof useAuth>
const desktop = isDesktop();
const uploads = useUploadQueue(api, orgId);
const localFtp = useLocalFtp(uploads.add, desktop && !!orgId, undefined, orgId);
const usb = useUsbCamera(uploads.add, desktop && !!orgId, localFtp.target);
const usb = useUsbCamera(uploads.add, desktop && !!orgId, localFtp.target, undefined, orgId);
const originals = useMemo(() => (desktop && orgId ? new OriginalSender(api) : null), [api, desktop, orgId]);
useOfflineSync(api, orgId);
return (
<IngestContext.Provider value={{ uploads, localFtp, usb, desktop }}>
{desktop && !!orgId && <OriginalResponder api={api} add={uploads.add} />}
<IngestContext.Provider value={{ uploads, localFtp, usb, desktop, originals }}>
{desktop && !!orgId && originals && <OriginalResponder api={api} orgId={orgId} sender={originals} />}
{desktop && !!orgId && <FailedRepair api={api} orgId={orgId} add={uploads.add} />}
{children}
</IngestContext.Provider>
);
}
/** Several megabytes through IPC. Dozens at once freeze the webview on "A enviar…" and the send never finishes. */
const ORIGINAL_IPC_MS = 45_000;
/** A few at a time: one is slow, all of them freeze the bar. */
const MAX_PARALLEL_ORIGINALS = 3;
function withTimeout<T>(work: Promise<T>, ms: number): Promise<T | "timeout" | null> {
return new Promise((resolve) => {
let settled = false;
const finish = (value: T | "timeout" | null) => {
if (settled) return;
settled = true;
clearTimeout(timer);
resolve(value);
};
const timer = setTimeout(() => finish("timeout"), ms);
work.then(
(value) => finish(value),
() => finish(null),
);
});
}
/**
* Desktop app: when someone needs the full original of a photo this computer keeps (100% zoom on the web, an export
* made on the server, delivery to ZeroZero), the server asks over the live channel and this sends it.
* Up to three at a time, so the webview stays responsive and the next ask can run.
* Desktop: when delivery (or 100% zoom) needs a full original kept here, send it on its own track — never
* through the JPEG upload queue, so new shots keep leaving and one stuck file does not block the rest.
*/
function OriginalResponder({ api, add }: { api: ReturnType<typeof useAuth>["api"]; add: ReturnType<typeof useUploadQueue>["add"] }) {
const sending = useRef(new Set<string>());
const queue = useRef<{ sha256: string; photoId: string }[]>([]);
const active = useRef(0);
const pump = useCallback(() => {
while (active.current < MAX_PARALLEL_ORIGINALS) {
const next = queue.current.shift();
if (!next) return;
active.current += 1;
const release = () => {
sending.current.delete(next.sha256);
active.current -= 1;
pump();
};
void (async () => {
const bytes = await withTimeout(localOriginal(next.sha256), ORIGINAL_IPC_MS);
if (bytes && bytes !== "timeout") {
add([new File([bytes], `${next.sha256}.jpg`, { type: "image/jpeg" })], undefined, () => release());
return;
}
if (bytes !== "timeout") {
// The file is still here but changed since it arrived (Photo Mechanic wrote captions into it): sent as this
// photo's original, which the server checks is the same photo.
try {
const changed = await withTimeout(localOriginalChanged(next.sha256), ORIGINAL_IPC_MS);
if (changed && changed !== "timeout") await api.sendOriginal(next.photoId, new Blob([changed], { type: "image/jpeg" }), `${next.sha256}.jpg`);
} catch {
/* not the same photo, or offline: asked again later */
}
}
release();
})();
}
}, [add, api]);
const onMessage = useCallback(
(m: LibraryMessage) => {
if (m.type !== "original.requested" || sending.current.has(m.sha256)) return;
sending.current.add(m.sha256);
queue.current.push({ sha256: m.sha256, photoId: m.photoId });
pump();
},
[pump],
);
useLibraryLive(api, onMessage);
function OriginalResponder({
api,
orgId,
sender,
}: {
api: ReturnType<typeof useAuth>["api"];
orgId: string;
sender: OriginalSender;
}) {
useLibraryLive(api, (m) => sender.onMessage(m));
useEffect(() => {
void sender.flushWaiting(orgId);
const timer = setInterval(() => void sender.flushWaiting(orgId), 45_000);
return () => clearInterval(timer);
}, [sender, orgId]);
return null;
}
+33
View File
@@ -0,0 +1,33 @@
import { describe, expect, it, vi } from "vitest";
import { localPhotos } from "../offline/local.js";
import { showLocalJpeg } from "./localIngest.js";
describe("showLocalJpeg", () => {
it("puts a desktop preview into the library before upload", async () => {
for (const p of localPhotos.list()) localPhotos.remove(p.id);
const bytes = new Uint8Array([0xff, 0xd8, 0xff, 0xd9]);
const file = new File([bytes], "IMG_1.JPG", { type: "image/jpeg" });
// createImageBitmap may be missing in jsdom — stub size via origin.
const sha = await showLocalJpeg({
file,
eventId: "ev1",
origin: { sha256: "abc123", size: 4, width: 100, height: 80 },
});
expect(sha?.sha256).toBe("abc123");
expect(localPhotos.bySha("abc123")?.eventId).toBe("ev1");
expect(localPhotos.bySha("abc123")?.originalName).toBe("IMG_1.JPG");
for (const p of localPhotos.list()) localPhotos.remove(p.id);
});
it("skips a second put for the same sha", async () => {
for (const p of localPhotos.list()) localPhotos.remove(p.id);
const file = new File([new Uint8Array([1, 2, 3])], "A.JPG", { type: "image/jpeg" });
const origin = { sha256: "same", size: 3, width: 10, height: 10 };
await showLocalJpeg({ file, origin });
const spy = vi.spyOn(localPhotos, "put");
await showLocalJpeg({ file, origin });
expect(spy).not.toHaveBeenCalled();
spy.mockRestore();
for (const p of localPhotos.list()) localPhotos.remove(p.id);
});
});
+106
View File
@@ -0,0 +1,106 @@
import type { PhotoSummary } from "@photoreport/contracts";
import type { EventSummary } from "@photoreport/sdk";
import { eventForArrival, exifDateTime, lisbonInstant, localPhoto, localPhotos } from "../offline/local.js";
import { localId, offlineQueue } from "../offline/queue.js";
import type { DesktopOrigin } from "./uploads.js";
/** SHA-256 hex of the bytes (same fingerprint the desktop shell uses for the original). */
export async function sha256Hex(bytes: ArrayBuffer): Promise<string> {
const hash = await crypto.subtle.digest("SHA-256", bytes);
return [...new Uint8Array(hash)].map((b) => b.toString(16).padStart(2, "0")).join("");
}
async function imageSize(blob: Blob): Promise<{ width: number; height: number }> {
if (typeof createImageBitmap === "function") {
const bmp = await createImageBitmap(blob);
const size = { width: bmp.width, height: bmp.height };
bmp.close();
return size;
}
return await new Promise((resolve, reject) => {
const img = new Image();
const url = URL.createObjectURL(blob);
img.onload = () => {
resolve({ width: img.naturalWidth, height: img.naturalHeight });
URL.revokeObjectURL(url);
};
img.onerror = () => {
URL.revokeObjectURL(url);
reject(new Error("decode"));
};
img.src = url;
});
}
/**
* Puts a JPEG into the library at once from bytes already on this computer. Upload can finish later;
* `photo.added` (same sha) replaces this row. Returns the sha (and the event chosen from EXIF) when on screen.
*/
export async function showLocalJpeg(args: {
file: File;
eventId?: string | undefined;
origin?: DesktopOrigin | undefined;
orgId?: string | undefined;
events?: Pick<EventSummary, "id" | "startsAt" | "ingestFrom" | "ingestUntil" | "archivedAt">[] | undefined;
}): Promise<{ sha256: string; eventId: string | null } | null> {
const { file, origin, orgId, events } = args;
try {
let sha256: string;
let width: number;
let height: number;
// Always read EXIF from the JPEG bytes when we can — desktop previews keep DateTimeOriginal, and that
// clock (not the open event pin) decides which folder the photo appears in.
const previewBytes = await file.arrayBuffer();
if (origin && origin !== "original") {
sha256 = origin.sha256;
width = origin.width;
height = origin.height;
} else {
sha256 = await sha256Hex(previewBytes);
const size = await imageSize(new Blob([previewBytes], { type: "image/jpeg" }));
width = size.width;
height = size.height;
}
if (localPhotos.bySha(sha256)) return { sha256, eventId: localPhotos.bySha(sha256)?.eventId ?? null };
let url = "";
try {
url = URL.createObjectURL(new Blob([previewBytes], { type: "image/jpeg" }));
} catch {
try {
url = URL.createObjectURL(file);
} catch {
/* tests / no blob URLs */
}
}
const capturedAt = lisbonInstant(exifDateTime(previewBytes));
const eventId = events ? eventForArrival(args.eventId ?? null, events, capturedAt) : (args.eventId ?? null);
localPhotos.put(
localPhoto({
sha256,
name: file.name,
width,
height,
capturedAt,
eventId,
url,
}),
);
if (orgId) {
for (const op of offlineQueue(orgId).pending) {
if (op.kind === "patch" && op.ids.includes(localId(sha256))) {
localPhotos.patch(localId(sha256), op.patch as Partial<PhotoSummary>);
}
}
}
return { sha256, eventId };
} catch {
return null;
}
}
/** After the server has the photo: map offline edits and drop the local stand-in. */
export function settleLocalUpload(orgId: string, sha256: string | null | undefined, photo: PhotoSummary | undefined): void {
if (!sha256) return;
if (photo) offlineQueue(orgId).uploaded(sha256, photo.id);
localPhotos.remove(localId(sha256));
}
+42
View File
@@ -0,0 +1,42 @@
import { describe, expect, it, vi } from "vitest";
import { OriginalSender } from "./originals.js";
describe("OriginalSender", () => {
it("does not put the same sha on the queue twice", () => {
const api = {
sendOriginal: vi.fn(async () => ({ stored: true })),
requestOriginal: vi.fn(async () => ({ stored: false })),
listDeliveries: vi.fn(async () => ({ items: [] })),
};
const sender = new OriginalSender(api as never);
sender.enqueue({ photoId: "p1", sha256: "abc" });
sender.enqueue({ photoId: "p1", sha256: "abc" });
expect(sender.inFlight.size).toBeLessThanOrEqual(1);
});
it("asks the server for originals when a delivery is waiting", () => {
const api = {
sendOriginal: vi.fn(async () => ({ stored: true })),
requestOriginal: vi.fn(async () => ({ stored: false })),
listDeliveries: vi.fn(async () => ({ items: [] })),
};
const sender = new OriginalSender(api as never);
sender.onMessage({
type: "delivery.updated",
item: {
id: "i1",
targetId: "t1",
photoId: "p1",
eventId: "e1",
sequence: 1,
status: "QUEUED",
attempts: 0,
lastError: "waiting_for_original",
remotePath: null,
byteSize: null,
updatedAt: "",
},
});
expect(api.requestOriginal).toHaveBeenCalledWith("p1");
});
});
+126
View File
@@ -0,0 +1,126 @@
import type { LibraryMessage } from "@photoreport/contracts";
import type { ApiClient } from "@photoreport/sdk";
import { localOriginal, localOriginalChanged, prefs } from "../platform.js";
/** Several megabytes through IPC. Dozens at once freeze the webview; one slow disk must not kill the rest. */
const ORIGINAL_IPC_MS = 90_000;
const PREF_PARALLEL = "originals.parallel";
/** How many full originals leave this computer at once (delivery / 100% zoom). Default 4, clamp 2..8. */
export function originalsParallel(): number {
const n = Number(prefs.get(PREF_PARALLEL));
if (Number.isFinite(n) && n >= 2 && n <= 8) return Math.floor(n);
return 4;
}
function withTimeout<T>(work: Promise<T>, ms: number): Promise<T | "timeout" | null> {
return new Promise((resolve) => {
let settled = false;
const finish = (value: T | "timeout" | null) => {
if (settled) return;
settled = true;
clearTimeout(timer);
resolve(value);
};
const timer = setTimeout(() => finish("timeout"), ms);
work.then(
(value) => finish(value),
() => finish(null),
);
});
}
export type OriginalNeed = { photoId: string; sha256: string };
/**
* Sends originals this computer still has, on their own path (`POST /original`), never through the JPEG
* upload queue. New shots keep uploading in parallel; one stuck original does not block the others.
*/
export class OriginalSender {
private readonly sending = new Set<string>();
private readonly queue: OriginalNeed[] = [];
private active = 0;
/** photoIds this machine is currently pushing — Destinos shows "a enviar…" instead of "abre a app". */
readonly inFlight = new Set<string>();
private readonly listeners = new Set<() => void>();
constructor(private readonly api: ApiClient) {}
subscribe(fn: () => void): () => void {
this.listeners.add(fn);
return () => this.listeners.delete(fn);
}
private changed(): void {
for (const fn of this.listeners) fn();
}
/** From the live channel, or a Destinos row that is waiting for the file on this Mac. */
enqueue(need: OriginalNeed): void {
if (this.sending.has(need.sha256)) return;
this.sending.add(need.sha256);
this.queue.push(need);
this.pump();
}
onMessage(m: LibraryMessage): void {
if (m.type === "original.requested") {
this.enqueue({ photoId: m.photoId, sha256: m.sha256 });
return;
}
// Delivery is blocked on the original we keep: push it at once (do not wait for the next 60 s ask).
if (m.type === "delivery.updated" && m.item.lastError === "waiting_for_original") {
void this.api.requestOriginal(m.item.photoId).catch(() => {});
}
}
/**
* Destinos / start: every queued row still waiting for an original — ask the server (it broadcasts sha256)
* so we send what we have without the photographer clicking Retry.
*/
async flushWaiting(orgId: string): Promise<void> {
try {
const { items } = await this.api.listDeliveries(orgId, { status: "QUEUED" });
for (const item of items) {
if (item.lastError !== "waiting_for_original") continue;
void this.api.requestOriginal(item.photoId).catch(() => {});
}
} catch {
/* offline: live channel will ask again */
}
}
private pump(): void {
const room = originalsParallel();
while (this.active < room) {
const next = this.queue.shift();
if (!next) return;
this.active += 1;
this.inFlight.add(next.photoId);
this.changed();
void this.sendOne(next).finally(() => {
this.sending.delete(next.sha256);
this.inFlight.delete(next.photoId);
this.active -= 1;
this.changed();
this.pump();
});
}
}
private async sendOne(need: OriginalNeed): Promise<void> {
const exact = await withTimeout(localOriginal(need.sha256), ORIGINAL_IPC_MS);
let bytes: ArrayBuffer | null = exact && exact !== "timeout" ? exact : null;
if (!bytes) {
const changed = await withTimeout(localOriginalChanged(need.sha256), ORIGINAL_IPC_MS);
bytes = changed && changed !== "timeout" ? changed : null;
}
if (!bytes) return;
try {
await this.api.sendOriginal(need.photoId, new Blob([bytes], { type: "image/jpeg" }), `${need.sha256}.jpg`);
} catch {
/* offline / not the same photo: server asks again */
}
}
}
+85 -18
View File
@@ -1,7 +1,10 @@
import type { PhotoSummary } from "@photoreport/contracts";
import { ApiError, type ApiClient } from "@photoreport/sdk";
import { isNetworkError } from "../offline/queue.js";
import { cache } from "../offline/cache.js";
import { isNetworkError, offlineQueue } from "../offline/queue.js";
import { useCallback, useRef, useState } from "react";
import { prefs } from "../platform.js";
import { settleLocalUpload, showLocalJpeg } from "./localIngest.js";
export type UploadStatus = "queued" | "uploading" | "done" | "duplicate" | "failed";
@@ -14,7 +17,12 @@ export interface UploadItem {
error?: string | undefined;
}
const CONCURRENCY = 4;
/** Parallel JPEG uploads. Pref `upload.concurrency` (3–8); default 4. One failure never holds the others. */
function uploadConcurrency(): number {
const n = Number(prefs.get("upload.concurrency"));
if (Number.isFinite(n) && n >= 3 && n <= 8) return Math.floor(n);
return 4;
}
const ACCEPTED = /\.jpe?g$/i;
const CHUNK = 4 * 1024 * 1024;
@@ -146,12 +154,21 @@ export async function sendResumable(
}
/**
* Parallel upload queue (4 at a time). New photos show up in the grid through the live channel, so the queue
* only tracks progress. Non-JPEG files are refused before sending.
* Parallel upload queue (4 at a time). Each JPEG is shown in the library from a local preview at once;
* the live channel replaces it when the server has the photo. Non-JPEG files are refused before sending.
*/
export function useUploadQueue(api: ApiClient, orgId: string) {
const [items, setItems] = useState<UploadItem[]>([]);
const queue = useRef<{ item: UploadItem; file: File; eventId: string | undefined; original?: DesktopOrigin; onSettled?: (status: UploadStatus, photo?: PhotoSummary) => void }[]>([]);
const queue = useRef<
{
item: UploadItem;
file: File;
eventId: string | undefined;
original?: DesktopOrigin;
sha256?: string | null;
onSettled?: (status: UploadStatus, photo?: PhotoSummary) => void;
}[]
>([]);
const running = useRef(0);
/** No network: the queue waits (nothing fails) and carries on when the connection is back. */
const paused = useRef(false);
@@ -162,28 +179,29 @@ export function useUploadQueue(api: ApiClient, orgId: string) {
}, []);
const pump = useCallback(() => {
while (!paused.current && running.current < CONCURRENCY && queue.current.length) {
while (!paused.current && running.current < uploadConcurrency() && queue.current.length) {
const next = queue.current.shift()!;
running.current++;
void (async () => {
const { item, file, eventId, original, onSettled } = next;
const { item, file, original, onSettled } = next;
let final: UploadStatus = "failed";
let filed: PhotoSummary | undefined;
let waiting = false;
update(item.id, { status: "uploading", error: undefined });
try {
let lastTick = 0;
// Read eventId/sha at send time so a late EXIF route on `next` still wins if it finished first.
const res = await sendResumable(
api,
orgId,
file,
eventId,
next.eventId,
(p) => {
const now = Date.now();
if (now - lastTick > 150 || p === 1) {
lastTick = now;
update(item.id, { progress: p });
}
const now = Date.now();
if (now - lastTick > 150 || p === 1) {
lastTick = now;
update(item.id, { progress: p });
}
},
original,
);
@@ -215,7 +233,13 @@ export function useUploadQueue(api: ApiClient, orgId: string) {
}
} else update(item.id, { status: "failed", error: (err as Error).message });
} finally {
if (!waiting) onSettled?.(final, filed);
if (!waiting) {
if (final === "done" || final === "duplicate") {
settleLocalUpload(orgId, next.sha256, filed);
void offlineQueue(orgId).flush(api);
}
onSettled?.(final, filed);
}
running.current--;
pump();
}
@@ -227,6 +251,10 @@ export function useUploadQueue(api: ApiClient, orgId: string) {
const add = useCallback(
/** `onSettled` is called once per accepted file, after it is sent (or definitely failed). */
(files: Iterable<File>, eventId?: string, onSettled?: (file: File, status: UploadStatus, photo?: PhotoSummary) => void, original?: DesktopOrigin) => {
// A previous offline pause must not leave new shots stuck on "queued" after the VPN is back.
if (paused.current) {
paused.current = false;
}
const added: UploadItem[] = [];
for (const file of files) {
const item: UploadItem = { id: crypto.randomUUID(), name: file.name, size: file.size, status: "queued", progress: 0 };
@@ -236,14 +264,53 @@ export function useUploadQueue(api: ApiClient, orgId: string) {
continue;
}
added.push(item);
queue.current.push({ item, file, eventId, ...(original && { original }), ...(onSettled && { onSettled: (status: UploadStatus, photo?: PhotoSummary) => onSettled(file, status, photo) }) });
// Preview / EXIF routing must not block the wire: a hung IndexedDB cache left the bar at "queued" forever.
// Enqueue at once with the open pin; enrich sha + routed event while the queue runs (or before the first byte).
const entry: {
item: UploadItem;
file: File;
eventId: string | undefined;
original?: DesktopOrigin;
sha256?: string | null;
onSettled?: (status: UploadStatus, photo?: PhotoSummary) => void;
} = {
item,
file,
eventId,
...(original && { original }),
sha256: null,
...(onSettled && { onSettled: (status: UploadStatus, photo?: PhotoSummary) => onSettled(file, status, photo) }),
};
queue.current.push(entry);
void (async () => {
try {
const cached = orgId
? await Promise.race([
cache.events(orgId),
new Promise<null>((resolve) => setTimeout(() => resolve(null), 800)),
])
: null;
const shown = await showLocalJpeg({
file,
eventId,
origin: original,
orgId,
events: cached?.events,
});
if (!shown) return;
entry.sha256 = shown.sha256;
// Prefer EXIF routing when it names an event; otherwise keep the open pin already on the entry.
if (shown.eventId) entry.eventId = shown.eventId;
} catch {
/* preview optional — upload already queued */
}
})();
}
setItems((list) => [...list.filter((i) => i.status !== "done" && i.status !== "duplicate"), ...added]);
setItems((list) => list.filter((i) => i.status !== "done" && i.status !== "duplicate").concat(added));
pump();
},
[pump],
[orgId, pump],
);
const clear = useCallback(() => setItems((list) => list.filter((i) => i.status === "queued" || i.status === "uploading")), []);
return { items, add, clear };
+24 -9
View File
@@ -75,29 +75,44 @@ export function lisbonInstant(exif: string | null): string | null {
type RoutedEvent = Pick<EventSummary, "id" | "ingestFrom" | "ingestUntil" | "archivedAt" | "startsAt">;
/**
* Among open events whose ingest window covers `at`, the one whose start is closest to the capture.
* "Latest start wins" wrongly pulled a 14:00 studio session into a 16:30 training when windows overlapped.
*/
export function bestEventForCapture(events: RoutedEvent[], at: string): RoutedEvent | null {
const t = Date.parse(at);
if (!Number.isFinite(t)) return null;
const open = events.filter((e) => !e.archivedAt && Date.parse(e.ingestFrom) <= t && t <= Date.parse(e.ingestUntil));
if (!open.length) return null;
open.sort((a, b) => Math.abs(Date.parse(a.startsAt) - t) - Math.abs(Date.parse(b.startsAt) - t));
return open[0] ?? null;
}
/** The event a photo taken at `at` belongs to, as the server would route it (offline guess; the server decides). */
export function routeLocally(events: RoutedEvent[], at: string | null): string | null {
if (!at) return null;
const t = Date.parse(at);
const open = events.filter((e) => !e.archivedAt && Date.parse(e.ingestFrom) <= t && t <= Date.parse(e.ingestUntil));
open.sort((a, b) => Date.parse(b.startsAt) - Date.parse(a.startsAt));
return open[0]?.id ?? null;
return bestEventForCapture(events, at)?.id ?? null;
}
/**
* Where a local-FTP photo goes. The event the photographer pinned receives it only while the capture falls in that
* event's window. Outside it (the pin left over from yesterday's match), the photo goes to the event of the time
* it was taken. A pin whose window isn't in the list, or a photo with no capture time, keeps the pin.
* Where a photo arrives on this computer. With a capture time, the pin (FTP target / open event) wins only
* inside that event's window — leftover pins from the morning studio must not swallow the afternoon training.
* Without a capture time, keep the pin (same as the server): USB auto-pull already filtered by the window via
* the card clock, and inventing "now" is what we must not do.
*/
export function eventForArrival(pinnedId: string | null, events: RoutedEvent[], at: string | null): string | null {
if (!at) return pinnedId;
if (!pinnedId) return routeLocally(events, at);
const pinned = events.find((e) => e.id === pinnedId);
if (!pinned || !at) return pinnedId;
if (!pinned) {
// Agenda cache miss: keep the open pin so USB/FTP does not dump live shots into Sem evento.
return pinnedId;
}
if (pinned.archivedAt) return routeLocally(events, at);
const t = Date.parse(at);
if (Date.parse(pinned.ingestFrom) <= t && t <= Date.parse(pinned.ingestUntil)) return pinnedId;
return routeLocally(events, at);
}
export function localPhoto(p: { sha256: string; name: string; width: number; height: number; capturedAt: string | null; eventId: string | null; url: string }): PhotoSummary {
return {
id: localId(p.sha256),
+18
View File
@@ -123,8 +123,26 @@ describe("photos arriving on this computer", () => {
// Yesterday's pin only holds photos taken inside it. The next morning goes to that morning's event.
expect(eventForArrival("braga", events, at)).toBe("braga");
expect(eventForArrival("braga", events, "2026-10-10T15:30:00Z")).toBe("other");
// No capture time: keep the pin (USB already filtered by the card clock; server keeps the named folder too).
expect(eventForArrival("braga", events, null)).toBe("braga");
expect(eventForArrival(null, events, null)).toBeNull();
// Cache miss for the pin id: keep it (do not dump into Sem evento); archived pins fall through to the clock.
expect(eventForArrival("missing", events, "2026-10-10T15:30:00Z")).toBe("missing");
expect(eventForArrival("braga", [{ ...events[0]!, archivedAt: "2026-10-10T00:00:00Z" }, events[1]!], "2026-10-10T15:30:00Z")).toBe("other");
});
it("when two ingest windows overlap, files the photo in the event whose start is closest to the capture", () => {
const events = [
{ id: "miguel", startsAt: "2026-11-03T14:00:00Z", ingestFrom: "2026-11-03T12:00:00Z", ingestUntil: "2026-11-03T18:00:00Z", archivedAt: null },
{ id: "sub21", startsAt: "2026-11-03T16:30:00Z", ingestFrom: "2026-11-03T14:30:00Z", ingestUntil: "2026-11-03T20:30:00Z", archivedAt: null },
];
// Studio at 14:20: only Miguel's window.
expect(eventForArrival("sub21", events, "2026-11-03T14:20:00Z")).toBe("miguel");
// Overlap at 15:00 with Sub-21 pinned: pin wins while capture is inside its window.
expect(eventForArrival("sub21", events, "2026-11-03T15:00:00Z")).toBe("sub21");
// Overlap without a pin: closest start (Miguel at 14:00 beats Sub-21 at 16:30 for a 15:00 capture).
expect(eventForArrival(null, events, "2026-11-03T15:00:00Z")).toBe("miguel");
expect(eventForArrival(null, events, "2026-11-03T16:40:00Z")).toBe("sub21");
});
it("show in the library at once and give way to the server's copy, keeping what was done to them", () => {
+7 -1
View File
@@ -122,7 +122,13 @@ export function DeliveryPage() {
<td className="border-b border-line px-3 py-1.5 font-mono text-[11px] text-faint">{i.sequence}</td>
<td className="border-b border-line px-3 py-1.5 font-mono text-[11px] break-all">
{i.remotePath ?? <span className="text-faint">—</span>}
{i.lastError && <span className="block text-[10px] text-[#f0a35a]">{t.deliveryErrors[i.lastError as keyof typeof t.deliveryErrors] ?? i.lastError}</span>}
{i.lastError && (
<span className="block text-[10px] text-[#f0a35a]">
{i.lastError === "waiting_for_original" && isDesktop()
? t.deliveryErrors.waiting_for_original_here
: (t.deliveryErrors[i.lastError as keyof typeof t.deliveryErrors] ?? i.lastError)}
</span>
)}
</td>
<td className={`border-b border-line px-3 py-1.5 font-mono text-[11px] ${STATUS_COLOR[i.status]}`}>
{t.deliveryStatus[i.status]}
+169 -7
View File
@@ -12,6 +12,17 @@ import { type Crop, cropOf, DevelopSession, localOutbox } from "../develop/sessi
import { SyncSettingsButton } from "../develop/SyncSettings.js";
import { commandsFrom, queueSync } from "../develop/copySettings.js";
import { clampUnit, constrainRotated, fitAspect, GUIDES, type Guide, rotateAspect } from "../develop/crop.js";
import {
addSpot,
DEFAULT_SPOT_FEATHER,
DEFAULT_SPOT_OPACITY,
DEFAULT_SPOT_SIZE,
removeSpotAt,
SPOT_MODES,
spotsOf,
spotsPartial,
type SpotMode,
} from "../develop/spots.js";
import { engineAuto, Viewer } from "../develop/Viewer.js";
import { IptcInfo } from "../library/IptcInfo.js";
import { activePhoto, savedFilter, saveFilter, setActivePhoto } from "../library/active.js";
@@ -342,12 +353,21 @@ export function DevelopPage() {
e.preventDefault();
flagCurrent(patchForKey(e.key)!);
}
else if (e.key.toLowerCase() === "r" && canEdit) setCropping((c) => !c);
else if (e.key.toLowerCase() === "w" && canEdit) setPicking((p) => !p);
else if (e.key.toLowerCase() === "z") setOneToOne((z) => !z);
else if (e.key.toLowerCase() === "r" && canEdit) {
setSpotting(false);
setCropping((c) => !c);
} else if (e.key.toLowerCase() === "q" && canEdit) {
setCropping(false);
setPicking(false);
setSpotting((s) => !s);
} else if (e.key.toLowerCase() === "w" && canEdit) {
setSpotting(false);
setPicking((p) => !p);
} else if (e.key.toLowerCase() === "z") setOneToOne((z) => !z);
else if (e.key === "Escape") {
setCropping(false);
setPicking(false);
setSpotting(false);
}
};
window.addEventListener("keydown", onKey);
@@ -356,6 +376,7 @@ export function DevelopPage() {
const settings = session?.loaded ? session.settings : null;
const crop = useMemo(() => (settings ? cropOf(settings) : { rect: { x0: 0, y0: 0, x1: 1, y1: 1 }, angle: 0, aspect: null }), [settings]);
const spots = useMemo(() => (settings ? spotsOf(settings) : []), [settings]);
const shown = settings && before && typeof engine === "object" ? engine.defaultSettings() : settings;
const setValue = useCallback(
@@ -366,9 +387,57 @@ export function DevelopPage() {
[session],
);
const [picking, setPicking] = useState(false);
const [spotting, setSpotting] = useState(false);
const [spotMode, setSpotMode] = useState<SpotMode>("remove");
const [spotSize, setSpotSize] = useState(DEFAULT_SPOT_SIZE);
const [spotFeather, setSpotFeather] = useState(DEFAULT_SPOT_FEATHER);
const [spotOpacity, setSpotOpacity] = useState(DEFAULT_SPOT_OPACITY);
const placeSpot = useCallback(
(u: number, v: number) => {
if (!session?.loaded || !canEdit) return;
const r = crop.rect;
const x = r.x0 + u * (r.x1 - r.x0);
const y = r.y0 + v * (r.y1 - r.y0);
const next = addSpot(session.settings, {
mode: spotMode,
x,
y,
size: spotSize,
feather: spotFeather,
opacity: spotOpacity,
});
session.edit({ command: "develop.merge", params: { partial: spotsPartial(next) } });
session.endGesture();
},
[session, canEdit, crop.rect, spotMode, spotSize, spotFeather, spotOpacity],
);
const deleteSpot = useCallback(
(index: number) => {
if (!session?.loaded || !canEdit) return;
session.edit({ command: "develop.merge", params: { partial: spotsPartial(removeSpotAt(session.settings, index)) } });
session.endGesture();
},
[session, canEdit],
);
const spotMarks = useMemo(() => {
if (!spotting || !spots.length) return [];
const r = crop.rect;
const rw = r.x1 - r.x0 || 1;
const rh = r.y1 - r.y0 || 1;
return spots
.map((s) => {
const p = s.points[0];
if (!p) return null;
return { u: (p.x - r.x0) / rw, v: (p.y - r.y0) / rh, size: s.size / Math.max(rw, rh) };
})
.filter((m): m is { u: number; v: number; size: number } => !!m && m.u >= -0.05 && m.u <= 1.05 && m.v >= -0.05 && m.v <= 1.05);
}, [spotting, spots, crop.rect]);
/** 1:1 view, and where its full-resolution original stands. */
const [oneToOne, setOneToOne] = useState(false);
const [fullState, setFullState] = useState<"idle" | "waiting" | "ready" | "missing">("idle");
const [oneToOne, setOneToOne] = useState(false); const [fullState, setFullState] = useState<"idle" | "waiting" | "ready" | "missing">("idle");
useEffect(() => {
setOneToOne(false);
setFullState("idle");
@@ -625,13 +694,16 @@ export function DevelopPage() {
{...(oneToOne || current.originalName.toLowerCase().endsWith(".dng") || current.name.toLowerCase().endsWith(".dng")
? { localSource: fullSource }
: isDesktop() && { localSource: () => localOriginalToView(current.sha256) })}
picking={picking && !cropping && !before}
picking={picking && !cropping && !spotting && !before}
onPick={(u, v) => {
setPicking(false);
// The view shows the cropped frame: map back to the whole frame (straighten angle ignored).
const r = crop.rect;
void autoValues("pick", { x: r.x0 + u * (r.x1 - r.x0), y: r.y0 + v * (r.y1 - r.y0) });
}}
spotting={spotting && !cropping && !before}
onSpot={placeSpot}
spotMarks={spotMarks}
onCrop={(rect, final) => {
setDragging(!final);
session?.edit({ command: "crop.set", params: { rect: clampUnit(rect), angle: crop.angle, aspect: crop.aspect } }, "crop");
@@ -651,13 +723,103 @@ export function DevelopPage() {
{oneToOne && fullState === "waiting" && <p className="border-b border-line bg-accent/20 px-3 py-2 text-[12px] text-ink">{t.dev.fullWaiting}</p>}
{oneToOne && fullState === "missing" && <p className="border-b border-line px-3 py-2 text-[12px] text-[#f0a35a]">{t.dev.fullMissing}</p>}
{picking && <p className="border-b border-line bg-accent/20 px-3 py-2 text-[12px] text-ink">{t.dev.pickWbNow}</p>}
{spotting && <p className="border-b border-line bg-accent/20 px-3 py-2 text-[12px] text-ink">{t.dev.spotNow}</p>}
{!canEdit && current && <p className="border-b border-line px-3 py-2 text-[12px] text-faint">{t.dev.noAccess}</p>}
<Section title={t.dev.spot}>
<div className="mb-2 flex flex-wrap items-center gap-2">
<button
disabled={!canEdit}
onClick={() => {
setCropping(false);
setPicking(false);
setSpotting((s) => !s);
}}
aria-pressed={spotting}
className={`h-7 border border-black px-3 text-[12px] disabled:opacity-40 ${spotting ? "bg-accent text-white" : "bg-cell"}`}
>
{spotting ? t.dev.spotDone : t.dev.spot}
</button>
<span className="text-[11px] text-faint">{t.dev.spotHelp}</span>
</div>
<div className="mb-2 flex flex-wrap gap-1">
{SPOT_MODES.map((m) => (
<button
key={m.id}
disabled={!canEdit}
onClick={() => setSpotMode(m.id)}
aria-pressed={spotMode === m.id}
className={`h-6 border border-black px-2 text-[11px] disabled:opacity-40 ${spotMode === m.id ? "bg-cell-on text-ink" : "bg-cell text-muted"}`}
>
{t.dev[m.labelKey]}
</button>
))}
</div>
<label className="mb-2 block text-[11px] text-faint">
{t.dev.spotSize}
<input
type="range"
min={0.005}
max={0.12}
step={0.001}
value={spotSize}
disabled={!canEdit}
onChange={(e) => setSpotSize(Number(e.target.value))}
className="mt-1 w-full"
/>
</label>
<label className="mb-2 block text-[11px] text-faint">
{t.dev.spotFeather}
<input
type="range"
min={0}
max={100}
step={1}
value={spotFeather}
disabled={!canEdit}
onChange={(e) => setSpotFeather(Number(e.target.value))}
className="mt-1 w-full"
/>
</label>
<label className="mb-2 block text-[11px] text-faint">
{t.dev.spotOpacity}
<input
type="range"
min={0}
max={100}
step={1}
value={spotOpacity}
disabled={!canEdit}
onChange={(e) => setSpotOpacity(Number(e.target.value))}
className="mt-1 w-full"
/>
</label>
{spots.length > 0 && (
<ul className="mt-1 max-h-28 space-y-1 overflow-y-auto text-[11px]">
{spots.map((s, i) => {
const label = SPOT_MODES.find((m) => m.id === s.mode);
return (
<li key={i} className="flex items-center justify-between gap-2 border border-line bg-cell px-2 py-1">
<span className="truncate text-muted">
{label ? t.dev[label.labelKey] : s.mode} · {i + 1}
</span>
<button type="button" disabled={!canEdit} className="text-ink underline disabled:opacity-40" onClick={() => deleteSpot(i)}>
{t.dev.spotDelete}
</button>
</li>
);
})}
</ul>
)}
</Section>
{modules.includes("crop") && (
<Section title={t.modules.crop}>
<div className="mb-2 flex items-center gap-2">
<button
disabled={!canEdit}
onClick={() => setCropping(!cropping)}
onClick={() => {
setSpotting(false);
setCropping(!cropping);
}}
aria-pressed={cropping}
className={`h-7 border border-black px-3 text-[12px] disabled:opacity-40 ${cropping ? "bg-accent text-white" : "bg-cell"}`}
>
-22
View File
@@ -321,11 +321,6 @@ export function LibraryPage() {
const games = openEvent && !events.some((event) => event.id === openEvent.id) ? [openEvent, ...events] : events;
syncGames(games);
}, [events, openEvent, syncGames]);
const sending = uploads.items.filter((i) => i.status === "queued" || i.status === "uploading");
const failed = uploads.items.filter((i) => i.status === "failed");
const sentCount = uploads.items.filter((i) => i.status === "done" || i.status === "duplicate").length;
const overall = uploads.items.length ? uploads.items.reduce((sum, i) => sum + (i.status === "failed" ? 1 : i.progress), 0) / uploads.items.length : 0;
const playerIds = useMemo(() => photoIdsOf(players), [players]);
const visible = useMemo(() => state.photos.filter((p) => matchesFilter(p, filter) && (playerIds === null || playerIds.has(p.id))), [state.photos, filter, playerIds]);
const selectedPlayerIds = useMemo(() => players.map((p) => p.id), [players]);
@@ -774,23 +769,6 @@ export function LibraryPage() {
)}
</div>
{uploads.items.length > 0 && (
<div className="flex flex-wrap items-center gap-3 border-t border-line bg-panel px-3 py-1.5 text-[12px]" role="status">
<span className="font-mono text-[11px]">
{sending.length ? t.uploading(sentCount, uploads.items.length) : t.uploaded(sentCount)}
{failed.length > 0 && <span className="text-[#f0a35a]"> · {t.uploadFailed(failed.length)}</span>}
</span>
<span className="h-1 min-w-24 flex-1 bg-black">
<span className="block h-full bg-accent transition-[width]" style={{ width: `${Math.round(overall * 100)}%` }} />
</span>
{failed.length > 0 && <span className="truncate text-[11px] text-faint" title={failed.map((f) => `${f.name}: ${f.error}`).join("\n")}>{failed[0]?.name}: {failed[0]?.error}</span>}
{!sending.length && (
<button onClick={uploads.clear} className="text-[11px] text-faint underline hover:text-muted">
{t.dismiss}
</button>
)}
</div>
)}
{desktop && <CardOverallStatus />}
<div className="border-t border-line bg-raised px-3 py-1.5 text-[11px] text-faint">{t.shortcuts}</div>
</div>
+6 -4
View File
@@ -8,6 +8,7 @@ import { LocalDeliveries } from "../desktop/localDeliveries.js";
import { UiReadyNotice, UpdateNotice } from "../desktop/UpdateNotice.js";
import { FolderScanProvider } from "../library/folderScan.js";
import { IngestProvider } from "../library/ingest.js";
import { TransferBar } from "../library/TransferBar.js";
const moduleClass = ({ isActive }: { isActive: boolean }) =>
`px-3 py-1 font-display text-[19px] max-sm:px-2 max-sm:text-[15px] font-semibold uppercase tracking-wide transition-colors ${
@@ -141,13 +142,14 @@ export function Shell() {
<UpdateNotice />
<UiReadyNotice />
<LocalDeliveries />
<main className="min-h-0 flex-1 overflow-auto">
<IngestProvider>
<IngestProvider>
<main className="min-h-0 flex-1 overflow-auto">
<FolderScanProvider>
<Outlet />
</FolderScanProvider>
</IngestProvider>
</main>
</main>
<TransferBar />
</IngestProvider>
</div>
);
}