diff --git a/i18n/en.pot b/i18n/en.pot index 1225553..4104159 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2026-06-02T09:10:34.358Z\n" -"PO-Revision-Date: 2026-06-02T09:10:34.359Z\n" +"POT-Creation-Date: 2026-08-19T10:07:50.833Z\n" +"PO-Revision-Date: 2026-08-19T10:07:50.834Z\n" msgid "Data store keys created!" msgstr "Data store keys created!" @@ -449,6 +449,12 @@ msgstr "Remove plugin" msgid "Validation Error" msgstr "Validation Error" +msgid "Could not fetch the latest fields. Please try again." +msgstr "Could not fetch the latest fields. Please try again." + +msgid "Update fields order" +msgstr "Update fields order" + msgid "All fields you add here will be shown in the form" msgstr "All fields you add here will be shown in the form" diff --git a/src/components/Pages/FormFieldConfigurator/FormController/FormController.tsx b/src/components/Pages/FormFieldConfigurator/FormController/FormController.tsx index c0c6101..88a72d9 100644 --- a/src/components/Pages/FormFieldConfigurator/FormController/FormController.tsx +++ b/src/components/Pages/FormFieldConfigurator/FormController/FormController.tsx @@ -20,6 +20,8 @@ type Props = { formFieldId: string, apps: Array> existingFormFieldConfig: FormFieldRecord | null | undefined, + refetchMetadata: () => Promise<{ data?: z.infer }>, + isRefetchingMetadata: boolean, } const ValidationErrorToast = ({ errorMessage }: { errorMessage: string }) => { @@ -33,7 +35,7 @@ const ValidationErrorToast = ({ errorMessage }: { errorMessage: string }) => { ) } -export const FormController = ({ metadata, formFieldId, apps, existingFormFieldConfig }: Props) => { +export const FormController = ({ metadata, formFieldId, apps, existingFormFieldConfig, refetchMetadata, isRefetchingMetadata }: Props) => { const availablePlugins = useMemo(() => { const filteredApps = apps.filter(app => app.pluginLaunchUrl); @@ -53,8 +55,18 @@ export const FormController = ({ metadata, formFieldId, apps, existingFormFieldC onAddPlugin, onRemovePlugin, existingPluginConfigs, + updateFieldsOrder, } = useFormFieldController({ metadata, availablePlugins, existingFormFieldConfig }); + const handleUpdateFieldsOrder = async () => { + const { data: freshMetadata } = await refetchMetadata(); + if (!freshMetadata) { + toast.error(i18n.t('Could not fetch the latest fields. Please try again.')); + return; + } + updateFieldsOrder(freshMetadata); + } + const { pluginConfigurations, addPluginConfiguration, @@ -79,6 +91,14 @@ export const FormController = ({ metadata, formFieldId, apps, existingFormFieldC plugins={availablePlugins} onAddPlugin={onAddPlugin} /> +