"use client"; import { MachinesSelector } from "@app/components/machines-selector"; import { RolesSelector } from "@app/components/roles-selector"; import { UsersSelector } from "@app/components/users-selector"; import { SettingsFormCell, SettingsFormGrid } from "@app/components/Settings"; import type { Tag } from "@app/components/tags/tag-input"; import { FormControl, FormField, FormItem, FormLabel, FormMessage } from "@app/components/ui/form"; import type { PrivateResourceClient } from "@app/lib/privateResourceForm"; import { useTranslations } from "next-intl"; import type { Control } from "react-hook-form"; type AccessFormValues = { roles?: Tag[]; users?: Tag[]; clients?: PrivateResourceClient[]; }; type PrivateResourceAccessFieldsProps = { control: Control; orgId: string; loading?: boolean; hasMachineClients?: boolean; }; export function PrivateResourceAccessFields({ control, orgId, loading = false, hasMachineClients = false }: PrivateResourceAccessFieldsProps) { const t = useTranslations(); if (loading) { return (
{t("loading")}
); } return ( ( {t("roles")} { field.onChange(newRoles); }} /> )} /> ( {t("users")} { field.onChange(newUsers); }} /> )} /> {hasMachineClients && ( ( {t("machineClients")} { field.onChange(machines); }} /> )} /> )} ); }