feat(editor): home navigation and edit-infos dialog
Header now exposes a back button and clickable brand title both linking to /. New "Modifier les infos" button opens a dialog that edits practitioner, animal, and owner via the existing forms with cancel/save and required-name validation. Save also refreshes the practitioner localStorage cache. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
1280f9feb8
commit
908790123d
2 files changed
+120
-7
No files matched your search
@@ -1,20 +1,47 @@
|
||||
import { Link, useNavigate } from 'react-router-dom'
|
||||
import type { Report } from '@/domain/schema/report'
|
||||
import Brand from '@/components/brand/Brand'
|
||||
import Button from '@/components/ui/Button'
|
||||
import { formatDateFr } from '@/lib/dates'
|
||||
|
||||
export interface ReportHeaderProps {
|
||||
report: Report
|
||||
onEditInfos?: () => void
|
||||
}
|
||||
|
||||
export default function ReportHeader({ report }: ReportHeaderProps) {
|
||||
export default function ReportHeader({ report, onEditInfos }: ReportHeaderProps) {
|
||||
const navigate = useNavigate()
|
||||
return (
|
||||
<header className="flex items-center justify-between gap-4 px-6 py-3 border-b border-[var(--color-border)] bg-[var(--color-surface)]">
|
||||
<Brand />
|
||||
<div className="text-sm text-right text-[var(--color-ink-muted)]">
|
||||
<div className="text-[var(--color-ink)] font-medium">
|
||||
{report.animal.name} · {report.owner.name}
|
||||
<div className="flex items-center gap-3">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => navigate('/')}
|
||||
aria-label="Retour à l'accueil"
|
||||
>
|
||||
← Accueil
|
||||
</Button>
|
||||
<Link
|
||||
to="/"
|
||||
aria-label="Retour à l'accueil"
|
||||
className="rounded-md px-1 py-0.5 hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)]"
|
||||
>
|
||||
<Brand />
|
||||
</Link>
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="text-sm text-right text-[var(--color-ink-muted)]">
|
||||
<div className="text-[var(--color-ink)] font-medium">
|
||||
{report.animal.name} · {report.owner.name}
|
||||
</div>
|
||||
<div>{formatDateFr(report.date)}</div>
|
||||
</div>
|
||||
<div>{formatDateFr(report.date)}</div>
|
||||
{onEditInfos && (
|
||||
<Button variant="secondary" size="sm" onClick={onEditInfos}>
|
||||
Modifier les infos
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user