mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-06 03:30:25 -05:00
🐛 fix: Update announcement page to format creation date and enhance content display
This commit is contained in:
parent
2bff15fd13
commit
8445e302e6
@ -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>,
|
||||||
})) || []
|
})) || []
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -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 && (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user