diff --git a/app/components/assets/form/project-select-field.tsx b/app/components/assets/form/project-select-field.tsx new file mode 100644 index 0000000..d050792 --- /dev/null +++ b/app/components/assets/form/project-select-field.tsx @@ -0,0 +1,35 @@ +import { useFormContext, useWatch } from 'react-hook-form'; +import { ClientLogo } from '~/components/ui/client-logo'; +import { Field } from '~/components/ui/field'; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '~/components/ui/select'; +import { NO_PROJECT } from '~/data/assets/constants'; +import { useAdminData } from '~/hooks/admin/use-admin-data'; +import type { AssetFormValues } from '~/schemas/assets/asset-form'; +import { toBrand } from '~/services/asset-media'; + +export function ProjectSelectField() { + const { projects } = useAdminData(); + const { control, setValue } = useFormContext(); + const value = useWatch({ control, name: 'project' }); + // Archived projects are only listed when the asset already belongs to one + const options = projects.filter((project) => project.status === 'active' || project.id === value); + + return ( + + + + ); +}