From 31e9bb68ac80d4e7d764e1ec2cf822417ea54ade Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Thu, 14 May 2026 23:15:40 +0800 Subject: [PATCH] feat(ui): update Header and ChannelSidebar components Refine Header with improved layout, update ChannelSidebar with channel navigation and ChatPage integration. --- src/app/chat/ChatPage.tsx | 38 +++++++++++----- src/components/layout/ChannelSidebar.tsx | 23 +++++----- src/components/layout/Header.tsx | 57 +++++++++++++----------- 3 files changed, 69 insertions(+), 49 deletions(-) diff --git a/src/app/chat/ChatPage.tsx b/src/app/chat/ChatPage.tsx index df7ca38..4fd1c4f 100644 --- a/src/app/chat/ChatPage.tsx +++ b/src/app/chat/ChatPage.tsx @@ -10,6 +10,7 @@ import { useProjectInfo } from "@/hooks/useProjectInfo"; import { useConversationQuery } from "@/hooks/useAiChatQuery"; import { CodePreviewPanel } from "@/components/chat/CodePreviewPanel"; import { CodePreviewProvider, type CodePreviewPayload } from "@/components/chat/CodePreviewContext"; +import { ProjectJoinBanner, useProjectLayout } from "@/app/project/layout"; interface ChatPageProps { scope: "personal" | "project"; @@ -27,6 +28,7 @@ export function ChatPage({ scope }: ChatPageProps) { const [userModel, setSelectedModel] = useState(null); const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(true); const [activeCode, setActiveCode] = useState(null); + const { isProjectPreview } = useProjectLayout(); const { data: conversation } = useConversationQuery(selectedConversationId || ""); @@ -131,24 +133,36 @@ export function ChatPage({ scope }: ChatPageProps) { {selectedConversationId ? ( <> - + {scope === "project" && isProjectPreview ? ( +
+
+ +
+
+ ) : ( + + )} ) : (
- + {scope === "project" && isProjectPreview ? ( + + ) : ( + + )}
diff --git a/src/components/layout/ChannelSidebar.tsx b/src/components/layout/ChannelSidebar.tsx index eb89bb3..9a586dd 100644 --- a/src/components/layout/ChannelSidebar.tsx +++ b/src/components/layout/ChannelSidebar.tsx @@ -41,8 +41,9 @@ interface ChannelSidebarProps { export const ChannelSidebar = memo(function ChannelSidebar({onCollapse}: ChannelSidebarProps) { const location = useLocation(); const {projectName} = useParams<{ projectName: string }>(); - const {data: roomsData, isLoading} = useRoomsQuery(projectName); const {data: projectInfo} = useProjectInfo(projectName); + const isProjectMember = !!projectInfo?.role; + const {data: roomsData, isLoading} = useRoomsQuery(isProjectMember ? projectName : undefined); const [isCreateMenuOpen, setIsCreateMenuOpen] = useState(false); const rooms = useMemo(() => roomsData?.rooms ?? [], [roomsData?.rooms]); @@ -103,14 +104,16 @@ export const ChannelSidebar = memo(function ChannelSidebar({onCollapse}: Channel > - + {isProjectMember && ( + + )} {onCollapse && ( )} - + + + + + )} {TOOLBAR_ICONS.map((icon, i) => (