🕒 feat(ui): standardize Timelines to left mode and unify time display
- Switch Semi UI Timeline to mode="left" in: - web/src/components/layout/NoticeModal.jsx - web/src/components/dashboard/AnnouncementsPanel.jsx - Show both relative and absolute time in the `time` prop (e.g. "3 days ago 2025-02-18 10:30") - Move auxiliary description to the `extra` prop and remove duplicate rendering from content area - Keep original `extra` data intact; compute and pass: - `time`: absolute time (yyyy-MM-dd HH:mm) - `relative`: relative time (e.g., "3 days ago") - Update data assembly to expose `time` and `relative` without overwriting `extra`: - web/src/components/dashboard/index.jsx - No i18n changes; no linter errors introduced Why: Aligns Timeline layout across the app and clarifies time context by combining relative and absolute timestamps while preserving auxiliary notes via `extra`.
This commit is contained in:
@@ -108,10 +108,18 @@ const Dashboard = () => {
|
||||
|
||||
// ========== 数据准备 ==========
|
||||
const apiInfoData = statusState?.status?.api_info || [];
|
||||
const announcementData = (statusState?.status?.announcements || []).map(item => ({
|
||||
...item,
|
||||
time: getRelativeTime(item.publishDate)
|
||||
}));
|
||||
const announcementData = (statusState?.status?.announcements || []).map(item => {
|
||||
const pubDate = item?.publishDate ? new Date(item.publishDate) : null;
|
||||
const absoluteTime = pubDate && !isNaN(pubDate.getTime())
|
||||
? `${pubDate.getFullYear()}-${String(pubDate.getMonth() + 1).padStart(2, '0')}-${String(pubDate.getDate()).padStart(2, '0')} ${String(pubDate.getHours()).padStart(2, '0')}:${String(pubDate.getMinutes()).padStart(2, '0')}`
|
||||
: (item?.publishDate || '');
|
||||
const relativeTime = getRelativeTime(item.publishDate);
|
||||
return ({
|
||||
...item,
|
||||
time: absoluteTime,
|
||||
relative: relativeTime
|
||||
});
|
||||
});
|
||||
const faqData = statusState?.status?.faq || [];
|
||||
|
||||
const uptimeLegendData = Object.entries(UPTIME_STATUS_MAP).map(([status, info]) => ({
|
||||
|
||||
Reference in New Issue
Block a user