import moment from "moment" import { useMemo } from "react" import { useTranslation } from "react-i18next" import Tooltip from "../../atoms/tooltip" const useCollectionTableColumn = () => { const { t } = useTranslation() const columns = useMemo( () => [ { Header: t("collections-table-title", "Title"), accessor: "title", Cell: ({ row: { original } }) => { return
{original.title}
}, }, { Header: t("collections-table-handle", "Handle"), accessor: "handle", Cell: ({ cell: { value } }) =>
/{value}
, }, { Header: t("collections-table-created-at", "Created At"), accessor: "created_at", Cell: ({ cell: { value } }) => ( {moment(value).format("DD MMM YYYY")} ), }, { Header: t("collections-table-updated-at", "Updated At"), accessor: "updated_at", Cell: ({ cell: { value } }) => ( {moment(value).format("DD MMM YYYY")} ), }, { Header: t("collections-table-products", "Products"), accessor: "products", Cell: ({ cell: { value } }) => { return
{value?.length || "-"}
}, }, ], [] ) return [columns] } export default useCollectionTableColumn