import { Tag, Typography } from 'antd'; import React from 'react'; import XinTable from '@/components/XinTable'; import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings'; import type ITaskBid from '@/domain/iTaskBid'; 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('task.bid.id'), dataIndex: 'id', hideInForm: true, sorter: true, align: 'center', width: 80, }, { title: t('task.bid.task_id'), dataIndex: 'task_id', valueType: 'text', align: 'center', }, { title: t('task.bid.user_id'), dataIndex: 'user_id', valueType: 'text', align: 'center', }, { title: t('task.bid.price'), dataIndex: 'price', hideInForm: true, align: 'center', render: (value: string) => `¥${value || '0.00'}`, }, { title: t('task.bid.message'), dataIndex: 'message', valueType: 'text', align: 'center', }, { title: t('task.bid.status'), dataIndex: 'status', valueType: 'text', align: 'center', }, { title: t('task.bid.accepted_at'), dataIndex: 'accepted_at', hideInForm: true, hideInSearch: true, align: 'center', render: (value: string) => (value ? dayjs(value).fromNow() : '-'), }, { title: t('task.bid.created_at'), hideInForm: true, hideInSearch: true, dataIndex: 'created_at', align: 'center', render: (value: string) => (value ? dayjs(value).fromNow() : '-'), }, { title: t('task.bid.updated_at'), hideInForm: true, hideInSearch: true, dataIndex: 'updated_at', align: 'center', render: (value: string) => (value ? dayjs(value).fromNow() : '-'), }, ]; const tableProps: XinTableProps = { api: '/task/bid', columns, rowKey: 'id', accessName: 'task.bid', formProps: { grid: true, colProps: { span: 12 }, rowProps: { gutter: [30, 0] }, layout: 'vertical', }, modalProps: { width: 800, }, cardProps: { variant: 'borderless', }, pagination: { size: 'small', style: { marginBottom: 0 }, }, }; return ( <>
{t('task.bid.page.title')} {t('task.bid.page.description')}
{...tableProps} /> ); }; export default Table;