fix(search): harden authorized results and ordering

This commit is contained in:
2026-07-21 17:42:22 +08:00
parent 110423406b
commit 60e5ef0a87
13 changed files with 481 additions and 80 deletions

View File

@@ -0,0 +1,37 @@
import { Alert, Button, Descriptions, Modal, Space, Tag, Typography } from '@arco-design/web-react'
import type { SearchResultDTO } from '../../api/search'
const { Paragraph, Text, Title } = Typography
export function SearchResultPreview({
result,
onClose,
}: {
result: SearchResultDTO | null
onClose: () => void
}) {
return (
<Modal
title="授权对象预览"
visible={result !== null}
onCancel={onClose}
footer={<Button type="primary" onClick={onClose}></Button>}
unmountOnExit
>
{result && (
<Space direction="vertical" size={16} style={{ width: '100%' }}>
<Alert type="info" content="仅显示被授权对象,不会加载完整项目工作区。" />
<Space direction="vertical" size={8} style={{ width: '100%' }}>
<Tag color="arcoblue">{result.type === 'task' ? '任务' : '笔记'}</Tag>
<Title heading={6}>{result.title}</Title>
{result.snippet && <Paragraph>{result.snippet}</Paragraph>}
</Space>
<Descriptions
column={1}
data={[{ label: '所属项目', value: <Text>{result.projectId}</Text> }]}
/>
</Space>
)}
</Modal>
)
}