feat(events): refine aggregation ordering and presentation
This commit is contained in:
@@ -38,22 +38,22 @@ interface AccountEvent {
|
||||
platform_event_at?: string | null;
|
||||
}
|
||||
|
||||
const eventTypeColors: Record<string, string> = {
|
||||
like: 'magenta', comment: 'blue', follow: 'purple', repost: 'orange',
|
||||
};
|
||||
|
||||
const columns: ColumnsType<AccountEvent> = [
|
||||
{ title: '账号', render: (_, event) => <Typography.Text>{event.account_name || '待登录'}</Typography.Text> },
|
||||
{ title: '发生时间', dataIndex: 'platform_event_at', render: (value?: string | null) => value ? dateTime(value) : '—' },
|
||||
{ title: '接收时间', dataIndex: 'received_at', render: (value: string) => dateTime(value) },
|
||||
{ title: '事件类型', dataIndex: 'event_type', render: (value: string) => <Tag>{eventTypeLabel(value)}</Tag> },
|
||||
{ title: '所属账号', render: (_, event) => <Typography.Text>{event.account_name || '待登录'}</Typography.Text> },
|
||||
{ title: '事件类型', dataIndex: 'event_type', render: (value: string) => <Tag color={eventTypeColors[value]}>{eventTypeLabel(value)}</Tag> },
|
||||
{ title: '互动用户', render: (_, event) => {
|
||||
const href = eventUserProfileURL(event.interactor_sec_uid);
|
||||
const name = event.interactor_name || '昵称未获取';
|
||||
return <Flex vertical>
|
||||
{href ? <Typography.Link href={href} target="_blank" rel="noreferrer">{name}</Typography.Link>
|
||||
: <Tooltip title="用户主页资料未获取"><Typography.Text>{name}</Typography.Text></Tooltip>}
|
||||
<Typography.Text type="secondary">UID:{event.interactor_uid || '—'}</Typography.Text>
|
||||
</Flex>;
|
||||
return href ? <Typography.Link href={href} target="_blank" rel="noreferrer">{name}</Typography.Link>
|
||||
: <Tooltip title="用户主页资料未获取"><Typography.Text>{name}</Typography.Text></Tooltip>;
|
||||
} },
|
||||
{ title: '内容', render: (_, event) => (
|
||||
<Typography.Paragraph ellipsis={{ rows: 2, expandable: true, tooltip: true }}>
|
||||
{ title: '内容', width: '30%', render: (_, event) => (
|
||||
<Typography.Paragraph>
|
||||
{event.message_text || messageTypeLabel(event.message_type)}
|
||||
</Typography.Paragraph>
|
||||
) },
|
||||
@@ -63,7 +63,7 @@ const columns: ColumnsType<AccountEvent> = [
|
||||
: <Tooltip title={event.work_cover_error || '封面未缓存'}><Avatar shape="square" size={48} icon={<VideoCameraOutlined />} /></Tooltip>}
|
||||
</Typography.Link>
|
||||
) : '—' },
|
||||
{ title: '来源', dataIndex: 'baseline', render: (baseline: boolean) => baseline ? <Tag>历史记录</Tag> : <Typography.Text type="secondary">开启后通知</Typography.Text> },
|
||||
{ title: '来源', dataIndex: 'baseline', render: (baseline: boolean) => <Tag color={baseline ? 'gold' : 'cyan'}>{baseline ? '同步' : '通知'}</Tag> },
|
||||
];
|
||||
|
||||
export default function EventAggregationPage() {
|
||||
@@ -135,7 +135,7 @@ export default function EventAggregationPage() {
|
||||
<Typography.Paragraph type="secondary">仅展示已开启监听账号的事件;停止监听的账号不在此列表展示,历史记录仍保留。时间范围按接收时间计算,仅记录事件,不执行自动互动。私信在独立收件箱展示。</Typography.Paragraph>
|
||||
{error ? <Alert type="error" showIcon title="事件读取失败" description={conflictMessage(error, '请检查服务状态后重试。')} style={{ marginBottom: 16 }} /> : null}
|
||||
<Table<AccountEvent> rowKey="id" columns={columns} dataSource={events} loading={pending} sticky={sticky}
|
||||
scroll={{ x: 'max-content' }}
|
||||
tableLayout="fixed"
|
||||
locale={{ emptyText: '尚未收到事件。请在“我的账号”开启监听,并保持账号浏览器运行。' }}
|
||||
pagination={{ ...tablePagination(), current: pagination.page, pageSize: pagination.pageSize, total,
|
||||
onChange: (page, pageSize) => setPagination({ page: pageSize !== pagination.pageSize ? 1 : page, pageSize }) }} />
|
||||
|
||||
Reference in New Issue
Block a user