diff --git a/packages/admin/dashboard/src/components/table/data-table/data-table-order-by/data-table-order-by.tsx b/packages/admin/dashboard/src/components/table/data-table/data-table-order-by/data-table-order-by.tsx index e56fa9d0d1..cdc00e31c5 100644 --- a/packages/admin/dashboard/src/components/table/data-table/data-table-order-by/data-table-order-by.tsx +++ b/packages/admin/dashboard/src/components/table/data-table/data-table-order-by/data-table-order-by.tsx @@ -4,8 +4,13 @@ import { useState } from "react" import { useTranslation } from "react-i18next" import { useSearchParams } from "react-router-dom" +export type DataTableOrderByKey = { + key: keyof TData + label: string +} + type DataTableOrderByProps = { - keys: (keyof TData)[] + keys: DataTableOrderByKey[] prefix?: string } @@ -38,18 +43,6 @@ const initState = (params: URLSearchParams, prefix?: string): SortState => { } } -const formatKey = (key: string) => { - const words = key.split("_") - const formattedWords = words.map((word, index) => { - if (index === 0) { - return word.charAt(0).toUpperCase() + word.slice(1) - } else { - return word - } - }) - return formattedWords.join(" ") -} - export const DataTableOrderBy = ({ keys, prefix, @@ -116,7 +109,7 @@ export const DataTableOrderBy = ({ onValueChange={handleKeyChange} > {keys.map((key) => { - const stringKey = String(key) + const stringKey = String(key.key) return ( ({ value={stringKey} onSelect={(event) => event.preventDefault()} > - {formatKey(stringKey)} + {key.label} ) })} diff --git a/packages/admin/dashboard/src/components/table/data-table/data-table-query/data-table-query.tsx b/packages/admin/dashboard/src/components/table/data-table/data-table-query/data-table-query.tsx index 6a2794198c..ecfb769722 100644 --- a/packages/admin/dashboard/src/components/table/data-table/data-table-query/data-table-query.tsx +++ b/packages/admin/dashboard/src/components/table/data-table/data-table-query/data-table-query.tsx @@ -1,21 +1,21 @@ import { Filter } from ".." import { DataTableFilter } from "../data-table-filter" -import { DataTableOrderBy } from "../data-table-order-by" +import { DataTableOrderBy, DataTableOrderByKey } from "../data-table-order-by" import { DataTableSearch } from "../data-table-search" -export interface DataTableQueryProps { +export interface DataTableQueryProps { search?: boolean | "autofocus" - orderBy?: (string | number)[] + orderBy?: DataTableOrderByKey[] filters?: Filter[] prefix?: string } -export const DataTableQuery = ({ +export const DataTableQuery = ({ search, orderBy, filters, prefix, -}: DataTableQueryProps) => { +}: DataTableQueryProps) => { return ( (search || orderBy || filters || prefix) && (
diff --git a/packages/admin/dashboard/src/components/table/data-table/data-table.tsx b/packages/admin/dashboard/src/components/table/data-table/data-table.tsx index 31ba698e52..e4719ba01e 100644 --- a/packages/admin/dashboard/src/components/table/data-table/data-table.tsx +++ b/packages/admin/dashboard/src/components/table/data-table/data-table.tsx @@ -7,7 +7,7 @@ import { DataTableRoot, DataTableRootProps } from "./data-table-root" interface DataTableProps extends Omit, "noResults">, - DataTableQueryProps { + DataTableQueryProps { isLoading?: boolean pageSize: number queryObject?: Record @@ -16,7 +16,7 @@ interface DataTableProps // Maybe we should use the memoized version of DataTableRoot // const MemoizedDataTableRoot = memo(DataTableRoot) as typeof DataTableRoot -const MemoizedDataTableQuery = memo(DataTableQuery) +const MemoizedDataTableQuery = memo(DataTableQuery) as typeof DataTableQuery export const DataTable = ({ table, diff --git a/packages/admin/dashboard/src/components/table/table-cells/promotion/status-cell/status-cell.tsx b/packages/admin/dashboard/src/components/table/table-cells/promotion/status-cell/status-cell.tsx index 62b8d96b84..13550527bf 100644 --- a/packages/admin/dashboard/src/components/table/table-cells/promotion/status-cell/status-cell.tsx +++ b/packages/admin/dashboard/src/components/table/table-cells/promotion/status-cell/status-cell.tsx @@ -1,4 +1,4 @@ -import { PromotionDTO } from "@medusajs/types" +import { HttpTypes } from "@medusajs/types" import { useTranslation } from "react-i18next" import { getPromotionStatus, @@ -7,7 +7,7 @@ import { import { StatusCell as StatusCell_ } from "../../common/status-cell" type PromotionCellProps = { - promotion: PromotionDTO + promotion: HttpTypes.AdminPromotion } type StatusColors = "grey" | "orange" | "green" | "red" type StatusMap = Record diff --git a/packages/admin/dashboard/src/hooks/table/columns/use-promotion-table-columns.tsx b/packages/admin/dashboard/src/hooks/table/columns/use-promotion-table-columns.tsx index 964dad9a70..f9cfd81b79 100644 --- a/packages/admin/dashboard/src/hooks/table/columns/use-promotion-table-columns.tsx +++ b/packages/admin/dashboard/src/hooks/table/columns/use-promotion-table-columns.tsx @@ -1,5 +1,5 @@ -import { PromotionDTO } from "@medusajs/types" -import { ColumnDef, createColumnHelper } from "@tanstack/react-table" +import { HttpTypes } from "@medusajs/types" +import { createColumnHelper } from "@tanstack/react-table" import { useMemo } from "react" import { useTranslation } from "react-i18next" @@ -13,7 +13,7 @@ import { } from "../../../components/table/table-cells/common/text-cell" import { StatusCell } from "../../../components/table/table-cells/promotion/status-cell" -const columnHelper = createColumnHelper() +const columnHelper = createColumnHelper() export const usePromotionTableColumns = () => { const { t } = useTranslation() @@ -44,6 +44,6 @@ export const usePromotionTableColumns = () => { cell: ({ row }) => , }), ], - [] - ) as ColumnDef[] + [t] + ) } diff --git a/packages/admin/dashboard/src/i18n/translations/en.json b/packages/admin/dashboard/src/i18n/translations/en.json index 250060045b..ed05537b31 100644 --- a/packages/admin/dashboard/src/i18n/translations/en.json +++ b/packages/admin/dashboard/src/i18n/translations/en.json @@ -847,7 +847,8 @@ "groups": "Groups" }, "registered": "Registered", - "guest": "Guest" + "guest": "Guest", + "hasAccount": "Has account" }, "customerGroups": { "domain": "Customer Groups", @@ -1268,6 +1269,11 @@ "confirmed": "Order edit #{{editId}} confirmed" } } + }, + "fields": { + "displayId": "Display ID", + "refundableAmount": "Refundable amount", + "returnableQuantity": "Returnable quantity" } }, "draftOrders": { diff --git a/packages/admin/dashboard/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/api-key-sales-channel-section.tsx b/packages/admin/dashboard/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/api-key-sales-channel-section.tsx index a42a294df7..d7b958811a 100644 --- a/packages/admin/dashboard/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/api-key-sales-channel-section.tsx +++ b/packages/admin/dashboard/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/api-key-sales-channel-section.tsx @@ -117,7 +117,20 @@ export const ApiKeySalesChannelSection = ({ isLoading={isLoading} queryObject={raw} navigateTo={(row) => `/settings/sales-channels/${row.id}`} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { + key: "name", + label: t("fields.name"), + }, + { + key: "created_at", + label: t("fields.createdAt"), + }, + { + key: "updated_at", + label: t("fields.updatedAt"), + }, + ]} commands={[ { action: handleRemove, diff --git a/packages/admin/dashboard/src/routes/api-key-management/api-key-management-list/components/api-key-management-list-table/api-key-management-list-table.tsx b/packages/admin/dashboard/src/routes/api-key-management/api-key-management-list/components/api-key-management-list-table/api-key-management-list-table.tsx index 5d246df112..ec9471422b 100644 --- a/packages/admin/dashboard/src/routes/api-key-management/api-key-management-list/components/api-key-management-list-table/api-key-management-list-table.tsx +++ b/packages/admin/dashboard/src/routes/api-key-management/api-key-management-list/components/api-key-management-list-table/api-key-management-list-table.tsx @@ -76,7 +76,12 @@ export const ApiKeyManagementListTable = ({ columns={columns} count={count} pageSize={PAGE_SIZE} - orderBy={["title", "created_at", "updated_at", "revoked_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + { key: "revoked_at", label: t("fields.revokedAt") }, + ]} navigateTo={(row) => row.id} pagination search diff --git a/packages/admin/dashboard/src/routes/api-key-management/api-key-management-sales-channels/components/api-key-sales-channels-form/api-key-sales-channels-form.tsx b/packages/admin/dashboard/src/routes/api-key-management/api-key-management-sales-channels/components/api-key-sales-channels-form/api-key-sales-channels-form.tsx index 21455f62c8..69873a95e4 100644 --- a/packages/admin/dashboard/src/routes/api-key-management/api-key-management-sales-channels/components/api-key-sales-channels-form/api-key-sales-channels-form.tsx +++ b/packages/admin/dashboard/src/routes/api-key-management/api-key-management-sales-channels/components/api-key-sales-channels-form/api-key-sales-channels-form.tsx @@ -149,7 +149,11 @@ export const ApiKeySalesChannelsForm = ({ search="autofocus" isLoading={isLoading} queryObject={raw} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} layout="fill" noRecords={{ message: t( diff --git a/packages/admin/dashboard/src/routes/campaigns/add-campaign-promotions/components/add-campaign-promotions-form.tsx b/packages/admin/dashboard/src/routes/campaigns/add-campaign-promotions/components/add-campaign-promotions-form.tsx index ab9f89f1b3..115d44ca77 100644 --- a/packages/admin/dashboard/src/routes/campaigns/add-campaign-promotions/components/add-campaign-promotions-form.tsx +++ b/packages/admin/dashboard/src/routes/campaigns/add-campaign-promotions/components/add-campaign-promotions-form.tsx @@ -1,5 +1,5 @@ import { zodResolver } from "@hookform/resolvers/zod" -import { AdminCampaign, PromotionDTO } from "@medusajs/types" +import { AdminCampaign, HttpTypes } from "@medusajs/types" import { Button, Checkbox, Hint, Tooltip, toast } from "@medusajs/ui" import { keepPreviousData } from "@tanstack/react-query" import { @@ -131,7 +131,12 @@ export const AddCampaignPromotionsForm = ({ pageSize={PAGE_SIZE} isLoading={isLoading} filters={filters} - orderBy={["title", "status", "created_at", "updated_at"]} + orderBy={[ + { key: "code", label: t("fields.code") }, + { key: "type", label: t("fields.type") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} layout="fill" pagination @@ -158,7 +163,7 @@ export const AddCampaignPromotionsForm = ({ ) } -const columnHelper = createColumnHelper() +const columnHelper = createColumnHelper() const useColumns = () => { const base = usePromotionTableColumns() diff --git a/packages/admin/dashboard/src/routes/campaigns/campaign-detail/components/campaign-promotion-section/campaign-promotion-section.tsx b/packages/admin/dashboard/src/routes/campaigns/campaign-detail/components/campaign-promotion-section/campaign-promotion-section.tsx index e684783551..c6adffdf72 100644 --- a/packages/admin/dashboard/src/routes/campaigns/campaign-detail/components/campaign-promotion-section/campaign-promotion-section.tsx +++ b/packages/admin/dashboard/src/routes/campaigns/campaign-detail/components/campaign-promotion-section/campaign-promotion-section.tsx @@ -100,12 +100,10 @@ export const CampaignPromotionSection = ({ search pagination orderBy={[ - "email", - "first_name", - "last_name", - "has_account", - "created_at", - "updated_at", + { key: "code", label: t("fields.code") }, + { key: "type", label: t("fields.type") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, ]} queryObject={raw} commands={[ diff --git a/packages/admin/dashboard/src/routes/campaigns/campaign-list/components/campaign-list-table.tsx b/packages/admin/dashboard/src/routes/campaigns/campaign-list/components/campaign-list-table.tsx index 3a3b908403..a090a133f9 100644 --- a/packages/admin/dashboard/src/routes/campaigns/campaign-list/components/campaign-list-table.tsx +++ b/packages/admin/dashboard/src/routes/campaigns/campaign-list/components/campaign-list-table.tsx @@ -68,7 +68,11 @@ export const CampaignListTable = () => { navigateTo={(row) => row.id} isLoading={isLoading} queryObject={raw} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} /> ) @@ -97,7 +101,9 @@ const CampaignActions = ({ campaign }: { campaign: AdminCampaign }) => { await mutateAsync(undefined, { onSuccess: () => { - toast.success(t("campaigns.toast.delete")) + toast.success( + t("campaigns.delete.successToast", { name: campaign.name }) + ) }, onError: (e) => { toast.error(e.message) diff --git a/packages/admin/dashboard/src/routes/categories/category-detail/components/category-product-section/category-product-section.tsx b/packages/admin/dashboard/src/routes/categories/category-detail/components/category-product-section/category-product-section.tsx index bff3aa4289..c4a5d26bc0 100644 --- a/packages/admin/dashboard/src/routes/categories/category-detail/components/category-product-section/category-product-section.tsx +++ b/packages/admin/dashboard/src/routes/categories/category-detail/components/category-product-section/category-product-section.tsx @@ -129,7 +129,11 @@ export const CategoryProductSection = ({ table={table} filters={filters} columns={columns} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} pageSize={PAGE_SIZE} count={count} navigateTo={(row) => `/products/${row.id}`} diff --git a/packages/admin/dashboard/src/routes/categories/category-products/components/edit-category-products-form/edit-category-products-form.tsx b/packages/admin/dashboard/src/routes/categories/category-products/components/edit-category-products-form/edit-category-products-form.tsx index 3ff7d87947..06a961a7d9 100644 --- a/packages/admin/dashboard/src/routes/categories/category-products/components/edit-category-products-form/edit-category-products-form.tsx +++ b/packages/admin/dashboard/src/routes/categories/category-products/components/edit-category-products-form/edit-category-products-form.tsx @@ -166,7 +166,11 @@ export const EditCategoryProductsForm = ({ count={count} queryObject={raw} filters={filters} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} prefix={PREFIX} isLoading={isPending} layout="fill" diff --git a/packages/admin/dashboard/src/routes/collections/collection-add-products/components/add-products-to-collection-form/add-products-to-collection-form.tsx b/packages/admin/dashboard/src/routes/collections/collection-add-products/components/add-products-to-collection-form/add-products-to-collection-form.tsx index 47161f403b..8ab8b122fd 100644 --- a/packages/admin/dashboard/src/routes/collections/collection-add-products/components/add-products-to-collection-form/add-products-to-collection-form.tsx +++ b/packages/admin/dashboard/src/routes/collections/collection-add-products/components/add-products-to-collection-form/add-products-to-collection-form.tsx @@ -175,7 +175,11 @@ export const AddProductsToCollectionForm = ({ count={count} queryObject={raw} filters={filters} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} prefix={PREFIX} isLoading={isLoading} layout="fill" diff --git a/packages/admin/dashboard/src/routes/collections/collection-detail/components/collection-product-section/collection-product-section.tsx b/packages/admin/dashboard/src/routes/collections/collection-detail/components/collection-product-section/collection-product-section.tsx index a2674c7fc9..e240b1907f 100644 --- a/packages/admin/dashboard/src/routes/collections/collection-detail/components/collection-product-section/collection-product-section.tsx +++ b/packages/admin/dashboard/src/routes/collections/collection-detail/components/collection-product-section/collection-product-section.tsx @@ -124,7 +124,11 @@ export const CollectionProductSection = ({ count={count} filters={filters} isLoading={isLoading} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} commands={[ { diff --git a/packages/admin/dashboard/src/routes/collections/collection-list/components/collection-list-table/collection-list-table.tsx b/packages/admin/dashboard/src/routes/collections/collection-list/components/collection-list-table/collection-list-table.tsx index 225acee56a..5d1ed96688 100644 --- a/packages/admin/dashboard/src/routes/collections/collection-list/components/collection-list-table/collection-list-table.tsx +++ b/packages/admin/dashboard/src/routes/collections/collection-list/components/collection-list-table/collection-list-table.tsx @@ -66,7 +66,12 @@ export const CollectionListTable = () => { pageSize={PAGE_SIZE} count={count} filters={filters} - orderBy={["title", "handle", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "handle", label: t("fields.handle") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} search navigateTo={(row) => `/collections/${row.original.id}`} queryObject={raw} diff --git a/packages/admin/dashboard/src/routes/customer-groups/customer-group-add-customers/components/add-customers-form/add-customers-form.tsx b/packages/admin/dashboard/src/routes/customer-groups/customer-group-add-customers/components/add-customers-form/add-customers-form.tsx index 2109e58a9b..7fbb3ab9a6 100644 --- a/packages/admin/dashboard/src/routes/customer-groups/customer-group-add-customers/components/add-customers-form/add-customers-form.tsx +++ b/packages/admin/dashboard/src/routes/customer-groups/customer-group-add-customers/components/add-customers-form/add-customers-form.tsx @@ -160,12 +160,12 @@ export const AddCustomersForm = ({ count={count} filters={filters} orderBy={[ - "email", - "first_name", - "last_name", - "has_account", - "created_at", - "updated_at", + { key: "email", label: t("fields.email") }, + { key: "first_name", label: t("fields.firstName") }, + { key: "last_name", label: t("fields.lastName") }, + { key: "has_account", label: t("customers.hasAccount") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, ]} isLoading={isLoading} layout="fill" diff --git a/packages/admin/dashboard/src/routes/customer-groups/customer-group-detail/components/customer-group-customer-section/customer-group-customer-section.tsx b/packages/admin/dashboard/src/routes/customer-groups/customer-group-detail/components/customer-group-customer-section/customer-group-customer-section.tsx index e0b4f66502..adc6dd9418 100644 --- a/packages/admin/dashboard/src/routes/customer-groups/customer-group-detail/components/customer-group-customer-section/customer-group-customer-section.tsx +++ b/packages/admin/dashboard/src/routes/customer-groups/customer-group-detail/components/customer-group-customer-section/customer-group-customer-section.tsx @@ -106,12 +106,12 @@ export const CustomerGroupCustomerSection = ({ search pagination orderBy={[ - "email", - "first_name", - "last_name", - "has_account", - "created_at", - "updated_at", + { key: "email", label: t("fields.email") }, + { key: "first_name", label: t("fields.firstName") }, + { key: "last_name", label: t("fields.lastName") }, + { key: "has_account", label: t("customers.hasAccount") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, ]} queryObject={raw} commands={[ diff --git a/packages/admin/dashboard/src/routes/customer-groups/customer-group-list/components/customer-group-list-table/customer-group-list-table.tsx b/packages/admin/dashboard/src/routes/customer-groups/customer-group-list/components/customer-group-list-table/customer-group-list-table.tsx index 65f4cf5082..1b3f788730 100644 --- a/packages/admin/dashboard/src/routes/customer-groups/customer-group-list/components/customer-group-list-table/customer-group-list-table.tsx +++ b/packages/admin/dashboard/src/routes/customer-groups/customer-group-list/components/customer-group-list-table/customer-group-list-table.tsx @@ -78,7 +78,11 @@ export const CustomerGroupListTable = () => { search pagination navigateTo={(row) => `/customer-groups/${row.original.id}`} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} isLoading={isLoading} /> diff --git a/packages/admin/dashboard/src/routes/customers/customer-detail/components/customer-group-section/customer-group-section.tsx b/packages/admin/dashboard/src/routes/customers/customer-detail/components/customer-group-section/customer-group-section.tsx index dcb7dd5c4e..bd4dad978e 100644 --- a/packages/admin/dashboard/src/routes/customers/customer-detail/components/customer-group-section/customer-group-section.tsx +++ b/packages/admin/dashboard/src/routes/customers/customer-detail/components/customer-group-section/customer-group-section.tsx @@ -137,7 +137,11 @@ export const CustomerGroupSection = ({ filters={filters} search pagination - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} commands={[ { action: handleRemove, diff --git a/packages/admin/dashboard/src/routes/customers/customer-detail/components/customer-order-section/customer-order-section.tsx b/packages/admin/dashboard/src/routes/customers/customer-detail/components/customer-order-section/customer-order-section.tsx index 190913feca..abbe859bd1 100644 --- a/packages/admin/dashboard/src/routes/customers/customer-detail/components/customer-order-section/customer-order-section.tsx +++ b/packages/admin/dashboard/src/routes/customers/customer-detail/components/customer-order-section/customer-order-section.tsx @@ -1,4 +1,5 @@ import { ArrowPath } from "@medusajs/icons" +import { HttpTypes } from "@medusajs/types" import { Button, Container, Heading } from "@medusajs/ui" import { keepPreviousData } from "@tanstack/react-query" import { createColumnHelper } from "@tanstack/react-table" @@ -11,7 +12,6 @@ import { useOrderTableColumns } from "../../../../../hooks/table/columns/use-ord import { useOrderTableFilters } from "../../../../../hooks/table/filters/use-order-table-filters" import { useOrderTableQuery } from "../../../../../hooks/table/query/use-order-table-query" import { useDataTable } from "../../../../../hooks/use-data-table" -import { HttpTypes } from "@medusajs/types" type CustomerGeneralSectionProps = { customer: HttpTypes.AdminCustomer @@ -75,7 +75,11 @@ export const CustomerOrderSection = ({ count={count} isLoading={isLoading} pageSize={PAGE_SIZE} - orderBy={["display_id", "created_at", "updated_at"]} + orderBy={[ + { key: "display_id", label: t("orders.fields.displayId") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} search={true} queryObject={raw} /> diff --git a/packages/admin/dashboard/src/routes/customers/customer-list/components/customer-list-table/customer-list-table.tsx b/packages/admin/dashboard/src/routes/customers/customer-list/components/customer-list-table/customer-list-table.tsx index e4fe2b99e8..b3dd0e1e38 100644 --- a/packages/admin/dashboard/src/routes/customers/customer-list/components/customer-list-table/customer-list-table.tsx +++ b/packages/admin/dashboard/src/routes/customers/customer-list/components/customer-list-table/customer-list-table.tsx @@ -6,6 +6,7 @@ import { useMemo } from "react" import { useTranslation } from "react-i18next" import { Link } from "react-router-dom" +import { HttpTypes } from "@medusajs/types" import { ActionMenu } from "../../../../../components/common/action-menu" import { DataTable } from "../../../../../components/table/data-table" import { useCustomers } from "../../../../../hooks/api/customers" @@ -13,7 +14,6 @@ import { useCustomerTableColumns } from "../../../../../hooks/table/columns/use- import { useCustomerTableFilters } from "../../../../../hooks/table/filters/use-customer-table-filters" import { useCustomerTableQuery } from "../../../../../hooks/table/query/use-customer-table-query" import { useDataTable } from "../../../../../hooks/use-data-table" -import { HttpTypes } from "@medusajs/types" const PAGE_SIZE = 20 @@ -63,12 +63,12 @@ export const CustomerListTable = () => { count={count} filters={filters} orderBy={[ - "email", - "first_name", - "last_name", - "has_account", - "created_at", - "updated_at", + { key: "email", label: t("fields.email") }, + { key: "first_name", label: t("fields.firstName") }, + { key: "last_name", label: t("fields.lastName") }, + { key: "has_account", label: t("customers.hasAccount") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, ]} isLoading={isLoading} navigateTo={(row) => row.original.id} diff --git a/packages/admin/dashboard/src/routes/customers/customers-add-customer-group/components/add-customers-form/add-customer-groups-form.tsx b/packages/admin/dashboard/src/routes/customers/customers-add-customer-group/components/add-customers-form/add-customer-groups-form.tsx index b917c6047d..c3715f3b9e 100644 --- a/packages/admin/dashboard/src/routes/customers/customers-add-customer-group/components/add-customers-form/add-customer-groups-form.tsx +++ b/packages/admin/dashboard/src/routes/customers/customers-add-customer-group/components/add-customers-form/add-customer-groups-form.tsx @@ -175,7 +175,11 @@ export const AddCustomerGroupsForm = ({ pageSize={PAGE_SIZE} count={count} filters={filters} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} isLoading={isLoading} layout="fill" search="autofocus" diff --git a/packages/admin/dashboard/src/routes/inventory/inventory-list/components/inventory-list-table.tsx b/packages/admin/dashboard/src/routes/inventory/inventory-list/components/inventory-list-table.tsx index 6af0f82bd9..c8a42d271e 100644 --- a/packages/admin/dashboard/src/routes/inventory/inventory-list/components/inventory-list-table.tsx +++ b/packages/admin/dashboard/src/routes/inventory/inventory-list/components/inventory-list-table.tsx @@ -1,14 +1,14 @@ -import { Button, Container, Heading, Text } from "@medusajs/ui" import { InventoryTypes } from "@medusajs/types" +import { Button, Container, Heading, Text } from "@medusajs/ui" +import { useTranslation } from "react-i18next" +import { Link } from "react-router-dom" import { DataTable } from "../../../../components/table/data-table" -import { useDataTable } from "../../../../hooks/use-data-table" import { useInventoryItems } from "../../../../hooks/api/inventory" +import { useDataTable } from "../../../../hooks/use-data-table" import { useInventoryTableColumns } from "./use-inventory-table-columns" import { useInventoryTableFilters } from "./use-inventory-table-filters" import { useInventoryTableQuery } from "./use-inventory-table-query" -import { useTranslation } from "react-i18next" -import { Link } from "react-router-dom" const PAGE_SIZE = 20 @@ -68,7 +68,12 @@ export const InventoryListTable = () => { search filters={filters} queryObject={raw} - orderBy={["title", "sku", "stocked_quantity", "reserved_quantity"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "sku", label: t("fields.sku") }, + { key: "stocked_quantity", label: t("fields.inStock") }, + { key: "reserved_quantity", label: t("inventory.reserved") }, + ]} navigateTo={(row) => `${row.id}`} /> diff --git a/packages/admin/dashboard/src/routes/locations/common/components/geo-zone-form/geo-zone-form.tsx b/packages/admin/dashboard/src/routes/locations/common/components/geo-zone-form/geo-zone-form.tsx index 53d24d2558..152bfe78ab 100644 --- a/packages/admin/dashboard/src/routes/locations/common/components/geo-zone-form/geo-zone-form.tsx +++ b/packages/admin/dashboard/src/routes/locations/common/components/geo-zone-form/geo-zone-form.tsx @@ -246,7 +246,10 @@ const AreaStackedModal = >({ search pagination layout="fill" - orderBy={["name", "code"]} + orderBy={[ + { key: "display_name", label: t("fields.name") }, + { key: "iso_2", label: t("fields.code") }, + ]} queryObject={raw} prefix={PREFIX} /> diff --git a/packages/admin/dashboard/src/routes/locations/location-fulfillment-providers/components/edit-fulfillment-providers-form/edit-fulfillment-providers-form.tsx b/packages/admin/dashboard/src/routes/locations/location-fulfillment-providers/components/edit-fulfillment-providers-form/edit-fulfillment-providers-form.tsx index 232e82c25b..0ed1b5b315 100644 --- a/packages/admin/dashboard/src/routes/locations/location-fulfillment-providers/components/edit-fulfillment-providers-form/edit-fulfillment-providers-form.tsx +++ b/packages/admin/dashboard/src/routes/locations/location-fulfillment-providers/components/edit-fulfillment-providers-form/edit-fulfillment-providers-form.tsx @@ -132,7 +132,7 @@ export const LocationEditFulfillmentProvidersForm = ({ filters={filters} search="autofocus" pagination - orderBy={["id", "created_at", "updated_at"]} + orderBy={[{ key: "id", label: t("fields.id") }]} queryObject={raw} layout="fill" /> diff --git a/packages/admin/dashboard/src/routes/locations/location-sales-channels/components/edit-sales-channels-form/edit-sales-channels-form.tsx b/packages/admin/dashboard/src/routes/locations/location-sales-channels/components/edit-sales-channels-form/edit-sales-channels-form.tsx index 7c9c00800c..14ad20db05 100644 --- a/packages/admin/dashboard/src/routes/locations/location-sales-channels/components/edit-sales-channels-form/edit-sales-channels-form.tsx +++ b/packages/admin/dashboard/src/routes/locations/location-sales-channels/components/edit-sales-channels-form/edit-sales-channels-form.tsx @@ -146,7 +146,11 @@ export const LocationEditSalesChannelsForm = ({ filters={filters} search="autofocus" pagination - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} layout="fill" /> diff --git a/packages/admin/dashboard/src/routes/orders/order-create-claim/components/add-claim-items-table/add-claim-items-table.tsx b/packages/admin/dashboard/src/routes/orders/order-create-claim/components/add-claim-items-table/add-claim-items-table.tsx index 2bd2ec411e..c8170c834e 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-claim/components/add-claim-items-table/add-claim-items-table.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-claim/components/add-claim-items-table/add-claim-items-table.tsx @@ -6,6 +6,7 @@ import { import { OnChangeFn, RowSelectionState } from "@tanstack/react-table" import { useMemo, useState } from "react" +import { useTranslation } from "react-i18next" import { DataTable } from "../../../../../components/table/data-table" import { useDataTable } from "../../../../../hooks/use-data-table" import { getStylizedAmount } from "../../../../../lib/money-amount-helpers" @@ -30,6 +31,8 @@ export const AddClaimItemsTable = ({ items, currencyCode, }: AddReturnItemsTableProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState( selectedItems.reduce((acc, id) => { acc[id] = true @@ -141,11 +144,17 @@ export const AddClaimItemsTable = ({ layout="fill" search orderBy={[ - "product_title", - "variant_title", - "sku", - "returnable_quantity", - "refundable_amount", + { key: "product_title", label: t("fields.product") }, + { key: "variant_title", label: t("fields.variant") }, + { key: "sku", label: t("fields.sku") }, + { + key: "returnable_quantity", + label: t("orders.fields.returnableQuantity"), + }, + { + key: "refundable_amount", + label: t("orders.fields.refundableAmount"), + }, ]} prefix={PREFIX} queryObject={raw} diff --git a/packages/admin/dashboard/src/routes/orders/order-create-claim/components/add-claim-outbound-items-table/add-claim-outbound-items-table.tsx b/packages/admin/dashboard/src/routes/orders/order-create-claim/components/add-claim-outbound-items-table/add-claim-outbound-items-table.tsx index 3b0dec3ead..637db941cb 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-claim/components/add-claim-outbound-items-table/add-claim-outbound-items-table.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-claim/components/add-claim-outbound-items-table/add-claim-outbound-items-table.tsx @@ -1,6 +1,7 @@ import { OnChangeFn, RowSelectionState } from "@tanstack/react-table" import { useState } from "react" +import { useTranslation } from "react-i18next" import { DataTable } from "../../../../../components/table/data-table" import { useVariants } from "../../../../../hooks/api" import { useDataTable } from "../../../../../hooks/use-data-table" @@ -22,6 +23,8 @@ export const AddClaimOutboundItemsTable = ({ selectedItems, currencyCode, }: AddClaimOutboundItemsTableProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState( selectedItems.reduce((acc, id) => { acc[id] = true @@ -78,7 +81,11 @@ export const AddClaimOutboundItemsTable = ({ pagination layout="fill" search - orderBy={["product_id", "title", "sku"]} + orderBy={[ + { key: "product_id", label: t("fields.product") }, + { key: "title", label: t("fields.title") }, + { key: "sku", label: t("fields.sku") }, + ]} prefix={PREFIX} queryObject={raw} /> diff --git a/packages/admin/dashboard/src/routes/orders/order-create-edit/components/add-order-edit-items-table/add-order-edit-items-table.tsx b/packages/admin/dashboard/src/routes/orders/order-create-edit/components/add-order-edit-items-table/add-order-edit-items-table.tsx index e527583019..ea0f8bef4e 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-edit/components/add-order-edit-items-table/add-order-edit-items-table.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-edit/components/add-order-edit-items-table/add-order-edit-items-table.tsx @@ -1,12 +1,13 @@ import { OnChangeFn, RowSelectionState } from "@tanstack/react-table" import { useState } from "react" +import { useTranslation } from "react-i18next" import { DataTable } from "../../../../../components/table/data-table" import { useVariants } from "../../../../../hooks/api" import { useDataTable } from "../../../../../hooks/use-data-table" +import { useOrderEditItemsTableColumns } from "./use-order-edit-item-table-columns" import { useOrderEditItemTableFilters } from "./use-order-edit-item-table-filters" import { useOrderEditItemTableQuery } from "./use-order-edit-item-table-query" -import { useOrderEditItemsTableColumns } from "./use-order-edit-item-table-columns" const PAGE_SIZE = 50 const PREFIX = "rit" @@ -20,6 +21,8 @@ export const AddOrderEditItemsTable = ({ onSelectionChange, currencyCode, }: AddExchangeOutboundItemsTableProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState({}) const updater: OnChangeFn = (fn) => { @@ -71,7 +74,11 @@ export const AddOrderEditItemsTable = ({ pagination layout="fill" search - orderBy={["product_id", "title", "sku"]} + orderBy={[ + { key: "product_id", label: t("fields.product") }, + { key: "title", label: t("fields.title") }, + { key: "sku", label: t("fields.sku") }, + ]} prefix={PREFIX} queryObject={raw} /> diff --git a/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/add-exchange-inbound-items-table/add-exchange-inbound-items-table.tsx b/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/add-exchange-inbound-items-table/add-exchange-inbound-items-table.tsx index e56ae22760..12bf4fbdc5 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/add-exchange-inbound-items-table/add-exchange-inbound-items-table.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/add-exchange-inbound-items-table/add-exchange-inbound-items-table.tsx @@ -2,6 +2,7 @@ import { AdminOrderLineItem, DateComparisonOperator } from "@medusajs/types" import { OnChangeFn, RowSelectionState } from "@tanstack/react-table" import { useMemo, useState } from "react" +import { useTranslation } from "react-i18next" import { DataTable } from "../../../../../components/table/data-table" import { useDataTable } from "../../../../../hooks/use-data-table" import { getReturnableQuantity } from "../../../../../lib/rma" @@ -25,6 +26,8 @@ export const AddExchangeInboundItemsTable = ({ items, currencyCode, }: AddExchangeInboundItemsTableProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState( selectedItems.reduce((acc, id) => { acc[id] = true @@ -108,7 +111,11 @@ export const AddExchangeInboundItemsTable = ({ pagination layout="fill" search - orderBy={["product_title", "variant_title", "sku"]} + orderBy={[ + { key: "product_title", label: t("fields.product") }, + { key: "variant_title", label: t("fields.variant") }, + { key: "sku", label: t("fields.sku") }, + ]} prefix={PREFIX} queryObject={raw} /> diff --git a/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/add-exchange-outbound-items-table/add-exchange-outbound-items-table.tsx b/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/add-exchange-outbound-items-table/add-exchange-outbound-items-table.tsx index 4cf84340ea..0e01224f99 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/add-exchange-outbound-items-table/add-exchange-outbound-items-table.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-exchange/components/add-exchange-outbound-items-table/add-exchange-outbound-items-table.tsx @@ -1,6 +1,7 @@ import { OnChangeFn, RowSelectionState } from "@tanstack/react-table" import { useState } from "react" +import { useTranslation } from "react-i18next" import { DataTable } from "../../../../../components/table/data-table" import { useVariants } from "../../../../../hooks/api" import { useDataTable } from "../../../../../hooks/use-data-table" @@ -22,6 +23,8 @@ export const AddExchangeOutboundItemsTable = ({ selectedItems, currencyCode, }: AddExchangeOutboundItemsTableProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState( selectedItems.reduce((acc, id) => { acc[id] = true @@ -78,7 +81,11 @@ export const AddExchangeOutboundItemsTable = ({ pagination layout="fill" search - orderBy={["product_id", "title", "sku"]} + orderBy={[ + { key: "product_id", label: t("fields.product") }, + { key: "title", label: t("fields.title") }, + { key: "sku", label: t("fields.sku") }, + ]} prefix={PREFIX} queryObject={raw} /> diff --git a/packages/admin/dashboard/src/routes/orders/order-create-return/components/add-return-items-table/add-return-items-table.tsx b/packages/admin/dashboard/src/routes/orders/order-create-return/components/add-return-items-table/add-return-items-table.tsx index 705b93f54a..393c9c83ff 100644 --- a/packages/admin/dashboard/src/routes/orders/order-create-return/components/add-return-items-table/add-return-items-table.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-create-return/components/add-return-items-table/add-return-items-table.tsx @@ -2,18 +2,19 @@ import { OnChangeFn, RowSelectionState } from "@tanstack/react-table" import { useMemo, useState } from "react" import { + AdminOrderLineItem, DateComparisonOperator, NumericalComparisonOperator, } from "@medusajs/types" -import { AdminOrderLineItem } from "@medusajs/types" +import { useTranslation } from "react-i18next" +import { DataTable } from "../../../../../components/table/data-table" +import { useDataTable } from "../../../../../hooks/use-data-table" +import { getStylizedAmount } from "../../../../../lib/money-amount-helpers" +import { getReturnableQuantity } from "../../../../../lib/rma" import { useReturnItemTableColumns } from "./use-return-item-table-columns" import { useReturnItemTableFilters } from "./use-return-item-table-filters" import { useReturnItemTableQuery } from "./use-return-item-table-query" -import { useDataTable } from "../../../../../hooks/use-data-table" -import { DataTable } from "../../../../../components/table/data-table" -import { getStylizedAmount } from "../../../../../lib/money-amount-helpers" -import { getReturnableQuantity } from "../../../../../lib/rma" const PAGE_SIZE = 50 const PREFIX = "rit" @@ -31,6 +32,8 @@ export const AddReturnItemsTable = ({ items, currencyCode, }: AddReturnItemsTableProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState( selectedItems.reduce((acc, id) => { acc[id] = true @@ -142,11 +145,17 @@ export const AddReturnItemsTable = ({ layout="fill" search orderBy={[ - "product_title", - "variant_title", - "sku", - "returnable_quantity", - "refundable_amount", + { key: "product_title", label: t("fields.product") }, + { key: "variant_title", label: t("fields.variant") }, + { key: "sku", label: t("fields.sku") }, + { + key: "returnable_quantity", + label: t("orders.fields.returnableQuantity"), + }, + { + key: "refundable_amount", + label: t("orders.fields.refundableAmount"), + }, ]} prefix={PREFIX} queryObject={raw} diff --git a/packages/admin/dashboard/src/routes/orders/order-list/components/order-list-table/order-list-table.tsx b/packages/admin/dashboard/src/routes/orders/order-list/components/order-list-table/order-list-table.tsx index a267a48044..345377496d 100644 --- a/packages/admin/dashboard/src/routes/orders/order-list/components/order-list-table/order-list-table.tsx +++ b/packages/admin/dashboard/src/routes/orders/order-list/components/order-list-table/order-list-table.tsx @@ -1,13 +1,13 @@ -import { keepPreviousData } from "@tanstack/react-query" import { Container, Heading } from "@medusajs/ui" +import { keepPreviousData } from "@tanstack/react-query" import { useTranslation } from "react-i18next" import { DataTable } from "../../../../../components/table/data-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/use-order-table-filters" import { useOrderTableQuery } from "../../../../../hooks/table/query/use-order-table-query" import { useDataTable } from "../../../../../hooks/use-data-table" -import { useOrders } from "../../../../../hooks/api/orders" import { DEFAULT_FIELDS } from "../../const" @@ -59,7 +59,11 @@ export const OrderListTable = () => { search isLoading={isLoading} pageSize={PAGE_SIZE} - orderBy={["display_id", "created_at", "updated_at"]} + orderBy={[ + { key: "display_id", label: t("orders.fields.displayId") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} noRecords={{ message: t("orders.list.noRecordsMessage"), diff --git a/packages/admin/dashboard/src/routes/price-lists/common/components/price-list-customer-group-rule-form/price-list-customer-group-rule-form.tsx b/packages/admin/dashboard/src/routes/price-lists/common/components/price-list-customer-group-rule-form/price-list-customer-group-rule-form.tsx index a4a9df167d..0d86fa0e40 100644 --- a/packages/admin/dashboard/src/routes/price-lists/common/components/price-list-customer-group-rule-form/price-list-customer-group-rule-form.tsx +++ b/packages/admin/dashboard/src/routes/price-lists/common/components/price-list-customer-group-rule-form/price-list-customer-group-rule-form.tsx @@ -126,7 +126,11 @@ export const PriceListCustomerGroupRuleForm = ({ count={count} isLoading={isLoading} filters={filters} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} layout="fill" pagination search diff --git a/packages/admin/dashboard/src/routes/price-lists/price-list-create/components/price-list-create-form/price-list-products-form.tsx b/packages/admin/dashboard/src/routes/price-lists/price-list-create/components/price-list-create-form/price-list-products-form.tsx index e2e5633eff..927ee089a6 100644 --- a/packages/admin/dashboard/src/routes/price-lists/price-list-create/components/price-list-create-form/price-list-products-form.tsx +++ b/packages/admin/dashboard/src/routes/price-lists/price-list-create/components/price-list-create-form/price-list-products-form.tsx @@ -9,6 +9,7 @@ import { import { useMemo, useState } from "react" import { UseFormReturn, useWatch } from "react-hook-form" +import { useTranslation } from "react-i18next" import { DataTable } from "../../../../../components/table/data-table" import { useProducts } from "../../../../../hooks/api/products" import { useProductTableColumns } from "../../../../../hooks/table/columns/use-product-table-columns" @@ -17,7 +18,6 @@ import { useProductTableQuery } from "../../../../../hooks/table/query/use-produ import { useDataTable } from "../../../../../hooks/use-data-table" import { PriceListCreateProductsSchema } from "../../../common/schemas" import { PricingCreateSchemaType } from "./schema" -import { useTranslation } from "react-i18next" type PriceListProductsFormProps = { form: UseFormReturn @@ -126,7 +126,12 @@ export const PriceListProductsForm = ({ form }: PriceListProductsFormProps) => { count={count} isLoading={isLoading} layout="fill" - orderBy={["title", "status", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "status", label: t("fields.status") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} pagination search queryObject={raw} diff --git a/packages/admin/dashboard/src/routes/price-lists/price-list-detail/components/price-list-product-section/price-list-product-section.tsx b/packages/admin/dashboard/src/routes/price-lists/price-list-detail/components/price-list-product-section/price-list-product-section.tsx index 1873712c9a..d867c925f6 100644 --- a/packages/admin/dashboard/src/routes/price-lists/price-list-detail/components/price-list-product-section/price-list-product-section.tsx +++ b/packages/admin/dashboard/src/routes/price-lists/price-list-detail/components/price-list-product-section/price-list-product-section.tsx @@ -141,7 +141,11 @@ export const PriceListProductSection = ({ pageSize={PAGE_SIZE} isLoading={isLoading} navigateTo={(row) => `/products/${row.original.id}`} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} commands={[ { action: handleEdit, diff --git a/packages/admin/dashboard/src/routes/price-lists/price-list-list/components/price-list-list-table/price-list-list-table.tsx b/packages/admin/dashboard/src/routes/price-lists/price-list-list/components/price-list-list-table/price-list-list-table.tsx index 355e485932..ec3d7d014b 100644 --- a/packages/admin/dashboard/src/routes/price-lists/price-list-list/components/price-list-list-table/price-list-list-table.tsx +++ b/packages/admin/dashboard/src/routes/price-lists/price-list-list/components/price-list-list-table/price-list-list-table.tsx @@ -58,7 +58,12 @@ export const PriceListListTable = () => { columns={columns} count={count} filters={filters} - orderBy={["title", "status", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "status", label: t("fields.status") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} pageSize={PAGE_SIZE} navigateTo={(row) => row.original.id} diff --git a/packages/admin/dashboard/src/routes/price-lists/price-list-prices-add/components/price-list-prices-add-form/price-list-prices-add-product-ids-form.tsx b/packages/admin/dashboard/src/routes/price-lists/price-list-prices-add/components/price-list-prices-add-form/price-list-prices-add-product-ids-form.tsx index f162001691..d144c6be4e 100644 --- a/packages/admin/dashboard/src/routes/price-lists/price-list-prices-add/components/price-list-prices-add-form/price-list-prices-add-product-ids-form.tsx +++ b/packages/admin/dashboard/src/routes/price-lists/price-list-prices-add/components/price-list-prices-add-form/price-list-prices-add-product-ids-form.tsx @@ -8,6 +8,7 @@ import { } from "@tanstack/react-table" import { useMemo, useState } from "react" import { UseFormReturn, useWatch } from "react-hook-form" +import { useTranslation } from "react-i18next" import { DataTable } from "../../../../../components/table/data-table" import { useProducts } from "../../../../../hooks/api/products" import { useProductTableColumns } from "../../../../../hooks/table/columns/use-product-table-columns" @@ -36,13 +37,17 @@ export const PriceListPricesAddProductIdsForm = ({ priceList, form, }: PriceListPricesAddProductIdsFormProps) => { + const { t } = useTranslation() const { control, setValue } = form const variantIdMap = useMemo(() => { - return priceList.prices.reduce((acc, curr) => { - acc[curr.variant_id] = true - return acc - }, {} as Record) + return priceList.prices.reduce( + (acc, curr) => { + acc[curr.variant_id] = true + return acc + }, + {} as Record + ) }, [priceList.prices]) const selectedIds = useWatch({ @@ -140,7 +145,12 @@ export const PriceListPricesAddProductIdsForm = ({ count={count} isLoading={isLoading} layout="fill" - orderBy={["title", "status", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "status", label: t("fields.status") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} pagination search queryObject={raw} diff --git a/packages/admin/dashboard/src/routes/product-tags/product-tag-detail/components/product-tag-product-section/product-tag-product-section.tsx b/packages/admin/dashboard/src/routes/product-tags/product-tag-detail/components/product-tag-product-section/product-tag-product-section.tsx index 44b221e0e1..dfb8e5fa41 100644 --- a/packages/admin/dashboard/src/routes/product-tags/product-tag-detail/components/product-tag-product-section/product-tag-product-section.tsx +++ b/packages/admin/dashboard/src/routes/product-tags/product-tag-detail/components/product-tag-product-section/product-tag-product-section.tsx @@ -62,7 +62,12 @@ export const ProductTagProductSection = ({ navigateTo={(row) => row.original.id} search pagination - orderBy={["title", "status", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "status", label: t("fields.status") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} /> ) diff --git a/packages/admin/dashboard/src/routes/product-tags/product-tag-list/components/product-tag-list-table/product-tag-list-table.tsx b/packages/admin/dashboard/src/routes/product-tags/product-tag-list/components/product-tag-list-table/product-tag-list-table.tsx index 067ea7f0c0..452c1e13b1 100644 --- a/packages/admin/dashboard/src/routes/product-tags/product-tag-list/components/product-tag-list-table/product-tag-list-table.tsx +++ b/packages/admin/dashboard/src/routes/product-tags/product-tag-list/components/product-tag-list-table/product-tag-list-table.tsx @@ -71,7 +71,11 @@ export const ProductTagListTable = () => { navigateTo={(row) => row.original.id} search pagination - orderBy={["value", "created_at", "updated_at"]} + orderBy={[ + { key: "value", label: t("fields.value") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} /> ) diff --git a/packages/admin/dashboard/src/routes/product-types/product-type-detail/components/product-type-product-section/product-type-product-section.tsx b/packages/admin/dashboard/src/routes/product-types/product-type-detail/components/product-type-product-section/product-type-product-section.tsx index 6a41ef2cd3..828602f5e3 100644 --- a/packages/admin/dashboard/src/routes/product-types/product-type-detail/components/product-type-product-section/product-type-product-section.tsx +++ b/packages/admin/dashboard/src/routes/product-types/product-type-detail/components/product-type-product-section/product-type-product-section.tsx @@ -56,7 +56,11 @@ export const ProductTypeProductSection = ({ count={count} pageSize={PAGE_SIZE} navigateTo={({ original }) => `/products/${original.id}`} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} search pagination diff --git a/packages/admin/dashboard/src/routes/product-types/product-type-list/components/product-type-list-table/product-type-list-table.tsx b/packages/admin/dashboard/src/routes/product-types/product-type-list/components/product-type-list-table/product-type-list-table.tsx index d0323d0208..a68ceaaff1 100644 --- a/packages/admin/dashboard/src/routes/product-types/product-type-list/components/product-type-list-table/product-type-list-table.tsx +++ b/packages/admin/dashboard/src/routes/product-types/product-type-list/components/product-type-list-table/product-type-list-table.tsx @@ -64,7 +64,11 @@ export const ProductTypeListTable = () => { columns={columns} pageSize={PAGE_SIZE} count={count} - orderBy={["value", "created_at", "updated_at"]} + orderBy={[ + { key: "value", label: t("fields.value") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} navigateTo={({ original }) => original.id} queryObject={raw} pagination diff --git a/packages/admin/dashboard/src/routes/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx b/packages/admin/dashboard/src/routes/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx index 11e58b78c0..e419a692cd 100644 --- a/packages/admin/dashboard/src/routes/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx +++ b/packages/admin/dashboard/src/routes/products/product-create/components/product-create-organize-form/components/product-create-sales-channel-stacked-modal/product-create-sales-channel-drawer.tsx @@ -138,7 +138,11 @@ export const ProductCreateSalesChannelStackedModal = ({ filters={filters} isLoading={isLoading} layout="fill" - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} search pagination diff --git a/packages/admin/dashboard/src/routes/products/product-detail/components/product-variant-section/product-variant-section.tsx b/packages/admin/dashboard/src/routes/products/product-detail/components/product-variant-section/product-variant-section.tsx index 4ccb321ea7..2ee6915337 100644 --- a/packages/admin/dashboard/src/routes/products/product-detail/components/product-variant-section/product-variant-section.tsx +++ b/packages/admin/dashboard/src/routes/products/product-detail/components/product-variant-section/product-variant-section.tsx @@ -1,16 +1,16 @@ import { PencilSquare, Plus } from "@medusajs/icons" -import { Container, Heading } from "@medusajs/ui" -import { useTranslation } from "react-i18next" -import { keepPreviousData } from "@tanstack/react-query" import { HttpTypes } from "@medusajs/types" +import { Container, Heading } from "@medusajs/ui" +import { keepPreviousData } from "@tanstack/react-query" +import { useTranslation } from "react-i18next" import { ActionMenu } from "../../../../../components/common/action-menu" import { DataTable } from "../../../../../components/table/data-table" +import { useProductVariants } from "../../../../../hooks/api/products" import { useDataTable } from "../../../../../hooks/use-data-table" import { useProductVariantTableColumns } from "./use-variant-table-columns" import { useProductVariantTableFilters } from "./use-variant-table-filters" import { useProductVariantTableQuery } from "./use-variant-table-query" -import { useProductVariants } from "../../../../../hooks/api/products" type ProductVariantSectionProps = { product: HttpTypes.AdminProduct @@ -86,7 +86,11 @@ export const ProductVariantSection = ({ count={count} pageSize={PAGE_SIZE} isLoading={isLoading} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} navigateTo={(row) => `/products/${row.original.product_id}/variants/${row.id}` } diff --git a/packages/admin/dashboard/src/routes/products/product-list/components/product-list-table/product-list-table.tsx b/packages/admin/dashboard/src/routes/products/product-list/components/product-list-table/product-list-table.tsx index d725a89315..cb9bc2dc77 100644 --- a/packages/admin/dashboard/src/routes/products/product-list/components/product-list-table/product-list-table.tsx +++ b/packages/admin/dashboard/src/routes/products/product-list/components/product-list-table/product-list-table.tsx @@ -83,7 +83,11 @@ export const ProductListTable = () => { isLoading={isLoading} queryObject={raw} navigateTo={(row) => `${row.original.id}`} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} noRecords={{ message: t("products.list.noRecordsMessage"), }} diff --git a/packages/admin/dashboard/src/routes/products/product-sales-channels/components/edit-sales-channels-form/edit-sales-channels-form.tsx b/packages/admin/dashboard/src/routes/products/product-sales-channels/components/edit-sales-channels-form/edit-sales-channels-form.tsx index b3ec19289b..85bca8b05b 100644 --- a/packages/admin/dashboard/src/routes/products/product-sales-channels/components/edit-sales-channels-form/edit-sales-channels-form.tsx +++ b/packages/admin/dashboard/src/routes/products/product-sales-channels/components/edit-sales-channels-form/edit-sales-channels-form.tsx @@ -132,7 +132,11 @@ export const EditSalesChannelsForm = ({ filters={filters} search="autofocus" pagination - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} layout="fill" /> diff --git a/packages/admin/dashboard/src/routes/promotions/promotion-list/components/promotion-list-table/promotion-list-table.tsx b/packages/admin/dashboard/src/routes/promotions/promotion-list/components/promotion-list-table/promotion-list-table.tsx index 6228dc90d4..8243ac82cd 100644 --- a/packages/admin/dashboard/src/routes/promotions/promotion-list/components/promotion-list-table/promotion-list-table.tsx +++ b/packages/admin/dashboard/src/routes/promotions/promotion-list/components/promotion-list-table/promotion-list-table.tsx @@ -73,7 +73,10 @@ export const PromotionListTable = () => { isLoading={isLoading} queryObject={raw} navigateTo={(row) => `${row.original.id}`} - orderBy={["created_at", "updated_at"]} + orderBy={[ + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} /> diff --git a/packages/admin/dashboard/src/routes/regions/region-add-countries/components/add-countries-form/add-countries-form.tsx b/packages/admin/dashboard/src/routes/regions/region-add-countries/components/add-countries-form/add-countries-form.tsx index 28b1122a45..26af6cacb9 100644 --- a/packages/admin/dashboard/src/routes/regions/region-add-countries/components/add-countries-form/add-countries-form.tsx +++ b/packages/admin/dashboard/src/routes/regions/region-add-countries/components/add-countries-form/add-countries-form.tsx @@ -150,7 +150,10 @@ export const AddCountriesForm = ({ region }: AddCountriesFormProps) => { search="autofocus" pagination layout="fill" - orderBy={["name", "code"]} + orderBy={[ + { key: "display_name", label: t("fields.name") }, + { key: "iso_2", label: t("fields.code") }, + ]} queryObject={raw} prefix={PREFIX} /> diff --git a/packages/admin/dashboard/src/routes/regions/region-create/components/create-region-form/create-region-form.tsx b/packages/admin/dashboard/src/routes/regions/region-create/components/create-region-form/create-region-form.tsx index 11b0888cbb..4e9d4e3cf6 100644 --- a/packages/admin/dashboard/src/routes/regions/region-create/components/create-region-form/create-region-form.tsx +++ b/packages/admin/dashboard/src/routes/regions/region-create/components/create-region-form/create-region-form.tsx @@ -364,7 +364,10 @@ export const CreateRegionForm = ({ columns={columns} count={count} pageSize={PAGE_SIZE} - orderBy={["name", "code"]} + orderBy={[ + { key: "display_name", label: t("fields.name") }, + { key: "iso_2", label: t("fields.code") }, + ]} pagination search="autofocus" layout="fill" diff --git a/packages/admin/dashboard/src/routes/regions/region-detail/components/region-country-section/region-country-section.tsx b/packages/admin/dashboard/src/routes/regions/region-detail/components/region-country-section/region-country-section.tsx index b1f8fc6d4b..8fb1c38a6e 100644 --- a/packages/admin/dashboard/src/routes/regions/region-detail/components/region-country-section/region-country-section.tsx +++ b/packages/admin/dashboard/src/routes/regions/region-detail/components/region-country-section/region-country-section.tsx @@ -120,7 +120,10 @@ export const RegionCountrySection = ({ region }: RegionCountrySectionProps) => { columns={columns} pageSize={PAGE_SIZE} count={count} - orderBy={["name", "code"]} + orderBy={[ + { key: "display_name", label: t("fields.name") }, + { key: "iso_2", label: t("fields.code") }, + ]} search pagination queryObject={raw} diff --git a/packages/admin/dashboard/src/routes/regions/region-list/components/region-list-table/region-list-table.tsx b/packages/admin/dashboard/src/routes/regions/region-list/components/region-list-table/region-list-table.tsx index 93b1020148..b6f8936c01 100644 --- a/packages/admin/dashboard/src/routes/regions/region-list/components/region-list-table/region-list-table.tsx +++ b/packages/admin/dashboard/src/routes/regions/region-list/components/region-list-table/region-list-table.tsx @@ -4,9 +4,9 @@ import { Button, Container, Heading, + Text, toast, usePrompt, - Text, } from "@medusajs/ui" import { keepPreviousData } from "@tanstack/react-query" import { createColumnHelper } from "@tanstack/react-table" @@ -83,7 +83,11 @@ export const RegionListTable = () => { pageSize={PAGE_SIZE} isLoading={isLoading} filters={filters} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} navigateTo={(row) => `${row.original.id}`} pagination search @@ -118,18 +122,14 @@ const RegionActions = ({ region }: { region: HttpTypes.AdminRegion }) => { return } - try { - await mutateAsync(undefined) - toast.success(t("general.success"), { - description: t("regions.toast.delete"), - dismissLabel: t("actions.close"), - }) - } catch (e) { - toast.error(t("general.error"), { - description: e.message, - dismissLabel: t("actions.close"), - }) - } + await mutateAsync(undefined, { + onSuccess: () => { + toast.success(t("regions.toast.delete")) + }, + onError: (e) => { + toast.error(e.message) + }, + }) } return ( diff --git a/packages/admin/dashboard/src/routes/sales-channels/sales-channel-add-products/components/add-products-to-sales-channel-form.tsx b/packages/admin/dashboard/src/routes/sales-channels/sales-channel-add-products/components/add-products-to-sales-channel-form.tsx index 23bff4d029..3a0c37dcc2 100644 --- a/packages/admin/dashboard/src/routes/sales-channels/sales-channel-add-products/components/add-products-to-sales-channel-form.tsx +++ b/packages/admin/dashboard/src/routes/sales-channels/sales-channel-add-products/components/add-products-to-sales-channel-form.tsx @@ -141,7 +141,12 @@ export const AddProductsToSalesChannelForm = ({ pageSize={PAGE_SIZE} isLoading={isLoading} filters={filters} - orderBy={["title", "status", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "status", label: t("fields.status") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} layout="fill" pagination diff --git a/packages/admin/dashboard/src/routes/sales-channels/sales-channel-detail/components/sales-channel-product-section/sales-channel-product-section.tsx b/packages/admin/dashboard/src/routes/sales-channels/sales-channel-detail/components/sales-channel-product-section/sales-channel-product-section.tsx index 95c7a73250..0276184dbd 100644 --- a/packages/admin/dashboard/src/routes/sales-channels/sales-channel-detail/components/sales-channel-product-section/sales-channel-product-section.tsx +++ b/packages/admin/dashboard/src/routes/sales-channels/sales-channel-detail/components/sales-channel-product-section/sales-channel-product-section.tsx @@ -135,7 +135,12 @@ export const SalesChannelProductSection = ({ filters={filters} navigateTo={(row) => `/products/${row.id}`} isLoading={isLoading} - orderBy={["title", "variants", "status", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "status", label: t("fields.status") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} queryObject={raw} noRecords={{ message: t("salesChannels.products.list.noRecordsMessage"), diff --git a/packages/admin/dashboard/src/routes/sales-channels/sales-channel-list/components/sales-channel-list-table.tsx b/packages/admin/dashboard/src/routes/sales-channels/sales-channel-list/components/sales-channel-list-table.tsx index 44811acf91..89d97dc742 100644 --- a/packages/admin/dashboard/src/routes/sales-channels/sales-channel-list/components/sales-channel-list-table.tsx +++ b/packages/admin/dashboard/src/routes/sales-channels/sales-channel-list/components/sales-channel-list-table.tsx @@ -84,7 +84,11 @@ export const SalesChannelListTable = () => { navigateTo={(row) => row.id} isLoading={isLoading} queryObject={raw} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} /> ) diff --git a/packages/admin/dashboard/src/routes/shipping-profiles/shipping-profiles-list/components/shipping-profile-list-table/shipping-profile-list-table.tsx b/packages/admin/dashboard/src/routes/shipping-profiles/shipping-profiles-list/components/shipping-profile-list-table/shipping-profile-list-table.tsx index 503f5898df..5c969364e8 100644 --- a/packages/admin/dashboard/src/routes/shipping-profiles/shipping-profiles-list/components/shipping-profile-list-table/shipping-profile-list-table.tsx +++ b/packages/admin/dashboard/src/routes/shipping-profiles/shipping-profiles-list/components/shipping-profile-list-table/shipping-profile-list-table.tsx @@ -61,7 +61,12 @@ export const ShippingProfileListTable = () => { count={count} columns={columns} filters={filters} - orderBy={["name", "type", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "type", label: t("fields.type") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} isLoading={isLoading} navigateTo={(row) => row.id} queryObject={raw} diff --git a/packages/admin/dashboard/src/routes/store/store-add-currencies/components/add-currencies-form/add-currencies-form.tsx b/packages/admin/dashboard/src/routes/store/store-add-currencies/components/add-currencies-form/add-currencies-form.tsx index 20bb214e1f..b1b4e2ffab 100644 --- a/packages/admin/dashboard/src/routes/store/store-add-currencies/components/add-currencies-form/add-currencies-form.tsx +++ b/packages/admin/dashboard/src/routes/store/store-add-currencies/components/add-currencies-form/add-currencies-form.tsx @@ -64,13 +64,16 @@ export const AddCurrenciesForm = ({ const form = useForm>({ defaultValues: { currencies: [], - pricePreferences: pricePreferences?.reduce((acc, curr) => { - if (curr.value) { - acc[curr.value] = curr.is_tax_inclusive - } + pricePreferences: pricePreferences?.reduce( + (acc, curr) => { + if (curr.value) { + acc[curr.value] = curr.is_tax_inclusive + } - return acc - }, {} as Record), + return acc + }, + {} as Record + ), }, resolver: zodResolver(AddCurrenciesSchema), }) @@ -192,7 +195,10 @@ export const AddCurrenciesForm = ({ pagination search="autofocus" prefix={PREFIX} - orderBy={["code", "name"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "code", label: t("fields.code") }, + ]} isLoading={isLoading} queryObject={raw} /> diff --git a/packages/admin/dashboard/src/routes/store/store-detail/components/store-currency-section/store-currencies-section.tsx/store-currency-section.tsx b/packages/admin/dashboard/src/routes/store/store-detail/components/store-currency-section/store-currencies-section.tsx/store-currency-section.tsx index fa59e8d2f1..33f921ee56 100644 --- a/packages/admin/dashboard/src/routes/store/store-detail/components/store-currency-section/store-currencies-section.tsx/store-currency-section.tsx +++ b/packages/admin/dashboard/src/routes/store/store-detail/components/store-currency-section/store-currencies-section.tsx/store-currency-section.tsx @@ -165,7 +165,10 @@ export const StoreCurrencySection = ({ store }: StoreCurrencySectionProps) => { />
{ + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState(initialRowState) @@ -206,7 +208,11 @@ const CustomerGroupTable = ({ count={count} isLoading={isLoading} filters={filters} - orderBy={["name", "created_at", "updated_at"]} + orderBy={[ + { key: "name", label: t("fields.name") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} layout="fill" pagination search @@ -264,6 +270,8 @@ const ProductTable = ({ intermediate, setIntermediate, }: TableImplementationProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState(initialRowState) @@ -336,7 +344,11 @@ const ProductTable = ({ count={count} isLoading={isLoading} filters={filters} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} layout="fill" pagination search @@ -394,6 +406,8 @@ const ProductCollectionTable = ({ intermediate, setIntermediate, }: TableImplementationProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState(initialRowState) @@ -466,7 +480,11 @@ const ProductCollectionTable = ({ count={count} isLoading={isLoading} filters={filters} - orderBy={["title", "created_at", "updated_at"]} + orderBy={[ + { key: "title", label: t("fields.title") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} layout="fill" pagination search @@ -524,6 +542,8 @@ const ProductTypeTable = ({ intermediate, setIntermediate, }: TableImplementationProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState(initialRowState) @@ -596,7 +616,11 @@ const ProductTypeTable = ({ count={count} isLoading={isLoading} filters={filters} - orderBy={["value", "created_at", "updated_at"]} + orderBy={[ + { key: "value", label: t("fields.value") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} layout="fill" pagination search @@ -654,6 +678,8 @@ const ProductTagTable = ({ intermediate, setIntermediate, }: TableImplementationProps) => { + const { t } = useTranslation() + const [rowSelection, setRowSelection] = useState(initialRowState) @@ -726,7 +752,11 @@ const ProductTagTable = ({ count={count} isLoading={isLoading} filters={filters} - orderBy={["value", "created_at", "updated_at"]} + orderBy={[ + { key: "value", label: t("fields.value") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} layout="fill" pagination search diff --git a/packages/admin/dashboard/src/routes/users/user-invite/components/invite-user-form/invite-user-form.tsx b/packages/admin/dashboard/src/routes/users/user-invite/components/invite-user-form/invite-user-form.tsx index f5ee3668aa..429ad2e161 100644 --- a/packages/admin/dashboard/src/routes/users/user-invite/components/invite-user-form/invite-user-form.tsx +++ b/packages/admin/dashboard/src/routes/users/user-invite/components/invite-user-form/invite-user-form.tsx @@ -168,7 +168,11 @@ export const InviteUserForm = () => { search="autofocus" isLoading={isLoading} queryObject={raw} - orderBy={["email", "created_at", "updated_at"]} + orderBy={[ + { key: "email", label: t("fields.email") }, + { key: "created_at", label: t("fields.createdAt") }, + { key: "updated_at", label: t("fields.updatedAt") }, + ]} /> diff --git a/packages/admin/dashboard/src/routes/users/user-list/components/user-list-table/user-list-table.tsx b/packages/admin/dashboard/src/routes/users/user-list/components/user-list-table/user-list-table.tsx index 59840cc978..a78ecb403a 100644 --- a/packages/admin/dashboard/src/routes/users/user-list/components/user-list-table/user-list-table.tsx +++ b/packages/admin/dashboard/src/routes/users/user-list/components/user-list-table/user-list-table.tsx @@ -55,7 +55,11 @@ export const UserListTable = () => { count={count} pageSize={PAGE_SIZE} isLoading={isLoading} - orderBy={["email", "first_name", "last_name"]} + orderBy={[ + { key: "email", label: t("fields.email") }, + { key: "first_name", label: t("fields.firstName") }, + { key: "last_name", label: t("fields.lastName") }, + ]} navigateTo={(row) => `${row.id}`} search pagination diff --git a/packages/core/types/src/api-key/common/api-key.ts b/packages/core/types/src/api-key/common/api-key.ts index 53878ebc66..8d252945d5 100644 --- a/packages/core/types/src/api-key/common/api-key.ts +++ b/packages/core/types/src/api-key/common/api-key.ts @@ -50,6 +50,16 @@ export interface ApiKeyDTO { */ created_at: Date + /** + * The date the API key was updated. + */ + updated_at: Date + + /** + * The date the API key was deleted. + */ + deleted_at: Date | null + /** * Who revoked the API key. For example, * the ID of the user that revoked it. diff --git a/packages/core/types/src/http/api-key/admin/responses.ts b/packages/core/types/src/http/api-key/admin/responses.ts index c51545a2ea..5bc1518fa6 100644 --- a/packages/core/types/src/http/api-key/admin/responses.ts +++ b/packages/core/types/src/http/api-key/admin/responses.ts @@ -10,8 +10,10 @@ interface AdminApiKey { last_used_at: Date | null created_by: string created_at: Date + updated_at: Date revoked_by: string | null revoked_at: Date | null + deleted_at: Date | null } export interface AdminApiKeyResponse { diff --git a/packages/core/types/src/http/campaign/admin/responses.ts b/packages/core/types/src/http/campaign/admin/responses.ts index b035a0116e..6580ed1e68 100644 --- a/packages/core/types/src/http/campaign/admin/responses.ts +++ b/packages/core/types/src/http/campaign/admin/responses.ts @@ -16,6 +16,9 @@ export interface AdminCampaign { limit: number used: number } + created_at: string + updated_at: string + deleted_at: string | null } export type AdminCampaignListResponse = PaginatedResponse<{ diff --git a/packages/core/types/src/http/promotion/common.ts b/packages/core/types/src/http/promotion/common.ts index 7d5d4037f5..258bfaef12 100644 --- a/packages/core/types/src/http/promotion/common.ts +++ b/packages/core/types/src/http/promotion/common.ts @@ -39,6 +39,9 @@ export interface BasePromotion { rules?: BasePromotionRule[] campaign_id?: string campaign?: AdminCampaign + created_at: string + updated_at: string + deleted_at: string | null } export interface BasePromotionRuleValue {