feat(aiChat): conditionally render floating panel based on view type
style: adjust padding in ListItem component for better spacing
This commit is contained in:
@@ -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)
|
||||
)
|
||||
}
|
||||
|
||||
+3
-3
@@ -356,11 +356,11 @@ const AIEnhancedTimelineLayoutImpl = () => {
|
||||
{aiChatLayoutNode}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Floating panel - renders outside layout flow */}
|
||||
{aiPanelStyle === AIChatPanelStyle.Floating && <AIChatLayout key="ai-chat-layout" />}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Floating panel - renders outside layout flow */}
|
||||
{aiPanelStyle === AIChatPanelStyle.Floating && <AIChatLayout key="ai-chat-layout" />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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<AIChatLayoutProps> = ({ ...props }) => {
|
||||
const panelStyle = useAIChatPanelStyle()
|
||||
const { isAllView } = useRouteParamsSelector((s) => ({
|
||||
isAllView: s.view === FeedViewType.All,
|
||||
}))
|
||||
|
||||
if (panelStyle === AIChatPanelStyle.Floating) {
|
||||
if (panelStyle === AIChatPanelStyle.Floating && !isAllView) {
|
||||
return <AIChatFloatingPanel {...props} />
|
||||
}
|
||||
return <AIChatFixedPanel {...props} />
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ export function ListItem({
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"group relative flex cursor-menu py-3",
|
||||
"group relative flex cursor-menu py-3.5",
|
||||
!isRead &&
|
||||
"before:absolute before:-left-3 before:top-5 before:block before:size-2 before:rounded-full before:bg-accent",
|
||||
)}
|
||||
|
||||
@@ -46,7 +46,7 @@ export const defaultUISettings: UISettings = {
|
||||
accentColor: "orange",
|
||||
|
||||
// Sidebar
|
||||
entryColWidth: 356,
|
||||
entryColWidth: 450,
|
||||
aiColWidth: 384,
|
||||
feedColWidth: 256,
|
||||
hideExtraBadge: false,
|
||||
|
||||
Reference in New Issue
Block a user