forked from fahrPool/fahrPool
docs: add Auftrag-Foto-Galerie implementation plan
This commit is contained in:
parent
61a306a121
commit
a2254ae539
|
|
@ -0,0 +1,387 @@
|
|||
# Foto-Galerie im Auftrag Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Bereits hochgeladene Auftrags-Fotos (8 Pflichtfotos + optionale Schadensfotos) werden auf der Auftrag-Detailseite als Thumbnail-Grid angezeigt, sind per Klick vergrößerbar (Lightbox) und einzeln herunterladbar.
|
||||
|
||||
**Architecture:** Rein lesendes Feature, keine neue Server Action, kein Schema-Change. Eine neue Query-Funktion lädt `auftrag_fotos` über den bestehenden RLS-gebundenen Request-Client und erzeugt pro Foto eine signierte URL (`createSignedUrl`, privater Bucket `auftrag-fotos`), deren Origin explizit auf `NEXT_PUBLIC_SUPABASE_URL` umgeschrieben wird (der Server-Client läuft im Docker-Master-Stack gegen die intern-only `SUPABASE_INTERNAL_URL`, die im Browser nicht auflösbar wäre). Eine neue Client Component zeigt die Thumbnails und eine Lightbox nach demselben Overlay-Muster wie das bestehende `MobileNav.tsx`.
|
||||
|
||||
**Tech Stack:** Next.js 16 (App Router), Supabase Storage (`createSignedUrl`), bestehende Design-System-Primitives (`Card`, `buttonClasses`), React `useState`/`useEffect`, Vitest.
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- Keine neue Migration, keine neue RLS-Policy. `auftrag_fotos` SELECT und `storage.objects` SELECT (Bucket `auftrag-fotos`) sind bereits korrekt (Fahrer sieht nur Fotos des eigenen zugewiesenen Auftrags; Admin/Disponent/Readonly sehen alle) — RLS bleibt die alleinige Sicherheitsgrenze, kein zusätzlicher App-Code-Berechtigungscheck für die Galerie nötig.
|
||||
- **Origin-Rewrite ist Pflicht, nicht optional:** `createSignedUrl()` baut die zurückgegebene URL aus der Basis, gegen die der aufrufende Client konfiguriert ist. `web/lib/supabase/server.ts` nutzt `SUPABASE_INTERNAL_URL ?? NEXT_PUBLIC_SUPABASE_URL` — im Docker-Compose-Master-Stack ist das `http://kong:8000` (`docker-compose.yaml:177`, nur im Docker-Netzwerk auflösbar). Die Query-Funktion muss Pfad+Query-String der signierten URL extrahieren und mit `process.env.NEXT_PUBLIC_SUPABASE_URL` neu zusammensetzen, bevor sie an die Seite geht. Im lokalen CLI-Dev-Stack fällt ein Vergessen dieses Schritts nicht auf (dort sind beide Variablen identisch) — das Live-Verifikations-Schritt in Task 3 muss das trotzdem explizit gegen die tatsächlich konfigurierte `NEXT_PUBLIC_SUPABASE_URL` prüfen, nicht nur "Bild lädt lokal".
|
||||
- Bewusst kein `next/image` — plain `<img>`, um `images.remotePatterns`-Konfiguration und Cache-Fragen rund um ablaufende signierte URLs zu vermeiden (für dieses interne, wenig frequentierte Tool nicht nötig).
|
||||
- Download-Link nutzt denselben signierten Token wie die Anzeige-URL, nur mit angehängtem `&download=<Dateiname>` — kein zweiter `createSignedUrl`-Aufruf.
|
||||
- Reihenfolge der Fotos: erst die 8 Pflicht-Positionen in der festen Reihenfolge aus `PFLICHT_FOTO_POSITIONEN` (`web/lib/auftraege/foto-positionen.ts`, bereits vorhanden, nicht verändern), danach alle `schaden`-Fotos nach `uploaded_at` aufsteigend sortiert.
|
||||
- Beschriftung: Pflicht-Positionen als `position.replaceAll("_", " ")` (gleiche Transformation wie bereits im bestehenden Upload-Formular in `page.tsx` verwendet). Schadensfotos: "Schaden" bei genau einem Treffer, sonst "Schaden 1", "Schaden 2" … in der oben sortierten Reihenfolge.
|
||||
- Lightbox-Overlay-Muster folgt `web/components/MobileNav.tsx` (`fixed inset-0 z-50`, Backdrop-`button`, `useEffect` mit `keydown`-Listener auf `Escape`) — abweichende Backdrop-Deckkraft ist bewusst (dunkler für Bildbetrachtung), keine abweichende Grundstruktur.
|
||||
- Galerie-Card wird nur gerendert, wenn mindestens ein Foto existiert — kein leerer Platzhalter.
|
||||
- Bestehender Test-Stand vor diesem Plan: 75 Vitest-Tests (12 Dateien).
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Query-Layer — `loadAuftragFotos` + sortier-/beschriftungslogik
|
||||
|
||||
**Files:**
|
||||
- Create: `web/lib/auftraege/fotos.ts`
|
||||
- Create: `web/lib/auftraege/fotos.test.ts`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: `createClient` (`@/lib/supabase/server`, bereits vorhanden), `PFLICHT_FOTO_POSITIONEN` (`@/lib/auftraege/foto-positionen`, bereits vorhanden, unverändert).
|
||||
- Produces: `type AuftragFoto = { position: string; label: string; url: string; downloadUrl: string }`; `loadAuftragFotos(auftragId: string): Promise<AuftragFoto[]>` — konsumiert von Task 3 (`page.tsx`). `type FotoZeile = { position: string; storage_path: string; uploaded_at: string }` und `sortiereUndBeschrifteFotos(fotos: FotoZeile[]): (FotoZeile & { label: string })[]` — reine, exportierte Hilfsfunktion, direkt unit-testbar.
|
||||
|
||||
- [ ] **Step 1: Sortier-/Beschriftungslogik und Typen schreiben**
|
||||
|
||||
Create `web/lib/auftraege/fotos.ts`:
|
||||
|
||||
```ts
|
||||
import { createClient } from "@/lib/supabase/server";
|
||||
import { PFLICHT_FOTO_POSITIONEN } from "./foto-positionen";
|
||||
|
||||
export type AuftragFoto = {
|
||||
position: string;
|
||||
label: string;
|
||||
url: string;
|
||||
downloadUrl: string;
|
||||
};
|
||||
|
||||
export type FotoZeile = {
|
||||
position: string;
|
||||
storage_path: string;
|
||||
uploaded_at: string;
|
||||
};
|
||||
|
||||
export function sortiereUndBeschrifteFotos(fotos: FotoZeile[]): (FotoZeile & { label: string })[] {
|
||||
const pflichtFotos = PFLICHT_FOTO_POSITIONEN.map((position) =>
|
||||
fotos.find((foto) => foto.position === position)
|
||||
).filter((foto): foto is FotoZeile => foto !== undefined);
|
||||
|
||||
const schadenFotos = fotos
|
||||
.filter((foto) => foto.position === "schaden")
|
||||
.sort((a, b) => a.uploaded_at.localeCompare(b.uploaded_at));
|
||||
|
||||
const beschriftetePflichtFotos = pflichtFotos.map((foto) => ({
|
||||
...foto,
|
||||
label: foto.position.replaceAll("_", " "),
|
||||
}));
|
||||
|
||||
const beschrifteteSchadenFotos = schadenFotos.map((foto, index) => ({
|
||||
...foto,
|
||||
label: schadenFotos.length > 1 ? `Schaden ${index + 1}` : "Schaden",
|
||||
}));
|
||||
|
||||
return [...beschriftetePflichtFotos, ...beschrifteteSchadenFotos];
|
||||
}
|
||||
|
||||
export async function loadAuftragFotos(auftragId: string): Promise<AuftragFoto[]> {
|
||||
const supabase = await createClient();
|
||||
const { data } = await supabase
|
||||
.from("auftrag_fotos")
|
||||
.select("position, storage_path, uploaded_at")
|
||||
.eq("auftrag_id", auftragId);
|
||||
|
||||
if (!data || data.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const sortiert = sortiereUndBeschrifteFotos(data);
|
||||
const publicUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!;
|
||||
|
||||
const fotos = await Promise.all(
|
||||
sortiert.map(async (foto): Promise<AuftragFoto | null> => {
|
||||
const { data: signiert } = await supabase.storage
|
||||
.from("auftrag-fotos")
|
||||
.createSignedUrl(foto.storage_path, 3600);
|
||||
if (!signiert) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const geparst = new URL(signiert.signedUrl);
|
||||
const url = `${publicUrl}${geparst.pathname}${geparst.search}`;
|
||||
const dateiname = foto.storage_path.split("/").pop() ?? `${foto.position}.jpg`;
|
||||
const downloadUrl = `${url}&download=${encodeURIComponent(dateiname)}`;
|
||||
|
||||
return { position: foto.position, label: foto.label, url, downloadUrl };
|
||||
})
|
||||
);
|
||||
|
||||
return fotos.filter((foto): foto is AuftragFoto => foto !== null);
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Tests für `sortiereUndBeschrifteFotos` schreiben**
|
||||
|
||||
Create `web/lib/auftraege/fotos.test.ts`:
|
||||
|
||||
```ts
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sortiereUndBeschrifteFotos } from "./fotos";
|
||||
|
||||
describe("sortiereUndBeschrifteFotos", () => {
|
||||
it("sortiert Pflichtfotos in der festen Positions-Reihenfolge, unabhaengig von der Eingabe-Reihenfolge", () => {
|
||||
const fotos = [
|
||||
{ position: "heck", storage_path: "a/heck.jpg", uploaded_at: "2026-01-01T10:00:00Z" },
|
||||
{ position: "front", storage_path: "a/front.jpg", uploaded_at: "2026-01-01T09:00:00Z" },
|
||||
];
|
||||
const result = sortiereUndBeschrifteFotos(fotos);
|
||||
expect(result.map((f) => f.position)).toEqual(["front", "heck"]);
|
||||
});
|
||||
|
||||
it("beschriftet Pflichtfotos mit Leerzeichen statt Unterstrich", () => {
|
||||
const fotos = [
|
||||
{ position: "seitlich_rechts", storage_path: "a/seitlich_rechts.jpg", uploaded_at: "2026-01-01T09:00:00Z" },
|
||||
];
|
||||
const result = sortiereUndBeschrifteFotos(fotos);
|
||||
expect(result[0].label).toBe("seitlich rechts");
|
||||
});
|
||||
|
||||
it("laesst fehlende Pflicht-Positionen einfach weg", () => {
|
||||
const fotos = [{ position: "front", storage_path: "a/front.jpg", uploaded_at: "2026-01-01T09:00:00Z" }];
|
||||
const result = sortiereUndBeschrifteFotos(fotos);
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0].position).toBe("front");
|
||||
});
|
||||
|
||||
it("beschriftet ein einzelnes Schadensfoto ohne Nummer", () => {
|
||||
const fotos = [{ position: "schaden", storage_path: "a/schaden-1.jpg", uploaded_at: "2026-01-01T09:00:00Z" }];
|
||||
const result = sortiereUndBeschrifteFotos(fotos);
|
||||
expect(result[0].label).toBe("Schaden");
|
||||
});
|
||||
|
||||
it("nummeriert mehrere Schadensfotos nach Upload-Zeitpunkt, unabhaengig von der Eingabe-Reihenfolge", () => {
|
||||
const fotos = [
|
||||
{ position: "schaden", storage_path: "a/schaden-2.jpg", uploaded_at: "2026-01-01T10:00:00Z" },
|
||||
{ position: "schaden", storage_path: "a/schaden-1.jpg", uploaded_at: "2026-01-01T09:00:00Z" },
|
||||
];
|
||||
const result = sortiereUndBeschrifteFotos(fotos);
|
||||
expect(result.map((f) => f.storage_path)).toEqual(["a/schaden-1.jpg", "a/schaden-2.jpg"]);
|
||||
expect(result.map((f) => f.label)).toEqual(["Schaden 1", "Schaden 2"]);
|
||||
});
|
||||
|
||||
it("stellt Pflichtfotos vor Schadensfotos, unabhaengig von der Eingabe-Reihenfolge", () => {
|
||||
const fotos = [
|
||||
{ position: "schaden", storage_path: "a/schaden.jpg", uploaded_at: "2026-01-01T08:00:00Z" },
|
||||
{ position: "front", storage_path: "a/front.jpg", uploaded_at: "2026-01-01T09:00:00Z" },
|
||||
];
|
||||
const result = sortiereUndBeschrifteFotos(fotos);
|
||||
expect(result.map((f) => f.position)).toEqual(["front", "schaden"]);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Tests ausführen**
|
||||
|
||||
Run: `cd web && npm test`
|
||||
Expected: `Test Files 13 passed (13)`, `Tests 81 passed (81)` (75 bestehende + 6 neue).
|
||||
|
||||
- [ ] **Step 4: Build verifizieren**
|
||||
|
||||
Run: `cd web && npm run build`
|
||||
Expected: Exit 0, keine Typfehler (diese Datei wird von noch keiner Seite importiert, muss aber eigenständig kompilieren).
|
||||
|
||||
- [ ] **Step 5: Commit**
|
||||
|
||||
```bash
|
||||
git add web/lib/auftraege/fotos.ts web/lib/auftraege/fotos.test.ts
|
||||
git commit -m "feat: add loadAuftragFotos query with sort/label logic and signed-URL origin rewrite"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 2: `FotoGalerie`-Komponente (Thumbnails + Lightbox)
|
||||
|
||||
**Files:**
|
||||
- Create: `web/components/auftraege/FotoGalerie.tsx`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: `type AuftragFoto` (Task 1, `@/lib/auftraege/fotos`), `buttonClasses` (`@/components/ui/Button`, bereits vorhanden).
|
||||
- Produces: `FotoGalerie({ fotos }: { fotos: AuftragFoto[] })` — konsumiert von Task 3 (`page.tsx`).
|
||||
|
||||
- [ ] **Step 1: Komponente schreiben**
|
||||
|
||||
Create `web/components/auftraege/FotoGalerie.tsx`:
|
||||
|
||||
```tsx
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { buttonClasses } from "@/components/ui/Button";
|
||||
import type { AuftragFoto } from "@/lib/auftraege/fotos";
|
||||
|
||||
export function FotoGalerie({ fotos }: { fotos: AuftragFoto[] }) {
|
||||
const [offenerIndex, setOffenerIndex] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (offenerIndex === null) return;
|
||||
function onKeyDown(event: KeyboardEvent) {
|
||||
if (event.key === "Escape") setOffenerIndex(null);
|
||||
}
|
||||
window.addEventListener("keydown", onKeyDown);
|
||||
return () => window.removeEventListener("keydown", onKeyDown);
|
||||
}, [offenerIndex]);
|
||||
|
||||
const offenesFoto = offenerIndex !== null ? fotos[offenerIndex] : null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="grid grid-cols-3 gap-3 sm:grid-cols-4">
|
||||
{fotos.map((foto, index) => (
|
||||
<button
|
||||
key={`${foto.position}-${index}`}
|
||||
type="button"
|
||||
onClick={() => setOffenerIndex(index)}
|
||||
className="aspect-square overflow-hidden rounded-md border border-aluminium-grey focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-performance-blue"
|
||||
>
|
||||
<img src={foto.url} alt={foto.label} className="h-full w-full object-cover" />
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{offenesFoto && (
|
||||
<div className="fixed inset-0 z-50">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Schließen"
|
||||
onClick={() => setOffenerIndex(null)}
|
||||
className="absolute inset-0 bg-black/80"
|
||||
/>
|
||||
<div className="pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-4 p-4">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Schließen"
|
||||
onClick={() => setOffenerIndex(null)}
|
||||
className="pointer-events-auto absolute right-4 top-4 flex min-h-11 min-w-11 items-center justify-center rounded-md bg-white/90 text-asphalt-grey focus-visible:outline focus-visible:outline-2 focus-visible:outline-performance-blue"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" className="h-6 w-6" fill="none" stroke="currentColor" strokeWidth={2}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
<img
|
||||
src={offenesFoto.url}
|
||||
alt={offenesFoto.label}
|
||||
className="pointer-events-none max-h-[80vh] max-w-[90vw] rounded-md object-contain"
|
||||
/>
|
||||
<p className="pointer-events-none text-white">{offenesFoto.label}</p>
|
||||
<a href={offenesFoto.downloadUrl} className={`${buttonClasses("secondary", false)} pointer-events-auto`}>
|
||||
Download
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Hinweis zu `pointer-events-none`/`pointer-events-auto`: Der Backdrop-`button` liegt als eigenes Element unter dem Content-`div`. Ohne `pointer-events-none` auf dem Content-`div` selbst (das den ganzen Viewport überdeckt) würde ein Klick auf den leeren Bereich neben Bild/Button nicht beim Backdrop-`button` ankommen und die Lightbox nicht schließen. Bild, Schließen-Button und Download-Link bekommen `pointer-events-auto` zurück, damit sie weiterhin klickbar sind.
|
||||
|
||||
- [ ] **Step 2: Build verifizieren**
|
||||
|
||||
Run: `cd web && npm run build`
|
||||
Expected: Exit 0 (Komponente wird von noch keiner Seite importiert, muss aber eigenständig kompilieren).
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add web/components/auftraege/FotoGalerie.tsx
|
||||
git commit -m "feat: add FotoGalerie component with thumbnail grid and lightbox"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 3: Einbindung in die Detailseite + Verifikation
|
||||
|
||||
**Files:**
|
||||
- Modify: `web/app/auftraege/[id]/page.tsx`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: `loadAuftragFotos` (Task 1), `FotoGalerie` (Task 2).
|
||||
- Keine neuen Interfaces für nachfolgende Tasks — letzter Task dieses Plans.
|
||||
|
||||
- [ ] **Step 1: Seite anpassen**
|
||||
|
||||
In `web/app/auftraege/[id]/page.tsx`:
|
||||
|
||||
Import-Block ergänzen (nach der bestehenden `findeFolgeauftrag`-Import-Zeile):
|
||||
|
||||
```tsx
|
||||
import { loadAuftragFotos } from "@/lib/auftraege/fotos";
|
||||
import { FotoGalerie } from "@/components/auftraege/FotoGalerie";
|
||||
```
|
||||
|
||||
Die Zeile
|
||||
|
||||
```tsx
|
||||
const folgeauftrag = auftrag.status === "abgeschlossen" ? await findeFolgeauftrag(auftrag.id) : null;
|
||||
```
|
||||
|
||||
ersetzen durch:
|
||||
|
||||
```tsx
|
||||
const [folgeauftrag, fotos] = await Promise.all([
|
||||
auftrag.status === "abgeschlossen" ? findeFolgeauftrag(auftrag.id) : Promise.resolve(null),
|
||||
loadAuftragFotos(auftrag.id),
|
||||
]);
|
||||
```
|
||||
|
||||
Direkt nach der bestehenden Fahrzeug/Abholort/Zielort-`Card` (schließt mit `</Card>` vor dem `{auftrag.status === "offen" && (...)}`-Block) folgende neue Card einfügen:
|
||||
|
||||
```tsx
|
||||
{fotos.length > 0 && (
|
||||
<Card className="mb-6">
|
||||
<h2 className="mb-4 text-lg font-semibold text-asphalt-grey">Fotos</h2>
|
||||
<FotoGalerie fotos={fotos} />
|
||||
</Card>
|
||||
)}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Build und Tests verifizieren**
|
||||
|
||||
Run: `cd web && npm run build && npm test`
|
||||
Expected: Build Exit 0; `Test Files 13 passed (13)`, `Tests 81 passed (81)` (unverändert seit Task 1).
|
||||
|
||||
- [ ] **Step 3: Manuell verifizieren (curl — Rollen-Sichtbarkeit, statisches Rendering)**
|
||||
|
||||
```bash
|
||||
cd web
|
||||
npm run dev -- -p 3163 &
|
||||
sleep 3
|
||||
HASH=$(curl -s http://localhost:3163/login | grep -o '\$ACTION_ID_[a-z0-9]*' | head -1)
|
||||
curl -s -c /tmp/cookies.txt -X POST http://localhost:3163/login \
|
||||
-F "${HASH}=" \
|
||||
-F 'email=admin@aushilfsfahrer.local' \
|
||||
-F 'password=Admin123!' \
|
||||
-L -o /tmp/response.html -w "HTTP_STATUS:%{http_code} FINAL_URL:%{url_effective}\n"
|
||||
kill %1
|
||||
rm -f /tmp/cookies.txt /tmp/response.html
|
||||
```
|
||||
|
||||
Da ein Auftrag mit Fotos für diesen curl-Check erst live angelegt/durchlaufen werden müsste (Übernehmen → Fahrt beginnen mit Uploads), ist der eigentliche Sichtbarkeits-/Rendering-Test hier zweitrangig — der entscheidende Check ist Schritt 4 (Browser). Dieser curl-Schritt dient nur dazu, den Login-Mechanismus und dass die Seite grundsätzlich lädt zu bestätigen, bevor der aufwendigere Browser-Test folgt.
|
||||
|
||||
- [ ] **Step 4: Manuell verifizieren (Browser — Thumbnails, Lightbox, Download, Origin-Rewrite)**
|
||||
|
||||
Mit einem verfügbaren Browser-Automatisierungswerkzeug (z. B. `chrome-devtools`- oder `playwright`-MCP-Tools):
|
||||
|
||||
1. Einen Test-Auftrag anlegen (per `docker exec -i supabase_db_fundament-auth-rollen psql -U postgres -d postgres`, `insert into auftraege (...) values (..., 'offen', ...)`, bestehende `orte`/`fahrzeuge`/`profiles`-Testdaten verwenden), als Fahrer-Testnutzer einloggen (Passwort ggf. über die GoTrue-Admin-API zurücksetzen, siehe `supabase-local-dev`-Skill), Auftrag übernehmen, "Fahrt beginnen" mit KM-Stand und allen 8 Pflichtfotos (kleine valide Test-JPEGs) plus mindestens einem Schadensfoto durchlaufen.
|
||||
2. Auf der Detailseite: Card "Fotos" erscheint, zeigt 9 Thumbnails (8 Pflicht + 1 Schaden) in der in den Global Constraints beschriebenen Reihenfolge, jedes Thumbnail lädt sichtbar ein Bild (kein kaputtes Bild-Icon — das wäre ein Zeichen, dass der Origin-Rewrite fehlgeschlagen ist).
|
||||
3. **Origin-Rewrite explizit prüfen:** die tatsächliche `src`/`href` eines Thumbnails/Downloads inspizieren (z. B. per Snapshot/Accessibility-Tree oder `evaluate`) und bestätigen, dass die URL mit der konfigurierten `NEXT_PUBLIC_SUPABASE_URL` beginnt, nicht mit `SUPABASE_INTERNAL_URL`/`kong` (im lokalen CLI-Dev-Stack sind beide zufällig identisch — trotzdem den Code-Pfad in `fotos.ts` noch einmal lesen und bestätigen, dass tatsächlich `process.env.NEXT_PUBLIC_SUPABASE_URL` verwendet wird, nicht implizit die Basis des Storage-Clients).
|
||||
4. Auf ein Thumbnail klicken: Lightbox öffnet mit großem Bild, Beschriftung und "Download"-Link. Escape-Taste schließt sie. Erneut öffnen, auf den dunklen Rand (nicht auf Bild/Buttons) klicken: schließt ebenfalls.
|
||||
5. Auf "Download" klicken: Datei wird heruntergeladen (nicht nur im Browser-Tab geöffnet) — bestätigt, dass der `download`-Query-Parameter serverseitig `Content-Disposition: attachment` auslöst.
|
||||
6. Denselben Auftrag als Admin/Disponent aufrufen: Fotos ebenfalls sichtbar (RLS erlaubt das). Falls ein zweiter Fahrer-Testnutzer verfügbar ist, dessen Zugriff auf denselben Auftrag prüfen: keine "Fahrt beginnen"-Aktionen sichtbar (nicht `istEigenerAuftrag`), und die Fotos-Card erscheint für ihn nicht (RLS liefert keine Zeilen) — falls kein zweiter Testnutzer ohne Aufwand verfügbar ist, diesen Teilschritt überspringen und im Report vermerken.
|
||||
|
||||
Nach dem Test angelegte Testdaten (Auftrag, `auftrag_fotos`-Zeilen, hochgeladene Storage-Objekte) wieder entfernen, Dev-Server beenden.
|
||||
|
||||
- [ ] **Step 5: Commit**
|
||||
|
||||
```bash
|
||||
git add web/app/auftraege/\[id\]/page.tsx
|
||||
git commit -m "feat: show Foto-Galerie on Auftrag detail page"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## After all tasks
|
||||
|
||||
Kurzer Abschluss-Check: `cd web && npm run build && npm test` ein letztes Mal ausführen. Danach `superpowers:finishing-a-development-branch` für die Merge-Entscheidung nutzen (Worktree unter `.claude/worktrees/auftrag-foto-galerie/`, Branch `feature/auftrag-foto-galerie`, wie in `CLAUDE.md` vorgeschrieben).
|
||||
Loading…
Reference in New Issue