feat(dashboard,medusa,ui): Manual gift cards + cleanup (#6380)
**Dashboard** - Adds different views for managing manual/custom gift cards (not associated with a product gift card). - Cleans up several table implementations to use new DataTable component. - Minor cleanup of translation file. **Medusa** - Adds missing query params for list endpoints in the following admin domains: /customers, /customer-groups, /collections, and /gift-cards. **UI** - Adds new sizes for Badge component. **Note for review** Since this PR contains updates to the translation keys, it touches a lot of files. For the review the parts that are relevant are: the /gift-cards domain of admin, the table overview of collections, customers, and customer groups. And the changes to the list endpoints in the core.
This commit is contained in:
committed by
GitHub
parent
bc2a63782b
commit
d37ff8024d
@@ -10,27 +10,29 @@ import {
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
import { useSearchParams } from "react-router-dom"
|
||||
|
||||
type UseDataTableProps<TData, TValue> = {
|
||||
type UseDataTableProps<TData> = {
|
||||
data?: TData[]
|
||||
columns: ColumnDef<TData, TValue>[]
|
||||
columns: ColumnDef<TData, any>[]
|
||||
count?: number
|
||||
pageSize?: number
|
||||
enableRowSelection?: boolean | ((row: Row<TData>) => boolean)
|
||||
enablePagination?: boolean
|
||||
getRowId?: (original: TData, index: number) => string
|
||||
meta?: Record<string, unknown>
|
||||
prefix?: string
|
||||
}
|
||||
|
||||
export const useDataTable = <TData, TValue>({
|
||||
export const useDataTable = <TData,>({
|
||||
data = [],
|
||||
columns,
|
||||
count = 0,
|
||||
pageSize: _pageSize = 50,
|
||||
pageSize: _pageSize = 20,
|
||||
enablePagination = true,
|
||||
enableRowSelection = false,
|
||||
getRowId,
|
||||
meta,
|
||||
prefix,
|
||||
}: UseDataTableProps<TData, TValue>) => {
|
||||
}: UseDataTableProps<TData>) => {
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
const offsetKey = `${prefix ? `${prefix}_` : ""}offset`
|
||||
const offset = searchParams.get(offsetKey)
|
||||
@@ -106,6 +108,7 @@ export const useDataTable = <TData, TValue>({
|
||||
? getPaginationRowModel()
|
||||
: undefined,
|
||||
manualPagination: enablePagination ? true : undefined,
|
||||
meta,
|
||||
})
|
||||
|
||||
return { table }
|
||||
|
||||
Reference in New Issue
Block a user