import { Typography } from 'antd'; import React from 'react'; import XinTable from '@/components/XinTable'; import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings'; import type IForumPostLike from '@/domain/iForumPostLike'; import { useTranslation } from 'react-i18next'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; const { Title, Text } = Typography; dayjs.extend(relativeTime); const Table: React.FC = () => { const { t } = useTranslation(); const columns: XinTableColumn[] = [ { title: t('forum.post-like.id'), dataIndex: 'id', hideInForm: true, sorter: true, align: 'center', width: 80, }, { title: t('forum.post-like.post_id'), dataIndex: 'post_id', valueType: 'text', align: 'center', }, { title: t('forum.post-like.user_id'), dataIndex: 'user_id', valueType: 'text', align: 'center', hideInSearch: true, }, { title: t('forum.post-like.created_at'), hideInForm: true, hideInSearch: true, dataIndex: 'created_at', align: 'center', render: (value: string) => (value ? dayjs(value).fromNow() : '-'), }, ]; const tableProps: XinTableProps = { api: '/forum/post-like', columns, rowKey: 'id', accessName: 'forum.post-like', createShow: false, editShow: false, formProps: { grid: true, colProps: { span: 12 }, rowProps: { gutter: [30, 0] }, layout: 'vertical', }, modalProps: { width: 500, }, cardProps: { variant: 'borderless', }, pagination: { size: 'small', style: { marginBottom: 0 }, }, }; return ( <>
{t('forum.post-like.page.title')} {t('forum.post-like.page.description')}
{...tableProps} /> ); }; export default Table;