feat: create return reason (#8516)

* feat: create and edit return reasons

* add prop to hide data table header

* make return reasons searchable

* hide table header
This commit is contained in:
Christian
2024-08-12 07:47:07 +02:00
committed by GitHub
parent a19c562bec
commit 4eb2e8379f
18 changed files with 482 additions and 82 deletions
@@ -1,25 +1,30 @@
import { HttpTypes } from "@medusajs/types"
import { Badge } from "@medusajs/ui"
import { createColumnHelper } from "@tanstack/react-table"
import { useMemo } from "react"
import { useTranslation } from "react-i18next"
import { TextCell } from "../../../components/table/table-cells/common/text-cell"
const columnHelper = createColumnHelper<HttpTypes.AdminReturnReason>()
export const useReturnReasonTableColumns = () => {
const { t } = useTranslation()
return useMemo(
() => [
columnHelper.accessor("value", {
header: () => t("fields.value"),
cell: ({ getValue }) => <TextCell text={getValue()} />,
cell: ({ getValue }) => <Badge size="2xsmall">{getValue()}</Badge>,
}),
columnHelper.accessor("label", {
header: () => t("fields.createdAt"),
cell: ({ getValue }) => <TextCell text={getValue()} />,
cell: ({ row }) => {
const { label, description } = row.original
return (
<div className="flex h-full w-full flex-col justify-center py-4">
<span className="truncate font-medium">{label}</span>
<span className="truncate">
{description ? description : "-"}
</span>
</div>
)
},
}),
],
[t]
[]
)
}