Projektlogo: quadratisches Logo hochladen & anzeigen
ci / quality (push) Failing after 42s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 53s

Logo kann bei der Projekterstellung und nachträglich im Projekt-Header
hochgeladen werden. Client-seitiger Center-Crop auf 256px WebP, gespeichert
als Data-URL in neuer Spalte project.logo_url (Migration 0016). Anzeige in
der Bereichs-Projektliste (Card) und im Detail-Header, mit Initialen-
Platzhalter wenn kein Logo gesetzt ist.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
dejanandClaude Opus 4.8 committed 2026-06-06 20:44:58 +02:00
1 parent 45a87711fb
commit 1206dc5e0f
9 files changed
+3652 -119

No files matched your search

+63 -1
View File
@@ -12,6 +12,7 @@ import { voice } from '../lib/voice';
import { toast } from 'sonner';
import { clsx } from 'clsx';
import { LEAD_STATUS_META, type LeadStatus } from '../lib/lead-meta';
import { ProjectLogo, LogoUpload } from '../components/project/ProjectLogo';
import {
MODUS_META,
MODI,
@@ -109,7 +110,10 @@ export function ProjektRoute() {
</p>
</div>
<div className="mt-2 flex items-start justify-between gap-4">
<h1 className="text-3xl font-bold">{p.name}</h1>
<div className="flex items-center gap-3">
<HeaderLogo projectId={p.id} logoUrl={p.logoUrl} name={p.name} />
<h1 className="text-3xl font-bold">{p.name}</h1>
</div>
{isP1 && !p.archiviert && (
<Button variant="secondary" onClick={() => setAbschlussOpen(true)}>
Projekt abschließen
@@ -239,6 +243,64 @@ function ModusControl({ projectId, modus }: { projectId: string; modus: ProjectM
}
// --- Ziel & Maxime + SMART-Ziel, Nicht-Ziele, Liefergegenstände, Zieldreieck -
function HeaderLogo({
projectId,
logoUrl,
name,
}: {
projectId: string;
logoUrl: string | null;
name: string;
}) {
const utils = trpc.useUtils();
const [editing, setEditing] = useState(false);
const [draft, setDraft] = useState<string | null>(logoUrl);
const update = trpc.project.update.useMutation({
onSuccess: async () => {
toast(voice.toast.saved);
await utils.project.byId.invalidate({ id: projectId });
setEditing(false);
},
});
if (editing) {
return (
<div className="rounded-[var(--radius-md)] border border-[var(--color-border)] p-3">
<LogoUpload value={draft} name={name} onChange={setDraft} />
<div className="mt-2 flex justify-end gap-2">
<Button type="button" variant="ghost" size="sm" onClick={() => setEditing(false)}>
Abbrechen
</Button>
<Button
type="button"
size="sm"
disabled={update.isPending}
onClick={() => update.mutate({ projectId, logoUrl: draft })}
>
Speichern
</Button>
</div>
</div>
);
}
return (
<button
type="button"
onClick={() => {
setDraft(logoUrl);
setEditing(true);
}}
className="group relative shrink-0"
title="Logo ändern"
>
<ProjectLogo url={logoUrl} name={name} size={56} />
<span className="absolute inset-0 flex items-center justify-center rounded-[var(--radius-md)] bg-black/40 text-white opacity-0 transition-opacity group-hover:opacity-100">
<Pencil size={16} />
</span>
</button>
);
}
function ZielSection({ projectId, project: p }: { projectId: string; project: ProjectDetail }) {
const utils = trpc.useUtils();
const [editing, setEditing] = useState(false);