Hero: planning en hero-brede aan/uit verwijderd (hero altijd aan, live zodra er een titel is); migratie, API, admin, tests en docs bijgewerkt
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,7 @@ import { SortableSlide } from '../components/SortableSlide';
|
||||
import { UnsavedChangesGuard } from '../components/UnsavedChangesGuard';
|
||||
import { UploadProgress, type UploadItem } from '../components/UploadProgress';
|
||||
import { mediaUrl } from '../lib/media';
|
||||
import { fromLocalInput, heroFormSchema, toLocalInput, type HeroFormData } from '../schemas/hero';
|
||||
import { heroFormSchema, type HeroFormData } from '../schemas/hero';
|
||||
import { heroImageQuery, useHero, useHeroUploadLimits, useSaveHero, useUploadHeroImage } from '../services/hooks';
|
||||
import type { HeroAdminDto, HeroFocusRequest, HeroImageDto, HeroSaveRequest } from '../services/types';
|
||||
|
||||
@@ -37,9 +37,6 @@ function toForm(hero: HeroAdminDto): HeroFormData {
|
||||
lead: hero.lead ?? '',
|
||||
display: hero.display,
|
||||
buttons,
|
||||
isActive: hero.isActive,
|
||||
startsAt: toLocalInput(hero.startsAt),
|
||||
endsAt: toLocalInput(hero.endsAt),
|
||||
slides: hero.slides.map((s) => ({ id: s.id, imageId: s.imageId, alt: s.alt, decorative: s.decorative, isActive: s.isActive })),
|
||||
};
|
||||
}
|
||||
@@ -51,9 +48,6 @@ function toRequest(values: HeroFormData, focusEdits: Record<string, HeroFocusReq
|
||||
lead: values.lead || null,
|
||||
display: values.display,
|
||||
buttons: values.buttons.filter((b) => b.label !== '' && b.target !== ''),
|
||||
isActive: values.isActive,
|
||||
startsAt: fromLocalInput(values.startsAt),
|
||||
endsAt: fromLocalInput(values.endsAt),
|
||||
slides: values.slides.map((s) => ({ id: s.id, imageId: s.imageId, alt: s.decorative ? null : s.alt, decorative: s.decorative, isActive: s.isActive })),
|
||||
imageFocus: Object.entries(focusEdits).map(([imageId, edit]) => ({ imageId, ...edit })),
|
||||
};
|
||||
@@ -117,7 +111,7 @@ export function HeroPage() {
|
||||
<details className="max-w-3xl rounded-md border p-3 text-sm" data-testid="hero-help">
|
||||
<summary className="cursor-pointer font-medium">{t('hero.help.heading')}</summary>
|
||||
<dl className="mt-3 space-y-2">
|
||||
{(['title', 'tagline', 'lead', 'buttons', 'display', 'slides', 'focus', 'schedule'] as const).map((key) => (
|
||||
{(['title', 'tagline', 'lead', 'buttons', 'display', 'slides', 'focus'] as const).map((key) => (
|
||||
<div key={key}>
|
||||
<dt className="font-medium">{t(`hero.help.${key}.name`)}</dt>
|
||||
<dd className="text-muted-foreground">{t(`hero.help.${key}.text`)}</dd>
|
||||
@@ -387,26 +381,6 @@ function HeroEditor({ hero }: { hero: HeroAdminDto }) {
|
||||
))}
|
||||
</section>
|
||||
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-lg font-medium">{t('hero.schedule.title')}</h2>
|
||||
<label className="flex items-center gap-2 text-sm">
|
||||
<input type="checkbox" className="size-4 rounded border-input" data-testid="hero-active" {...register('isActive')} />
|
||||
{t('hero.schedule.active')}
|
||||
</label>
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
<div className="space-y-1">
|
||||
<Label htmlFor="hero-starts">{t('hero.schedule.starts')}</Label>
|
||||
<Input id="hero-starts" type="datetime-local" data-testid="hero-starts" {...register('startsAt')} />
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label htmlFor="hero-ends">{t('hero.schedule.ends')}</Label>
|
||||
<Input id="hero-ends" type="datetime-local" data-testid="hero-ends" {...register('endsAt')} />
|
||||
<FieldError message={err(heroErrors.endsAt?.message)} testId="hero-ends-error" />
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">{t('hero.schedule.hint')}</p>
|
||||
</section>
|
||||
|
||||
<section
|
||||
className={`space-y-3 rounded-md ${draggingFiles ? 'ring-2 ring-primary ring-offset-4' : ''}`}
|
||||
onDragOver={(event) => {
|
||||
|
||||
Reference in New Issue
Block a user