import moment from "moment" import { useMemo } from "react" import { useTranslation } from "react-i18next" import { getColor } from "../../../utils/color" import CustomerAvatarItem from "../../molecules/customer-avatar-item" export const useCustomerColumns = () => { const { t } = useTranslation() const columns = useMemo( () => [ { Header: t("customer-table-date-added", "Date added"), accessor: "created_at", // accessor is the "key" in the data Cell: ({ cell: { value } }) => moment(value).format("DD MMM YYYY"), }, { Header: t("customer-table-name", "Name"), accessor: "customer", Cell: ({ row }) => ( ), }, { Header: t("customer-table-email", "Email"), accessor: "email", }, { Header: "", accessor: "col", }, { accessor: "orders", Header: () => (
{t("customer-table-orders", "Orders")}
), Cell: ({ cell: { value } }) => (
{value?.length || 0}
), }, { Header: "", accessor: "col-2", }, ], [] ) return [columns] }