From f7b648f25e8ef7f370026825f1b7408dda3da0bc Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 5 Nov 2025 17:33:57 +0800 Subject: [PATCH] feat(aiChat): conditionally render floating panel based on view type style: adjust padding in ListItem component for better spacing --- .../renderer/src/hooks/biz/useShowEntryDetailsColumn.ts | 7 ++----- .../ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx | 6 +++--- .../renderer/src/modules/app-layout/ai/AIChatLayout.tsx | 7 ++++++- .../modules/entry-column/templates/list-item-template.tsx | 2 +- packages/internal/shared/src/settings/defaults.ts | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/desktop/layer/renderer/src/hooks/biz/useShowEntryDetailsColumn.ts b/apps/desktop/layer/renderer/src/hooks/biz/useShowEntryDetailsColumn.ts index 6538895e1..6aed66cd3 100644 --- a/apps/desktop/layer/renderer/src/hooks/biz/useShowEntryDetailsColumn.ts +++ b/apps/desktop/layer/renderer/src/hooks/biz/useShowEntryDetailsColumn.ts @@ -4,16 +4,13 @@ import { AIChatPanelStyle, useAIChatPanelStyle, useAIPanelVisibility } from "~/a import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams" export const useShowEntryDetailsColumn = () => { - const { view, isInEntry } = useRouteParamsSelector((s) => ({ + const { view } = useRouteParamsSelector((s) => ({ view: s.view, - isInEntry: s.entryId && !s.isPendingEntry, })) const aiPanelStyle = useAIChatPanelStyle() const isAIPanelVisible = useAIPanelVisibility() return ( - !getView(view).wideMode && - (aiPanelStyle === AIChatPanelStyle.Floating || !isAIPanelVisible) && - isInEntry + !getView(view).wideMode && (aiPanelStyle === AIChatPanelStyle.Floating || !isAIPanelVisible) ) } diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx index 4f9182ac1..0dc3d072a 100644 --- a/apps/desktop/layer/renderer/src/modules/app-layout/ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx +++ b/apps/desktop/layer/renderer/src/modules/app-layout/ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx @@ -356,11 +356,11 @@ const AIEnhancedTimelineLayoutImpl = () => { {aiChatLayoutNode} )} + + {/* Floating panel - renders outside layout flow */} + {aiPanelStyle === AIChatPanelStyle.Floating && } )} - - {/* Floating panel - renders outside layout flow */} - {aiPanelStyle === AIChatPanelStyle.Floating && } ) } diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/ai/AIChatLayout.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/ai/AIChatLayout.tsx index f9abc6c08..4d87de006 100644 --- a/apps/desktop/layer/renderer/src/modules/app-layout/ai/AIChatLayout.tsx +++ b/apps/desktop/layer/renderer/src/modules/app-layout/ai/AIChatLayout.tsx @@ -1,6 +1,8 @@ +import { FeedViewType } from "@follow/constants" import type { FC } from "react" import { AIChatPanelStyle, useAIChatPanelStyle } from "~/atoms/settings/ai" +import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams" import { AIChatFixedPanel } from "./AIChatFixedPanel" import { AIChatFloatingPanel } from "./AIChatFloatingPanel" @@ -29,8 +31,11 @@ export interface AIChatLayoutProps */ export const AIChatLayout: FC = ({ ...props }) => { const panelStyle = useAIChatPanelStyle() + const { isAllView } = useRouteParamsSelector((s) => ({ + isAllView: s.view === FeedViewType.All, + })) - if (panelStyle === AIChatPanelStyle.Floating) { + if (panelStyle === AIChatPanelStyle.Floating && !isAllView) { return } return diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/templates/list-item-template.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/templates/list-item-template.tsx index 280f4b4aa..4ce7d38cf 100644 --- a/apps/desktop/layer/renderer/src/modules/entry-column/templates/list-item-template.tsx +++ b/apps/desktop/layer/renderer/src/modules/entry-column/templates/list-item-template.tsx @@ -169,7 +169,7 @@ export function ListItem({ return (