feat: add AR page layout switches to the project form

This commit is contained in:
rajun 2026-10-27 16:28:51 +05:30
parent 8f06ed3043
commit f852782c6c

View File

@ -0,0 +1,32 @@
import { useId } from 'react';
import { useFormContext, useWatch } from 'react-hook-form';
import { SwitchRow } from '~/components/ui/switch-row';
import { Text } from '~/components/ui/text';
import { AR_PAGE_TOGGLES } from '~/data/projects/constants';
import type { ProjectFormValues } from '~/schemas/projects/project-form';
// What the client's AR page shows around the model
export function ArPageFields() {
const headingId = useId();
const { control, setValue } = useFormContext<ProjectFormValues>();
const arPage = useWatch({ control, name: 'arPage' });
return (
<div role='group' aria-labelledby={headingId} className='flex flex-col gap-2'>
<Text as='span' id={headingId} variant='label'>
AR page
</Text>
{AR_PAGE_TOGGLES.map(({ key, label, hint }) => (
<SwitchRow
key={key}
framed
id={`ar-page-${key}`}
label={label}
hint={hint}
checked={arPage[key]}
onCheckedChange={(checked) => setValue(`arPage.${key}`, checked, { shouldDirty: true })}
/>
))}
</div>
);
}