🐛 fix: Update announcement page to format creation date and enhance content display

This commit is contained in:
web 2025-09-23 05:12:36 -07:00
parent 2bff15fd13
commit 8445e302e6
2 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import { queryAnnouncement } from '@/services/user/announcement';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { Timeline } from '@workspace/ui/components/timeline'; import { Timeline } from '@workspace/ui/components/timeline';
import { Markdown } from '@workspace/ui/custom-components/markdown'; import { Markdown } from '@workspace/ui/custom-components/markdown';
import { formatDate } from '@workspace/ui/utils';
export default function Page() { export default function Page() {
const { data } = useQuery({ const { data } = useQuery({
@ -23,8 +24,8 @@ export default function Page() {
<Timeline <Timeline
data={ data={
data.map((item) => ({ data.map((item) => ({
title: item.title, title: String(formatDate(item.created_at, false)),
content: <Markdown>{item.content}</Markdown>, content: <Markdown>{`### ${item.title}\n${item.content}`}</Markdown>,
})) || [] })) || []
} }
/> />

View File

@ -1,5 +1,6 @@
'use client'; 'use client';
import { Empty } from '@/components/empty';
import { NEXT_PUBLIC_HIDDEN_TUTORIAL_DOCUMENT } from '@/config/constants'; import { NEXT_PUBLIC_HIDDEN_TUTORIAL_DOCUMENT } from '@/config/constants';
import { queryDocumentList } from '@/services/user/document'; import { queryDocumentList } from '@/services/user/document';
import { getTutorialList } from '@/utils/tutorial'; import { getTutorialList } from '@/utils/tutorial';
@ -34,7 +35,7 @@ export default function Page() {
}, },
enabled: NEXT_PUBLIC_HIDDEN_TUTORIAL_DOCUMENT !== 'true', enabled: NEXT_PUBLIC_HIDDEN_TUTORIAL_DOCUMENT !== 'true',
}); });
if (!DocumentList && !TutorialList) return <Empty />;
return ( return (
<div className='space-y-4'> <div className='space-y-4'>
{DocumentList?.length > 0 && ( {DocumentList?.length > 0 && (