From c3e2ea692135f0b351667190852c25952de6ced2 Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 17 Feb 2025 17:57:16 +0800 Subject: [PATCH] feat(timeline): enhance timeline selector panel with close button and conditional rendering Add close button to timeline selector panel and implement conditional rendering based on timeline column visibility. Improve panel header layout and interaction. Signed-off-by: Innei --- .../ui/markdown/components/TocItem.tsx | 4 +- .../timeline-column/TimelineSelector.tsx | 115 +++++++++++------- 2 files changed, 71 insertions(+), 48 deletions(-) diff --git a/apps/renderer/src/components/ui/markdown/components/TocItem.tsx b/apps/renderer/src/components/ui/markdown/components/TocItem.tsx index 24afd26e3..b45c61384 100644 --- a/apps/renderer/src/components/ui/markdown/components/TocItem.tsx +++ b/apps/renderer/src/components/ui/markdown/components/TocItem.tsx @@ -41,7 +41,9 @@ export const TocItem: FC = memo((props) => { ? { paddingLeft: `${(depth - rootDepth) * 12}px`, } - : undefined + : { + lineHeight: "24px", + } } data-depth={depth} onClick={useCallback( diff --git a/apps/renderer/src/modules/timeline-column/TimelineSelector.tsx b/apps/renderer/src/modules/timeline-column/TimelineSelector.tsx index c45bc4d83..884632fd7 100644 --- a/apps/renderer/src/modules/timeline-column/TimelineSelector.tsx +++ b/apps/renderer/src/modules/timeline-column/TimelineSelector.tsx @@ -13,6 +13,7 @@ import { useTranslation } from "react-i18next" import { useShowContextMenu } from "~/atoms/context-menu" import { useUISettingKey } from "~/atoms/settings/ui" +import { useTimelineColumnShow } from "~/atoms/sidebar" import { ROUTE_TIMELINE_OF_INBOX, ROUTE_TIMELINE_OF_LIST, @@ -92,6 +93,7 @@ export const TimelineSelector = ({ timelineId }: { timelineId: string | undefine }) } }, [animateControls, shouldOpen]) + const timelineColumnShow = useTimelineColumnShow() return ( @@ -122,53 +124,72 @@ export const TimelineSelector = ({ timelineId }: { timelineId: string | undefine - - - -
Quick Selector
- - Views - {timelineList.views.map((timelineId) => ( - - ))} - - Inboxes - {timelineList.inboxes.map((timelineId) => ( - - ))} - - Lists - {timelineList.lists.map((timelineId) => ( - - ))} - -
-
-
+ {timelineColumnShow && ( + + + + {shouldOpen && ( + <> +
+ Quick Selector + + +
+ +
Views
+ {timelineList.views.map((timelineId) => ( + + ))} + +
Inboxes
+ {timelineList.inboxes.map((timelineId) => ( + + ))} + +
Lists
+ {timelineList.lists.map((timelineId) => ( + + ))} +
+ + )} +
+
+
+ )}
) }