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.

feat(admin): restructure seller detail page with two-column layout

vholikf4e7508f2a9a
diff --git a/packages/admin/src/get-route-map.tsx b/packages/admin/src/get-route-map.tsx
index eac9d660b..0034ba238 100644
--- a/packages/admin/src/get-route-map.tsx
+++ b/packages/admin/src/get-route-map.tsx
@@ -768,6 +768,11 @@ export function getRouteMap({
path: "edit",
lazy: () => import("./pages/sellers/seller-edit"),
},
+ {
+ path: "edit-address",
+ lazy: () =>
+ import("./pages/sellers/seller-address-edit"),
+ },
],
},
],
diff --git a/packages/admin/src/pages/sellers/seller-address-edit/components/seller-address-edit-form.tsx b/packages/admin/src/pages/sellers/seller-address-edit/components/seller-address-edit-form.tsx
new file mode 100644
index 000000000..f1396c1b7
--- /dev/null
+++ b/packages/admin/src/pages/sellers/seller-address-edit/components/seller-address-edit-form.tsx
@@ -0,0 +1,210 @@
+import { Button, Input, toast } from "@medusajs/ui";
+
+import { zodResolver } from "@hookform/resolvers/zod";
+import { useForm } from "react-hook-form";
+import { useTranslation } from "react-i18next";
+import { z } from "zod";
+
+import { Form } from "@components/common/form";
+import { RouteDrawer, useRouteModal } from "@components/modals";
+import { KeyboundForm } from "@components/utilities/keybound-form";
+
+import { useUpdateSeller } from "@hooks/api/sellers";
+import { HttpTypes } from "@mercurjs/types";
+
+type SellerAddressEditFormProps = {
+ seller: HttpTypes.AdminSellerResponse["seller"];
+};
+
+const SellerAddressEditSchema = z.object({
+ address_1: z.string().optional(),
+ address_2: z.string().optional(),
+ city: z.string().optional(),
+ province: z.string().optional(),
+ country_code: z.string().optional(),
+ postal_code: z.string().optional(),
+});
+
+export const SellerAddressEditForm = ({
+ seller,
+}: SellerAddressEditFormProps) => {
+ const { t } = useTranslation();
+ const { handleSuccess } = useRouteModal();
+
+ const form = useForm<z.infer<typeof SellerAddressEditSchema>>({
+ defaultValues: {
+ address_1: seller?.address_1 || undefined,
+ address_2: seller?.address_2 || undefined,
+ city: seller?.city || undefined,
+ province: seller?.province || undefined,
+ country_code: seller?.country_code || undefined,
+ postal_code: seller?.postal_code || undefined,
+ },
+ resolver: zodResolver(SellerAddressEditSchema),
+ });
+
+ const { mutateAsync, isPending } = useUpdateSeller(seller.id);
+
+ const handleSubmit = form.handleSubmit(async (data) => {
+ await mutateAsync(data, {
+ onSuccess: () => {
+ toast.success(
+ t("sellers.edit.successToast", {
+ name: seller.name ?? seller.email,
+ }),
+ );
+
+ handleSuccess(`/sellers/${seller.id}`);
+ },
+ onError: (error) => {
+ toast.error(error.message);
+ },
+ });
+ });
+
+ return (
+ <RouteDrawer.Form form={form}>
+ <KeyboundForm
+ onSubmit={handleSubmit}
+ className="flex flex-1 flex-col overflow-hidden"
+ >
+ <RouteDrawer.Body className="overflow-y-auto">
+ <div className="flex flex-col gap-y-4">
+ <Form.Field
+ control={form.control}
+ name="address_1"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("sellers.fields.address_1")}
+ </Form.Label>
+ <Form.Control>
+ <Input
+ placeholder={t("sellers.fields.address_1")}
+ {...field}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="address_2"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("sellers.fields.address_2")}
+ </Form.Label>
+ <Form.Control>
+ <Input
+ placeholder={t("sellers.fields.address_2")}
+ {...field}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="city"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("sellers.fields.city")}
+ </Form.Label>
+ <Form.Control>
+ <Input
+ placeholder={t("sellers.fields.city")}
+ {...field}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="province"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("sellers.fields.province")}
+ </Form.Label>
+ <Form.Control>
+ <Input
+ placeholder={t("sellers.fields.province")}
+ {...field}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="postal_code"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("sellers.fields.postal_code")}
+ </Form.Label>
+ <Form.Control>
+ <Input
+ placeholder={t("sellers.fields.postal_code")}
+ {...field}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+
+ <Form.Field
+ control={form.control}
+ name="country_code"
+ render={({ field }) => (
+ <Form.Item>
+ <Form.Label optional>
+ {t("sellers.fields.country_code")}
+ </Form.Label>
+ <Form.Control>
+ <Input
+ placeholder={t("sellers.fields.country_code")}
+ {...field}
+ />
+ </Form.Control>
+ <Form.ErrorMessage />
+ </Form.Item>
+ )}
+ />
+ </div>
+ </RouteDrawer.Body>
+
+ <RouteDrawer.Footer>
+ <div className="flex items-center justify-end gap-x-2">
+ <RouteDrawer.Close asChild>
+ <Button variant="secondary" size="small">
+ {t("actions.cancel")}
+ </Button>
+ </RouteDrawer.Close>
+
+ <Button
+ isLoading={isPending}
+ type="submit"
+ variant="primary"
+ size="small"
+ >
+ {t("actions.save")}
+ </Button>
+ </div>
+ </RouteDrawer.Footer>
+ </KeyboundForm>
+ </RouteDrawer.Form>
+ );
+};
diff --git a/packages/admin/src/pages/sellers/seller-address-edit/index.ts b/packages/admin/src/pages/sellers/seller-address-edit/index.ts
new file mode 100644
index 000000000..36360dedc
--- /dev/null
+++ b/packages/admin/src/pages/sellers/seller-address-edit/index.ts
@@ -0,0 +1 @@
+export { SellerAddressEdit as Component } from "./seller-address-edit";
diff --git a/packages/admin/src/pages/sellers/seller-address-edit/seller-address-edit.tsx b/packages/admin/src/pages/sellers/seller-address-edit/seller-address-edit.tsx
new file mode 100644
index 000000000..04065e4e8
--- /dev/null
+++ b/packages/admin/src/pages/sellers/seller-address-edit/seller-address-edit.tsx
@@ -0,0 +1,29 @@
+import { Heading } from "@medusajs/ui";
+import { useTranslation } from "react-i18next";
+import { useParams } from "react-router-dom";
+
+import { RouteDrawer } from "../../../components/modals";
+import { useSeller } from "../../../hooks/api/sellers";
+import { SellerAddressEditForm } from "./components/seller-address-edit-form";
+
+export const SellerAddressEdit = () => {
+ const { id } = useParams();
+ const { t } = useTranslation();
+
+ const { seller, isLoading, isError, error } = useSeller(id!);
+
+ if (isError) {
+ throw error;
+ }
+
+ return (
+ <RouteDrawer>
+ <RouteDrawer.Header>
+ <RouteDrawer.Title asChild>
+ <Heading>{t("addresses.title")}</Heading>
+ </RouteDrawer.Title>
+ </RouteDrawer.Header>
+ {!isLoading && seller && <SellerAddressEditForm seller={seller} />}
+ </RouteDrawer>
+ );
+};
diff --git a/packages/admin/src/pages/sellers/seller-details/components/seller-address-section.tsx b/packages/admin/src/pages/sellers/seller-details/components/seller-address-section.tsx
new file mode 100644
index 000000000..6f8b65bb3
--- /dev/null
+++ b/packages/admin/src/pages/sellers/seller-details/components/seller-address-section.tsx
@@ -0,0 +1,89 @@
+import { PencilSquare } from "@medusajs/icons"
+import { Container, Heading, Text } from "@medusajs/ui"
+import { useTranslation } from "react-i18next"
+
+import { InferClientOutput } from "@mercurjs/client"
+import { sdk } from "@lib/client"
+
+import { ActionMenu } from "../../../../components/common/action-menu"
+
+type Seller = InferClientOutput<typeof sdk.admin.sellers.$id.query>["seller"]
+
+type SellerAddressSectionProps = {
+ seller: Seller
+}
+
+export const SellerAddressSection = ({
+ seller,
+}: SellerAddressSectionProps) => {
+ const { t } = useTranslation()
+
+ return (
+ <Container className="divide-y p-0">
+ <div className="flex items-center justify-between px-6 py-4">
+ <Heading level="h2">{t("addresses.title")}</Heading>
+ <ActionMenu
+ groups={[
+ {
+ actions: [
+ {
+ label: t("actions.edit"),
+ to: `/sellers/${seller.id}/edit-address`,
+ icon: <PencilSquare />,
+ },
+ ],
+ },
+ ]}
+ />
+ </div>
+ <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
+ <Text size="small" leading="compact" weight="plus">
+ {t("sellers.fields.address_1")}
+ </Text>
+ <Text size="small" leading="compact">
+ {seller.address_1 || "-"}
+ </Text>
+ </div>
+ <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
+ <Text size="small" leading="compact" weight="plus">
+ {t("sellers.fields.address_2")}
+ </Text>
+ <Text size="small" leading="compact">
+ {seller.address_2 || "-"}
+ </Text>
+ </div>
+ <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
+ <Text size="small" leading="compact" weight="plus">
+ {t("sellers.fields.city")}
+ </Text>
+ <Text size="small" leading="compact">
+ {seller.city || "-"}
+ </Text>
+ </div>
+ <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
+ <Text size="small" leading="compact" weight="plus">
+ {t("sellers.fields.province")}
+ </Text>
+ <Text size="small" leading="compact">
+ {seller.province || "-"}
+ </Text>
+ </div>
+ <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
+ <Text size="small" leading="compact" weight="plus">
+ {t("sellers.fields.postal_code")}
+ </Text>
+ <Text size="small" leading="compact">
+ {seller.postal_code || "-"}
+ </Text>
+ </div>
+ <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
+ <Text size="small" leading="compact" weight="plus">
+ {t("sellers.fields.country_code")}
+ </Text>
+ <Text size="small" leading="compact">
+ {seller.country_code || "-"}
+ </Text>
+ </div>
+ </Container>
+ )
+}
diff --git a/packages/admin/src/pages/sellers/seller-details/components/seller-details.tsx b/packages/admin/src/pages/sellers/seller-details/components/seller-details.tsx
index 74ec7ed79..e45ccd301 100644
--- a/packages/admin/src/pages/sellers/seller-details/components/seller-details.tsx
+++ b/packages/admin/src/pages/sellers/seller-details/components/seller-details.tsx
@@ -1,9 +1,10 @@
import { useParams } from "react-router-dom"
import { SingleColumnPageSkeleton } from "../../../../components/common/skeleton"
-import { SingleColumnPage } from "../../../../components/layout/pages"
+import { TwoColumnPage } from "../../../../components/layout/pages"
import { useSeller } from "@/hooks/api"
import { SellerGeneralSection } from "./seller-general-section"
+import { SellerAddressSection } from "./seller-address-section"
import { SellerOrderSection } from "./seller-order-section"
import { SellerProductSection } from "./seller-product-section"
@@ -21,15 +22,20 @@ export const SellerDetails = () => {
}
return (
- <SingleColumnPage
+ <TwoColumnPage
data={seller}
hasOutlet
showJSON
showMetadata
>
- <SellerGeneralSection seller={seller} />
- <SellerOrderSection sellerId={seller.id} />
- <SellerProductSection sellerId={seller.id} />
- </SingleColumnPage>
+ <TwoColumnPage.Main>
+ <SellerGeneralSection seller={seller} />
+ <SellerOrderSection sellerId={seller.id} />
+ <SellerProductSection sellerId={seller.id} />
+ </TwoColumnPage.Main>
+ <TwoColumnPage.Sidebar>
+ <SellerAddressSection seller={seller} />
+ </TwoColumnPage.Sidebar>
+ </TwoColumnPage>
)
}
diff --git a/packages/admin/src/pages/sellers/seller-details/components/seller-general-section.tsx b/packages/admin/src/pages/sellers/seller-details/components/seller-general-section.tsx
index 626910cb0..61f6fe5e0 100644
--- a/packages/admin/src/pages/sellers/seller-details/components/seller-general-section.tsx
+++ b/packages/admin/src/pages/sellers/seller-details/components/seller-general-section.tsx
@@ -182,54 +182,6 @@ export const SellerGeneralSection = ({
{seller.phone || "-"}
</Text>
</div>
- <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
- <Text size="small" leading="compact" weight="plus">
- {t("sellers.fields.address_1")}
- </Text>
- <Text size="small" leading="compact">
- {seller.address_1 || "-"}
- </Text>
- </div>
- <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
- <Text size="small" leading="compact" weight="plus">
- {t("sellers.fields.address_2")}
- </Text>
- <Text size="small" leading="compact">
- {seller.address_2 || "-"}
- </Text>
- </div>
- <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
- <Text size="small" leading="compact" weight="plus">
- {t("sellers.fields.city")}
- </Text>
- <Text size="small" leading="compact">
- {seller.city || "-"}
- </Text>
- </div>
- <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
- <Text size="small" leading="compact" weight="plus">
- {t("sellers.fields.province")}
- </Text>
- <Text size="small" leading="compact">
- {seller.province || "-"}
- </Text>
- </div>
- <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
- <Text size="small" leading="compact" weight="plus">
- {t("sellers.fields.postal_code")}
- </Text>
- <Text size="small" leading="compact">
- {seller.postal_code || "-"}
- </Text>
- </div>
- <div className="text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4">
- <Text size="small" leading="compact" weight="plus">
- {t("sellers.fields.country_code")}
- </Text>
- <Text size="small" leading="compact">
- {seller.country_code || "-"}
- </Text>
- </div>
</Container>
)
}
diff --git a/packages/admin/src/pages/sellers/seller-details/components/seller-order-section.tsx b/packages/admin/src/pages/sellers/seller-details/components/seller-order-section.tsx
index 84ba1bc1d..46931362a 100644
--- a/packages/admin/src/pages/sellers/seller-details/components/seller-order-section.tsx
+++ b/packages/admin/src/pages/sellers/seller-details/components/seller-order-section.tsx
@@ -1,95 +1,42 @@
-import { useMemo } from "react";
-
-import type { AdminOrder } from "@medusajs/types";
-import { Badge, Container, Heading } from "@medusajs/ui";
-import { keepPreviousData } from "@tanstack/react-query";
-import { createColumnHelper } from "@tanstack/react-table";
-import { useTranslation } from "react-i18next";
-
-import { DateCell } from "@components/table/table-cells/common/date-cell";
-import { _DataTable } from "@components/table/data-table";
-
-import { useOrders } from "../../../../hooks/api/orders";
-import { useOrderTableFilters } from "@hooks/table/filters";
-import { useOrderTableQuery } from "@hooks/table/query";
-import { useDataTable } from "@hooks/use-data-table";
-import { getStylizedAmount } from "@lib/money-amount-helpers";
-
-const PAGE_SIZE = 10;
-const PREFIX = "selord";
+import { Container, Heading } from "@medusajs/ui"
+import { keepPreviousData } from "@tanstack/react-query"
+import { useMemo } from "react"
+import { useTranslation } from "react-i18next"
+
+import { _DataTable } from "../../../../components/table/data-table"
+import { useOrders } from "../../../../hooks/api/orders"
+import { useOrderTableColumns } from "../../../../hooks/table/columns/use-order-table-columns"
+import { useOrderTableFilters } from "../../../../hooks/table/filters"
+import { useOrderTableQuery } from "../../../../hooks/table/query"
+import { useDataTable } from "../../../../hooks/use-data-table"
+
+const PAGE_SIZE = 10
+const PREFIX = "selord"
+const DEFAULT_RELATIONS = "*customer,*items,*sales_channel"
const DEFAULT_FIELDS =
- "id,status,display_id,created_at,email,fulfillment_status,payment_status,total,currency_code,*customer";
-
-const getOrderStatusBadgeColor = (status: string) => {
- const colors: Record<string, "orange" | "green" | "red" | "grey"> = {
- pending: "orange",
- completed: "green",
- canceled: "red",
- archived: "grey",
- requires_action: "orange",
- draft: "grey",
- };
- return colors[status] || "grey";
-};
-
-const getPaymentStatusBadgeColor = (status: string) => {
- const colors: Record<string, "orange" | "green" | "red" | "blue" | "grey"> = {
- captured: "green",
- paid: "green",
- partially_captured: "orange",
- awaiting: "orange",
- authorized: "blue",
- partially_authorized: "blue",
- pending: "orange",
- refunded: "red",
- partially_refunded: "orange",
- canceled: "red",
- not_paid: "grey",
- requires_action: "orange",
- };
- return colors[status] || "grey";
-};
-
-const getFulfillmentStatusBadgeColor = (status: string) => {
- const colors: Record<string, "orange" | "green" | "red" | "grey"> = {
- fulfilled: "green",
- shipped: "green",
- delivered: "green",
- partially_fulfilled: "orange",
- partially_shipped: "orange",
- partially_delivered: "orange",
- not_fulfilled: "grey",
- canceled: "red",
- returned: "red",
- partially_returned: "orange",
- requires_action: "orange",
- };
- return colors[status] || "grey";
-};
-
-const formatStatus = (status: string) =>
- status.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
+ "id,status,display_id,created_at,email,fulfillment_status,payment_status,total,currency_code"
export const SellerOrderSection = ({ sellerId }: { sellerId: string }) => {
- const { t } = useTranslation();
+ const { t } = useTranslation()
const { searchParams, raw } = useOrderTableQuery({
pageSize: PAGE_SIZE,
prefix: PREFIX,
- });
+ })
const { orders, count, isLoading, isError, error } = useOrders(
{
...searchParams,
seller_id: sellerId,
+ fields: DEFAULT_FIELDS + "," + DEFAULT_RELATIONS,
},
{
placeholderData: keepPreviousData,
},
- );
+ )
- const columns = useColumns();
- const filters = useOrderTableFilters();
+ const columns = useColumns()
+ const filters = useOrderTableFilters()
const { table } = useDataTable({
data: orders ?? [],
@@ -98,10 +45,10 @@ export const SellerOrderSection = ({ sellerId }: { sellerId: string }) => {
count,
pageSize: PAGE_SIZE,
prefix: PREFIX,
- });
+ })
if (isError) {
- throw error;
+ throw error
}
return (
@@ -128,99 +75,14 @@ export const SellerOrderSection = ({ sellerId }: { sellerId: string }) => {
prefix={PREFIX}
/>
</Container>
- );
-};
-
-const columnHelper = createColumnHelper<AdminOrder>();
+ )
+}
const useColumns = () => {
- return useMemo(
- () => [
- columnHelper.display({
- id: "display_id",
- header: "Order",
- cell: ({ row }) => `#${row.original.display_id}`,
- }),
- columnHelper.display({
- id: "created_at",
- header: "Date",
- cell: ({ row }) => <DateCell date={row.original.created_at} />,
- }),
- columnHelper.display({
- id: "customer",
- header: "Customer",
- cell: ({ row }) => {
- return row.original.customer?.first_name &&
- row.original.customer?.last_name
- ? `${row.original.customer?.first_name} ${row.original.customer?.last_name}`
- : row.original.customer?.email;
- },
- }),
- columnHelper.display({
- id: "status",
- header: "Order Status",
- cell: ({ row }) => (
- <Badge
- size="2xsmall"
- color={getOrderStatusBadgeColor(row.original.status)}
- >
- {formatStatus(row.original.status)}
- </Badge>
- ),
- }),
- columnHelper.display({
- id: "payment_status",
- header: "Payment Status",
- cell: ({ row }) => {
- const status = row.original?.payment_status;
- if (!status) return "-";
- return (
- <Badge size="2xsmall" color={getPaymentStatusBadgeColor(status)}>
- {formatStatus(status)}
- </Badge>
- );
- },
- }),
- columnHelper.display({
- id: "fulfillment_status",
- header: "Fulfillment Status",
- cell: ({ row }) => {
- const status = row.original.fulfillment_status;
- if (!status) return "-";
- return (
- <Badge
- size="2xsmall"
- color={getFulfillmentStatusBadgeColor(status)}
- >
- {formatStatus(status)}
- </Badge>
- );
- },
- }),
- columnHelper.display({
- id: "total",
- header: "Order Total",
- cell: ({ row }) => {
- if (
- typeof row.original.total === "undefined" ||
- row.original.total === null
- ) {
- return "-";
- }
-
- const formatted = getStylizedAmount(
- row.original.total,
- row.original.currency_code,
- );
+ const base = useOrderTableColumns({ exclude: ["customer"] })
- return (
- <div className="flex h-full w-full items-center justify-start overflow-hidden text-left">
- <span className="truncate">{formatted}</span>
- </div>
- );
- },
- }),
- ],
- [],
- );
-};
+ return useMemo(
+ () => [...base],
+ [base],
+ )
+}
diff --git a/packages/admin/src/pages/sellers/seller-edit/components/seller-edit-form.tsx b/packages/admin/src/pages/sellers/seller-edit/components/seller-edit-form.tsx
index 80b115544..626c0da5b 100644
--- a/packages/admin/src/pages/sellers/seller-edit/components/seller-edit-form.tsx
+++ b/packages/admin/src/pages/sellers/seller-edit/components/seller-edit-form.tsx
@@ -1,4 +1,4 @@
-import { Button, Heading, Input, toast } from "@medusajs/ui";
+import { Button, Input, toast } from "@medusajs/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
@@ -25,12 +25,6 @@ const SellerEditSchema = z.object({
phone: z.string().optional(),
logo: z.string().optional(),
cover_image: z.string().optional(),
- address_1: z.string().optional(),
- address_2: z.string().optional(),
- city: z.string().optional(),
- province: z.string().optional(),
- country_code: z.string().optional(),
- postal_code: z.string().optional(),
});
export const SellerEditForm = ({ seller }: SellerEditFormProps) => {
@@ -45,12 +39,6 @@ export const SellerEditForm = ({ seller }: SellerEditFormProps) => {
phone: seller?.phone || undefined,
logo: seller?.logo || undefined,
cover_image: seller?.cover_image || undefined,
- address_1: seller?.address_1 || undefined,
- address_2: seller?.address_2 || undefined,
- city: seller?.city || undefined,
- province: seller?.province || undefined,
- country_code: seller?.country_code || undefined,
- postal_code: seller?.postal_code || undefined,
},
resolver: zodResolver(SellerEditSchema),
});
@@ -281,185 +269,6 @@ export const SellerEditForm = ({ seller }: SellerEditFormProps) => {
}}
/>
- <div
- className="mt-4"
- data-testid="seller-edit-form-address-section"
- >
- <Heading
- level="h3"
- className="mb-4"
- data-testid="seller-edit-form-address-heading"
- >
- {t("sellers.fields.address")}
- </Heading>
-
- <div
- className="flex flex-col gap-y-4"
- data-testid="seller-edit-form-address-fields"
- >
- <Form.Field
- control={form.control}
- name="address_1"
- render={({ field }) => {
- return (
- <Form.Item data-testid="seller-edit-form-address-1-item">
- <Form.Label
- optional
- data-testid="seller-edit-form-address-1-label"
- >
- {t("sellers.fields.address_1")}
- </Form.Label>
-
- <Form.Control data-testid="seller-edit-form-address-1-control">
- <Input
- placeholder={t("sellers.fields.address_1")}
- {...field}
- data-testid="seller-edit-form-address-1-input"
- />
- </Form.Control>
-
- <Form.ErrorMessage data-testid="seller-edit-form-address-1-error" />
- </Form.Item>
- );
- }}
- />
-
- <Form.Field
- control={form.control}
- name="address_2"
- render={({ field }) => {
- return (
- <Form.Item data-testid="seller-edit-form-address-2-item">
- <Form.Label
- optional
- data-testid="seller-edit-form-address-2-label"
- >
- {t("sellers.fields.address_2")}
- </Form.Label>
-
- <Form.Control data-testid="seller-edit-form-address-2-control">
- <Input
- placeholder={t("sellers.fields.address_2")}
- {...field}
- data-testid="seller-edit-form-address-2-input"
- />
- </Form.Control>
-
- <Form.ErrorMessage data-testid="seller-edit-form-address-2-error" />
- </Form.Item>
- );
- }}
- />
-
- <Form.Field
- control={form.control}
- name="postal_code"
- render={({ field }) => {
- return (
- <Form.Item data-testid="seller-edit-form-postal-code-item">
- <Form.Label
- optional
- data-testid="seller-edit-form-postal-code-label"
- >
- {t("sellers.fields.postal_code")}
- </Form.Label>
-
- <Form.Control data-testid="seller-edit-form-postal-code-control">
- <Input
- placeholder={t("sellers.fields.postal_code")}
- {...field}
- data-testid="seller-edit-form-postal-code-input"
- />
- </Form.Control>
-
- <Form.ErrorMessage data-testid="seller-edit-form-postal-code-error" />
- </Form.Item>
- );
- }}
- />
-
- <Form.Field
- control={form.control}
- name="city"
- render={({ field }) => {
- return (
- <Form.Item data-testid="seller-edit-form-city-item">
- <Form.Label
- optional
- data-testid="seller-edit-form-city-label"
- >
- {t("sellers.fields.city")}
- </Form.Label>
-
- <Form.Control data-testid="seller-edit-form-city-control">
- <Input
- placeholder={t("sellers.fields.city")}
- {...field}
- data-testid="seller-edit-form-city-input"
- />
- </Form.Control>
-
- <Form.ErrorMessage data-testid="seller-edit-form-city-error" />
- </Form.Item>
- );
- }}
- />
-
- <Form.Field
- control={form.control}
- name="province"
- render={({ field }) => {
- return (
- <Form.Item data-testid="seller-edit-form-province-item">
- <Form.Label
- optional
- data-testid="seller-edit-form-province-label"
- >
- {t("sellers.fields.province")}
- </Form.Label>
-
- <Form.Control data-testid="seller-edit-form-province-control">
- <Input
- placeholder={t("sellers.fields.province")}
- {...field}
- data-testid="seller-edit-form-province-input"
- />
- </Form.Control>
-
- <Form.ErrorMessage data-testid="seller-edit-form-province-error" />
- </Form.Item>
- );
- }}
- />
-
- <Form.Field
- control={form.control}
- name="country_code"
- render={({ field }) => {
- return (
- <Form.Item data-testid="seller-edit-form-country-code-item">
- <Form.Label
- optional
- data-testid="seller-edit-form-country-code-label"
- >
- {t("sellers.fields.country_code")}
- </Form.Label>
-
- <Form.Control data-testid="seller-edit-form-country-code-control">
- <Input
- placeholder={t("sellers.fields.country_code")}
- {...field}
- data-testid="seller-edit-form-country-code-input"
- />
- </Form.Control>
-
- <Form.ErrorMessage data-testid="seller-edit-form-country-code-error" />
- </Form.Item>
- );
- }}
- />
- </div>
- </div>
</div>
</RouteDrawer.Body>