mirror of
https://github.com/docmost/docmost.git
synced 2026-08-25 15:57:11 +08:00
feat: show last updated time on search results
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
|||||||
} from "@/features/search/types/search.types";
|
} from "@/features/search/types/search.types";
|
||||||
import DOMPurify from "dompurify";
|
import DOMPurify from "dompurify";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { timeAgo } from "@/lib/time.ts";
|
||||||
|
|
||||||
interface SearchResultItemProps {
|
interface SearchResultItemProps {
|
||||||
result: IPageSearch | IAttachmentSearch;
|
result: IPageSearch | IAttachmentSearch;
|
||||||
@@ -68,8 +69,13 @@ export function SearchResultItem({
|
|||||||
<IconFile size={16} />
|
<IconFile size={16} />
|
||||||
</Center>
|
</Center>
|
||||||
|
|
||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
<Text>{attachmentResult.fileName}</Text>
|
<Group justify="space-between" wrap="nowrap" gap="xs">
|
||||||
|
<Text truncate>{attachmentResult.fileName}</Text>
|
||||||
|
<Text size="xs" c="dimmed" style={{ flexShrink: 0 }}>
|
||||||
|
{timeAgo(attachmentResult.updatedAt)}
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
<Text size="xs" opacity={0.6}>
|
<Text size="xs" opacity={0.6}>
|
||||||
{attachmentResult.space.name} • {attachmentResult.page.title}
|
{attachmentResult.space.name} • {attachmentResult.page.title}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -117,8 +123,13 @@ export function SearchResultItem({
|
|||||||
<Group wrap="nowrap" w="100%">
|
<Group wrap="nowrap" w="100%">
|
||||||
<Center>{getPageIcon(pageResult?.icon)}</Center>
|
<Center>{getPageIcon(pageResult?.icon)}</Center>
|
||||||
|
|
||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
<Text>{pageResult.title}</Text>
|
<Group justify="space-between" wrap="nowrap" gap="xs">
|
||||||
|
<Text truncate>{pageResult.title}</Text>
|
||||||
|
<Text size="xs" c="dimmed" style={{ flexShrink: 0 }}>
|
||||||
|
{timeAgo(pageResult.updatedAt)}
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
|
||||||
{showSpace && pageResult.space && (
|
{showSpace && pageResult.space && (
|
||||||
<Badge variant="light" size="xs" color="gray">
|
<Badge variant="light" size="xs" color="gray">
|
||||||
|
|||||||
Reference in New Issue
Block a user