Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

fix(registry): wrap useRouteModal inside RouteFocusModal provider in vendor create pages

vholik96a6dd79cbb2
diff --git a/packages/registry/src/requests/vendor/pages/requests/categories/create/page.tsx b/packages/registry/src/requests/vendor/pages/requests/categories/create/page.tsx
index 0bc6b106a..89be18da5 100644
--- a/packages/registry/src/requests/vendor/pages/requests/categories/create/page.tsx
+++ b/packages/registry/src/requests/vendor/pages/requests/categories/create/page.tsx
@@ -27,7 +27,7 @@ const CreateCategoryRequestSchema = zod.object({
is_internal: zod.boolean().optional(),
});
-const CategoryRequestCreatePage = () => {
+const CategoryRequestCreateForm = () => {
const { t } = useTranslation();
const { handleSuccess } = useRouteModal();
@@ -59,141 +59,147 @@ const CategoryRequestCreatePage = () => {
});
return (
- <RouteFocusModal>
- <RouteFocusModal.Form form={form}>
- <form
- onSubmit={handleSubmit}
- className="flex h-full flex-col overflow-hidden"
- >
- <RouteFocusModal.Header />
- <RouteFocusModal.Body className="flex size-full flex-col items-center overflow-auto p-16">
- <div className="flex w-full max-w-[720px] flex-col gap-y-8">
- <div>
- <Heading>Request Category</Heading>
- <Text size="small" className="text-ui-fg-subtle">
- Submit a request to create a new product category.
- </Text>
- </div>
- <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
- <Form.Field
- control={form.control}
- name="name"
- render={({ field }) => (
- <Form.Item>
- <Form.Label>{t("fields.name")}</Form.Label>
- <Form.Control>
- <Input autoComplete="off" {...field} />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- )}
- />
- <Form.Field
- control={form.control}
- name="handle"
- render={({ field }) => (
- <Form.Item>
- <Form.Label optional>{t("fields.handle")}</Form.Label>
- <Form.Control>
- <Input autoComplete="off" {...field} />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- )}
- />
- <Form.Field
- control={form.control}
- name="description"
- render={({ field }) => (
- <Form.Item className="col-span-full">
- <Form.Label optional>
- {t("fields.description")}
- </Form.Label>
- <Form.Control>
- <Textarea {...field} />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- )}
- />
- <Form.Field
- control={form.control}
- name="is_active"
- render={({ field }) => (
- <Form.Item>
- <Form.Label>{t("fields.status")}</Form.Label>
- <Form.Control>
- <Select
- value={field.value ? "active" : "inactive"}
- onValueChange={(v) =>
- field.onChange(v === "active")
- }
- >
- <Select.Trigger>
- <Select.Value />
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="active">
- {t("categories.fields.status.active")}
- </Select.Item>
- <Select.Item value="inactive">
- {t("categories.fields.status.inactive")}
- </Select.Item>
- </Select.Content>
- </Select>
- </Form.Control>
- </Form.Item>
- )}
- />
- <Form.Field
- control={form.control}
- name="is_internal"
- render={({ field }) => (
- <Form.Item>
- <Form.Label>{t("fields.visibility")}</Form.Label>
- <Form.Control>
- <Select
- value={field.value ? "internal" : "public"}
- onValueChange={(v) =>
- field.onChange(v === "internal")
- }
- >
- <Select.Trigger>
- <Select.Value />
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="public">
- {t("categories.fields.visibility.public")}
- </Select.Item>
- <Select.Item value="internal">
- {t("categories.fields.visibility.internal")}
- </Select.Item>
- </Select.Content>
- </Select>
- </Form.Control>
- </Form.Item>
- )}
- />
- </div>
+ <RouteFocusModal.Form form={form}>
+ <form
+ onSubmit={handleSubmit}
+ className="flex h-full flex-col overflow-hidden"
+ >
+ <RouteFocusModal.Header />
+ <RouteFocusModal.Body className="flex size-full flex-col items-center overflow-auto p-16">
+ <div className="flex w-full max-w-[720px] flex-col gap-y-8">
+ <div>
+ <Heading>Request Category</Heading>
+ <Text size="small" className="text-ui-fg-subtle">
+ Submit a request to create a new product category.
+ </Text>
+ </div>
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <Form.Field
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>{t("fields.name")}</Form.Label>
+ <Form.Control>
+ <Input autoComplete="off" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="handle"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("fields.handle")}</Form.Label>
+ <Form.Control>
+ <Input autoComplete="off" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <Form.Item className="col-span-full">
+ <Form.Label optional>
+ {t("fields.description")}
+ </Form.Label>
+ <Form.Control>
+ <Textarea {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="is_active"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>{t("fields.status")}</Form.Label>
+ <Form.Control>
+ <Select
+ value={field.value ? "active" : "inactive"}
+ onValueChange={(v) =>
+ field.onChange(v === "active")
+ }
+ >
+ <Select.Trigger>
+ <Select.Value />
+ </Select.Trigger>
+ <Select.Content>
+ <Select.Item value="active">
+ {t("categories.fields.status.active")}
+ </Select.Item>
+ <Select.Item value="inactive">
+ {t("categories.fields.status.inactive")}
+ </Select.Item>
+ </Select.Content>
+ </Select>
+ </Form.Control>
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="is_internal"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>{t("fields.visibility")}</Form.Label>
+ <Form.Control>
+ <Select
+ value={field.value ? "internal" : "public"}
+ onValueChange={(v) =>
+ field.onChange(v === "internal")
+ }
+ >
+ <Select.Trigger>
+ <Select.Value />
+ </Select.Trigger>
+ <Select.Content>
+ <Select.Item value="public">
+ {t("categories.fields.visibility.public")}
+ </Select.Item>
+ <Select.Item value="internal">
+ {t("categories.fields.visibility.internal")}
+ </Select.Item>
+ </Select.Content>
+ </Select>
+ </Form.Control>
+ </Form.Item>
+ )}
+ />
</div>
- </RouteFocusModal.Body>
- <RouteFocusModal.Footer>
- <RouteFocusModal.Close asChild>
- <Button size="small" variant="secondary">
- {t("actions.cancel")}
- </Button>
- </RouteFocusModal.Close>
- <Button
- size="small"
- variant="primary"
- type="submit"
- isLoading={isPending}
- >
- {t("actions.create")}
+ </div>
+ </RouteFocusModal.Body>
+ <RouteFocusModal.Footer>
+ <RouteFocusModal.Close asChild>
+ <Button size="small" variant="secondary">
+ {t("actions.cancel")}
</Button>
- </RouteFocusModal.Footer>
- </form>
- </RouteFocusModal.Form>
+ </RouteFocusModal.Close>
+ <Button
+ size="small"
+ variant="primary"
+ type="submit"
+ isLoading={isPending}
+ >
+ {t("actions.create")}
+ </Button>
+ </RouteFocusModal.Footer>
+ </form>
+ </RouteFocusModal.Form>
+ );
+};
+
+const CategoryRequestCreatePage = () => {
+ return (
+ <RouteFocusModal>
+ <CategoryRequestCreateForm />
</RouteFocusModal>
);
};
diff --git a/packages/registry/src/requests/vendor/pages/requests/collections/create/page.tsx b/packages/registry/src/requests/vendor/pages/requests/collections/create/page.tsx
index 33a662eb7..6aa057abe 100644
--- a/packages/registry/src/requests/vendor/pages/requests/collections/create/page.tsx
+++ b/packages/registry/src/requests/vendor/pages/requests/collections/create/page.tsx
@@ -16,7 +16,7 @@ const CreateCollectionRequestSchema = zod.object({
handle: zod.string().optional(),
});
-const CollectionRequestCreatePage = () => {
+const CollectionRequestCreateForm = () => {
const { t } = useTranslation();
const { handleSuccess } = useRouteModal();
@@ -45,68 +45,74 @@ const CollectionRequestCreatePage = () => {
});
return (
- <RouteFocusModal>
- <RouteFocusModal.Form form={form}>
- <form
- onSubmit={handleSubmit}
- className="flex h-full flex-col overflow-hidden"
- >
- <RouteFocusModal.Header />
- <RouteFocusModal.Body className="flex size-full flex-col items-center p-16">
- <div className="flex w-full max-w-[720px] flex-col gap-y-8">
- <div>
- <Heading>Request Collection</Heading>
- <Text size="small" className="text-ui-fg-subtle">
- Submit a request to create a new product collection.
- </Text>
- </div>
- <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
- <Form.Field
- control={form.control}
- name="title"
- render={({ field }) => (
- <Form.Item>
- <Form.Label>{t("fields.title")}</Form.Label>
- <Form.Control>
- <Input autoComplete="off" {...field} />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- )}
- />
- <Form.Field
- control={form.control}
- name="handle"
- render={({ field }) => (
- <Form.Item>
- <Form.Label optional>{t("fields.handle")}</Form.Label>
- <Form.Control>
- <Input autoComplete="off" {...field} />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- )}
- />
- </div>
+ <RouteFocusModal.Form form={form}>
+ <form
+ onSubmit={handleSubmit}
+ className="flex h-full flex-col overflow-hidden"
+ >
+ <RouteFocusModal.Header />
+ <RouteFocusModal.Body className="flex size-full flex-col items-center p-16">
+ <div className="flex w-full max-w-[720px] flex-col gap-y-8">
+ <div>
+ <Heading>Request Collection</Heading>
+ <Text size="small" className="text-ui-fg-subtle">
+ Submit a request to create a new product collection.
+ </Text>
+ </div>
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <Form.Field
+ control={form.control}
+ name="title"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>{t("fields.title")}</Form.Label>
+ <Form.Control>
+ <Input autoComplete="off" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ <Form.Field
+ control={form.control}
+ name="handle"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>{t("fields.handle")}</Form.Label>
+ <Form.Control>
+ <Input autoComplete="off" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
</div>
- </RouteFocusModal.Body>
- <RouteFocusModal.Footer>
- <RouteFocusModal.Close asChild>
- <Button size="small" variant="secondary">
- {t("actions.cancel")}
- </Button>
- </RouteFocusModal.Close>
- <Button
- size="small"
- variant="primary"
- type="submit"
- isLoading={isPending}
- >
- {t("actions.create")}
+ </div>
+ </RouteFocusModal.Body>
+ <RouteFocusModal.Footer>
+ <RouteFocusModal.Close asChild>
+ <Button size="small" variant="secondary">
+ {t("actions.cancel")}
</Button>
- </RouteFocusModal.Footer>
- </form>
- </RouteFocusModal.Form>
+ </RouteFocusModal.Close>
+ <Button
+ size="small"
+ variant="primary"
+ type="submit"
+ isLoading={isPending}
+ >
+ {t("actions.create")}
+ </Button>
+ </RouteFocusModal.Footer>
+ </form>
+ </RouteFocusModal.Form>
+ );
+};
+
+const CollectionRequestCreatePage = () => {
+ return (
+ <RouteFocusModal>
+ <CollectionRequestCreateForm />
</RouteFocusModal>
);
};
diff --git a/packages/registry/src/requests/vendor/pages/requests/tags/create/page.tsx b/packages/registry/src/requests/vendor/pages/requests/tags/create/page.tsx
index f1a315af3..aaca1fee4 100644
--- a/packages/registry/src/requests/vendor/pages/requests/tags/create/page.tsx
+++ b/packages/registry/src/requests/vendor/pages/requests/tags/create/page.tsx
@@ -15,7 +15,7 @@ const CreateTagRequestSchema = zod.object({
value: zod.string().min(1),
});
-const TagRequestCreatePage = () => {
+const TagRequestCreateForm = () => {
const { t } = useTranslation();
const { handleSuccess } = useRouteModal();
@@ -41,57 +41,63 @@ const TagRequestCreatePage = () => {
});
return (
- <RouteFocusModal>
- <RouteFocusModal.Form form={form}>
- <form
- onSubmit={handleSubmit}
- className="flex h-full flex-col overflow-hidden"
- >
- <RouteFocusModal.Header />
- <RouteFocusModal.Body className="flex size-full flex-col items-center p-16">
- <div className="flex w-full max-w-[720px] flex-col gap-y-8">
- <div>
- <Heading>Request Tag</Heading>
- <Text size="small" className="text-ui-fg-subtle">
- Submit a request to create a new product tag.
- </Text>
- </div>
- <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
- <Form.Field
- control={form.control}
- name="value"
- render={({ field }) => (
- <Form.Item>
- <Form.Label>
- {t("productTags.fields.value")}
- </Form.Label>
- <Form.Control>
- <Input autoComplete="off" {...field} />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- )}
- />
- </div>
+ <RouteFocusModal.Form form={form}>
+ <form
+ onSubmit={handleSubmit}
+ className="flex h-full flex-col overflow-hidden"
+ >
+ <RouteFocusModal.Header />
+ <RouteFocusModal.Body className="flex size-full flex-col items-center p-16">
+ <div className="flex w-full max-w-[720px] flex-col gap-y-8">
+ <div>
+ <Heading>Request Tag</Heading>
+ <Text size="small" className="text-ui-fg-subtle">
+ Submit a request to create a new product tag.
+ </Text>
+ </div>
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <Form.Field
+ control={form.control}
+ name="value"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>
+ {t("productTags.fields.value")}
+ </Form.Label>
+ <Form.Control>
+ <Input autoComplete="off" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
</div>
- </RouteFocusModal.Body>
- <RouteFocusModal.Footer>
- <RouteFocusModal.Close asChild>
- <Button size="small" variant="secondary">
- {t("actions.cancel")}
- </Button>
- </RouteFocusModal.Close>
- <Button
- size="small"
- variant="primary"
- type="submit"
- isLoading={isPending}
- >
- {t("actions.create")}
+ </div>
+ </RouteFocusModal.Body>
+ <RouteFocusModal.Footer>
+ <RouteFocusModal.Close asChild>
+ <Button size="small" variant="secondary">
+ {t("actions.cancel")}
</Button>
- </RouteFocusModal.Footer>
- </form>
- </RouteFocusModal.Form>
+ </RouteFocusModal.Close>
+ <Button
+ size="small"
+ variant="primary"
+ type="submit"
+ isLoading={isPending}
+ >
+ {t("actions.create")}
+ </Button>
+ </RouteFocusModal.Footer>
+ </form>
+ </RouteFocusModal.Form>
+ );
+};
+
+const TagRequestCreatePage = () => {
+ return (
+ <RouteFocusModal>
+ <TagRequestCreateForm />
</RouteFocusModal>
);
};
diff --git a/packages/registry/src/requests/vendor/pages/requests/types/create/page.tsx b/packages/registry/src/requests/vendor/pages/requests/types/create/page.tsx
index 8f7c942f3..189809182 100644
--- a/packages/registry/src/requests/vendor/pages/requests/types/create/page.tsx
+++ b/packages/registry/src/requests/vendor/pages/requests/types/create/page.tsx
@@ -15,7 +15,7 @@ const CreateTypeRequestSchema = zod.object({
value: zod.string().min(1),
});
-const TypeRequestCreatePage = () => {
+const TypeRequestCreateForm = () => {
const { t } = useTranslation();
const { handleSuccess } = useRouteModal();
@@ -41,57 +41,63 @@ const TypeRequestCreatePage = () => {
});
return (
- <RouteFocusModal>
- <RouteFocusModal.Form form={form}>
- <form
- onSubmit={handleSubmit}
- className="flex h-full flex-col overflow-hidden"
- >
- <RouteFocusModal.Header />
- <RouteFocusModal.Body className="flex size-full flex-col items-center p-16">
- <div className="flex w-full max-w-[720px] flex-col gap-y-8">
- <div>
- <Heading>Request Type</Heading>
- <Text size="small" className="text-ui-fg-subtle">
- Submit a request to create a new product type.
- </Text>
- </div>
- <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
- <Form.Field
- control={form.control}
- name="value"
- render={({ field }) => (
- <Form.Item>
- <Form.Label>
- {t("productTypes.fields.value")}
- </Form.Label>
- <Form.Control>
- <Input autoComplete="off" {...field} />
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- )}
- />
- </div>
+ <RouteFocusModal.Form form={form}>
+ <form
+ onSubmit={handleSubmit}
+ className="flex h-full flex-col overflow-hidden"
+ >
+ <RouteFocusModal.Header />
+ <RouteFocusModal.Body className="flex size-full flex-col items-center p-16">
+ <div className="flex w-full max-w-[720px] flex-col gap-y-8">
+ <div>
+ <Heading>Request Type</Heading>
+ <Text size="small" className="text-ui-fg-subtle">
+ Submit a request to create a new product type.
+ </Text>
+ </div>
+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <Form.Field
+ control={form.control}
+ name="value"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label>
+ {t("productTypes.fields.value")}
+ </Form.Label>
+ <Form.Control>
+ <Input autoComplete="off" {...field} />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
</div>
- </RouteFocusModal.Body>
- <RouteFocusModal.Footer>
- <RouteFocusModal.Close asChild>
- <Button size="small" variant="secondary">
- {t("actions.cancel")}
- </Button>
- </RouteFocusModal.Close>
- <Button
- size="small"
- variant="primary"
- type="submit"
- isLoading={isPending}
- >
- {t("actions.create")}
+ </div>
+ </RouteFocusModal.Body>
+ <RouteFocusModal.Footer>
+ <RouteFocusModal.Close asChild>
+ <Button size="small" variant="secondary">
+ {t("actions.cancel")}
</Button>
- </RouteFocusModal.Footer>
- </form>
- </RouteFocusModal.Form>
+ </RouteFocusModal.Close>
+ <Button
+ size="small"
+ variant="primary"
+ type="submit"
+ isLoading={isPending}
+ >
+ {t("actions.create")}
+ </Button>
+ </RouteFocusModal.Footer>
+ </form>
+ </RouteFocusModal.Form>
+ );
+};
+
+const TypeRequestCreatePage = () => {
+ return (
+ <RouteFocusModal>
+ <TypeRequestCreateForm />
</RouteFocusModal>
);
};