fix(search): harden authorized results and ordering

This commit is contained in:
2026-07-21 17:42:22 +08:00
parent 000de4bcdb
commit 8cc130244b
12 changed files with 405 additions and 64 deletions

View File

@@ -111,10 +111,11 @@ export function ProjectTopbar({
)
}
function searchTypeLabel(type: SearchResultDTO['type']) {
function searchTypeLabel(type: string) {
if (type === 'project') return '项目'
if (type === 'task') return '任务'
return '笔记'
if (type === 'note') return '笔记'
return '未知'
}
function isDesktopRuntime() {

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>
)
}