diff --git a/apps/app/src/i18n.ts b/apps/app/src/i18n.ts
index 42f52f7..c53cf63 100644
--- a/apps/app/src/i18n.ts
+++ b/apps/app/src/i18n.ts
@@ -226,6 +226,23 @@ export const t = {
chooseFolder: "Escolher pasta",
dropHint: "ou larga uma pasta aqui",
reading: (done: number, total: number) => `A ler ${done} de ${total}…`,
+ fusingAll: (done: number, total: number) => `A fundir ${done} de ${total} ângulos`,
+ savingAll: (done: number, total: number) => `A guardar ${done} de ${total}`,
+ resultHelp: "Cada imagem é o ângulo já fundido. Escolhe um acabamento e guarda o JPEG neste computador.",
+ save: "Guardar",
+ saveAll: "Guardar todos",
+ edit: "Editar",
+ exposure: "Exposição",
+ highlights: "Altas luzes",
+ shadows: "Sombras",
+ lookFailed: "Não apliquei o acabamento.",
+ savedFolder: "Os JPEG ficaram na pasta que escolheste.",
+ savedDownload: "Os JPEG foram descarregados.",
+ looks: {
+ natural: "Natural",
+ interior: "Interior claro",
+ brighter: "Mais luz",
+ },
noPhotos: "Não há fotografias nesta seleção. Um ficheiro XMP só acompanha o raw.",
support: (n: number) => (n === 1 ? "1 ficheiro de apoio (XMP e semelhantes) não é uma fotografia." : `${n} ficheiros de apoio (XMP e semelhantes) não são fotografias.`),
asideMore: (n: number) => `e mais ${n}`,
@@ -274,7 +291,9 @@ export const t = {
sidecars: "Levar WAV/XMP",
needSource: "Escolhe primeiro o cartão/pasta de origem.",
progress: (done: number, total: number, name: string) => `A processar ${done}/${total}… ${name}`,
- remaining: (label: string) => `faltam cerca de ${label}`,
+ overall: (done: number, total: number, percent: number) => `${done} de ${total} · ${percent}%`,
+ general: "Geral",
+ remaining: (label: string) => (label.startsWith("menos") ? `falta ${label}` : `faltam cerca de ${label}`),
stop: "Parar",
stopping: "Pára depois do ficheiro que está a copiar.",
oldShellStop: "Esta versão da app de secretária ainda não consegue parar a meio. Atualiza-a; a cópia que já vai continua.",
diff --git a/apps/app/src/library/CardIngest.tsx b/apps/app/src/library/CardIngest.tsx
index 346ef20..2d4c868 100644
--- a/apps/app/src/library/CardIngest.tsx
+++ b/apps/app/src/library/CardIngest.tsx
@@ -1,7 +1,7 @@
import { useEffect, useState, useSyncExternalStore } from "react";
import { t } from "../i18n.js";
import { desktopInvoke } from "../platform.js";
-import { copyPace } from "./cardPace.js";
+import { copyPace, overallPace } from "./cardPace.js";
import { cardJobList, dismissCard, enqueueCard, startQueued, stopCard, subscribeCardJobs, type CardJob, type CardResult, type CardSettings, type RawJpeg } from "./cardJobs.js";
import { SnapshotMenu } from "./SnapshotMenu.js";
@@ -232,13 +232,12 @@ function CardJobRow({ job, onRemove, onStop }: { job: CardJob; onRemove: () => v
{scan &&
{scan}
}
{job.status === "running" && job.progress && (
<>
-
-
- {t.card.progress(job.progress.done, job.progress.total, job.progress.name)}
+
+ {t.card.overall(job.progress.done, job.progress.total, Math.round(pace.fraction * 100))}
{pace.left ? ` · ${t.card.remaining(pace.left)}` : ""}
+
+ {job.progress.name && {job.progress.name}
}
>
)}
{job.error && {job.error}
}
@@ -247,6 +246,41 @@ function CardJobRow({ job, onRemove, onStop }: { job: CardJob; onRemove: () => v
);
}
+/** The copy as a whole, under the library, including when the card window is closed. */
+export function CardOverallStatus() {
+ const jobs = useCardJobs();
+ const [, setTick] = useState(0);
+ const running = jobs.some((job) => job.status === "running");
+ useEffect(() => {
+ if (!running) return;
+ const timer = setInterval(() => setTick((n) => n + 1), 1000);
+ return () => clearInterval(timer);
+ }, [running]);
+ const overall = overallPace(jobs, Date.now());
+ if (!overall) return null;
+ const name = jobs.find((job) => job.status === "running" && job.progress?.name)?.progress?.name;
+ return (
+
+
+ {t.card.general}
+ {t.card.overall(overall.done, overall.total, Math.round(overall.fraction * 100))}
+ {overall.left && {t.card.remaining(overall.left)}}
+ {name && {name}}
+
+
+
+ );
+}
+
+function Track({ fraction }: { fraction: number }) {
+ const percent = Math.round(Math.max(0, Math.min(1, fraction)) * 100);
+ return (
+
+ );
+}
+
function JobResult({ result }: { result: CardResult }) {
const parts = [
result.moved ? t.card.result.moved(result.moved) : "",
diff --git a/apps/app/src/library/cardPace.test.ts b/apps/app/src/library/cardPace.test.ts
index 8e745c6..6f0fac9 100644
--- a/apps/app/src/library/cardPace.test.ts
+++ b/apps/app/src/library/cardPace.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
-import { copyPace, formatRemaining, remainingMs } from "./cardPace.js";
+import { copyPace, formatRemaining, overallPace, remainingMs } from "./cardPace.js";
describe("card copy pace", () => {
it("estimates the rest from the bytes already written", () => {
@@ -12,6 +12,33 @@ describe("card copy pace", () => {
expect(pace.left).toBe("1 min");
});
+ it("adds every card into one bar", () => {
+ const started = 1_000;
+ const now = started + 10_000;
+ const pace = overallPace(
+ [
+ { status: "running", startedAt: started, progress: { done: 1, total: 4, bytesDone: 10, bytesTotal: 40 } },
+ { status: "running", startedAt: started, progress: { done: 1, total: 4, bytesDone: 30, bytesTotal: 60 } },
+ { status: "queued", startedAt: null, progress: null },
+ ],
+ now,
+ );
+ expect(pace).toMatchObject({ done: 2, total: 8 });
+ expect(pace?.fraction).toBeCloseTo(0.4);
+ });
+
+ it("counts files when a card has no byte total", () => {
+ const started = 1_000;
+ const pace = overallPace(
+ [
+ { status: "running", startedAt: started, progress: { done: 1, total: 4, bytesDone: 10, bytesTotal: 40 } },
+ { status: "running", startedAt: started, progress: { done: 2, total: 4 } },
+ ],
+ started + 10_000,
+ );
+ expect(pace?.fraction).toBeCloseTo(3 / 8);
+ });
+
it("waits for a little progress before guessing", () => {
expect(remainingMs(0, 10, 0, 5_000)).toBeNull();
expect(remainingMs(1, 10, 0, 100)).toBeNull();
diff --git a/apps/app/src/library/cardPace.ts b/apps/app/src/library/cardPace.ts
index eba2868..b1b83ba 100644
--- a/apps/app/src/library/cardPace.ts
+++ b/apps/app/src/library/cardPace.ts
@@ -16,6 +16,34 @@ export function formatRemaining(ms: number): string {
return `${hours} h ${rest} min`;
}
+export interface PaceJob {
+ status: string;
+ startedAt: number | null;
+ progress: { done: number; total: number; bytesDone?: number; bytesTotal?: number } | null;
+}
+
+/** One bar for every card still copying: bytes when each job reports them, otherwise file counts. */
+export function overallPace(jobs: readonly PaceJob[], now: number): { done: number; total: number; fraction: number; left: string | null } | null {
+ const running = jobs.filter((job) => job.status === "running" && job.progress && job.progress.total > 0 && job.startedAt !== null);
+ if (running.length === 0) return null;
+ const startedAt = Math.min(...running.map((job) => job.startedAt as number));
+ const done = running.reduce((sum, job) => sum + (job.progress?.done ?? 0), 0);
+ const total = running.reduce((sum, job) => sum + (job.progress?.total ?? 0), 0);
+ const byBytes = running.every((job) => (job.progress?.bytesTotal ?? 0) > 0);
+ const progress = {
+ done,
+ total,
+ ...(byBytes
+ ? {
+ bytesDone: running.reduce((sum, job) => sum + (job.progress?.bytesDone ?? 0), 0),
+ bytesTotal: running.reduce((sum, job) => sum + (job.progress?.bytesTotal ?? 0), 0),
+ }
+ : {}),
+ };
+ const pace = copyPace(progress, startedAt, now);
+ return { done, total, fraction: pace.fraction, left: pace.left };
+}
+
export function copyPace(
progress: { done: number; total: number; bytesDone?: number; bytesTotal?: number } | null,
startedAt: number | null,
diff --git a/apps/app/src/pages/LibraryPage.tsx b/apps/app/src/pages/LibraryPage.tsx
index 5024c2f..ed11f2e 100644
--- a/apps/app/src/pages/LibraryPage.tsx
+++ b/apps/app/src/pages/LibraryPage.tsx
@@ -18,7 +18,7 @@ import { IptcInfo } from "../library/IptcInfo.js";
import { useLibraryLive } from "../library/realtime.js";
import { useIngest } from "../library/ingest.js";
import { LocalFtpButton } from "../library/LocalFtp.js";
-import { CardIngestButton } from "../library/CardIngest.js";
+import { CardIngestButton, CardOverallStatus } from "../library/CardIngest.js";
import { AutopilotButton } from "../library/Autopilot.js";
import { SquadsButton } from "../library/Squads.js";
import { type PlayerPick, photoIdsOf, samePicks } from "../library/squadFilter.js";
@@ -672,6 +672,7 @@ export function LibraryPage() {
)}
)}
+ {desktop && }
{t.shortcuts}
diff --git a/apps/app/src/pages/RealEstatePage.test.tsx b/apps/app/src/pages/RealEstatePage.test.tsx
index e4d9a4e..1684e4d 100644
--- a/apps/app/src/pages/RealEstatePage.test.tsx
+++ b/apps/app/src/pages/RealEstatePage.test.tsx
@@ -1,7 +1,7 @@
import type { BracketFrame } from "@photoreport/metadata";
import { groupBrackets } from "@photoreport/metadata";
import type { ApiClient, Me, Organization } from "@photoreport/sdk";
-import { render, screen } from "@testing-library/react";
+import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { App } from "../App.js";
@@ -94,6 +94,10 @@ describe("real estate area", () => {
expect(await screen.findByText("1 ângulo")).toBeTruthy();
expect(screen.getByText("Ângulo 1 · 3 exposições")).toBeTruthy();
expect(await screen.findByRole("img", { name: "Ângulo 1 fundido" })).toBeTruthy();
+ await waitFor(() => expect(screen.getByRole("button", { name: "Guardar todos" }).hasAttribute("disabled")).toBe(false));
+ expect(screen.getByRole("button", { name: /^Guardar$/ })).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Interior claro" })).toBeTruthy();
+ expect(screen.getByRole("button", { name: "Editar" })).toBeTruthy();
expect(screen.getByText("1 fotografia fica de fora")).toBeTruthy();
expect(screen.getByText("solo.cr3 · 0 EV")).toBeTruthy();
expect(api.groupRealEstate).toHaveBeenCalledOnce();
diff --git a/apps/app/src/pages/RealEstatePage.tsx b/apps/app/src/pages/RealEstatePage.tsx
index 7d179ea..cada6c9 100644
--- a/apps/app/src/pages/RealEstatePage.tsx
+++ b/apps/app/src/pages/RealEstatePage.tsx
@@ -3,8 +3,11 @@ import { ApiError, hasRole, type RealEstateGrouping } from "@photoreport/sdk";
import { useEffect, useRef, useState } from "react";
import { useAuth } from "../auth.js";
import { t } from "../i18n.js";
+import { applyFinish } from "../realestate/finish.js";
import { fuseBracket } from "../realestate/fuse.js";
+import { LOOKS, finishValues, needsFinish, type LookId } from "../realestate/looks.js";
import { fillFromSidecar, pairKey, partitionBracketFiles, readBracketFile } from "../realestate/readFrame.js";
+import { downloadBlob, jpegName, saveBlobs } from "../realestate/save.js";
import { PageHeader } from "./Shell.js";
const READ_AT_ONCE = 4;
@@ -131,7 +134,12 @@ export function RealEstatePage() {
{t.realEstate.dropHint}
- {busy && progress && {t.realEstate.reading(progress.done, progress.total)}
}
+ {busy && progress && (
+
+
+
{t.realEstate.reading(progress.done, progress.total)}
+
+ )}
{error && {error}
}
{support > 0 && {t.realEstate.support(support)}
}
{result && }
@@ -144,15 +152,89 @@ export function RealEstatePage() {
function Grouping({ frames, files, result }: { frames: BracketFrame[]; files: Map; result: RealEstateGrouping }) {
const byId = new Map(frames.map((frame) => [frame.id, frame]));
+ const ready = useRef(new Set());
+ const [fused, setFused] = useState(0);
+ const [blobs, setBlobs] = useState