edit org label

This commit is contained in:
Fred KISSIE
2026-05-18 22:14:49 +02:00
parent 25c08e7279
commit 7968c4357b
5 changed files with 136 additions and 5 deletions

View File

@@ -34,9 +34,10 @@ export type LabelFormData = z.infer<typeof labelFormSchema>;
export type OrgLabelFormProps = {
onSubmit: (data: LabelFormData) => void;
defaultValue?: LabelFormData;
};
export function OrgLabelForm({ onSubmit }: OrgLabelFormProps) {
export function OrgLabelForm({ onSubmit, defaultValue }: OrgLabelFormProps) {
const t = useTranslations();
const colorValues = Object.values(LABEL_COLORS);
@@ -46,8 +47,8 @@ export function OrgLabelForm({ onSubmit }: OrgLabelFormProps) {
const form = useForm({
resolver: zodResolver(labelFormSchema),
defaultValues: {
name: "",
color: randomColor
name: defaultValue?.name ?? "",
color: defaultValue?.color ?? randomColor
}
});