fix: align Code return and sidebar collapse in the top row

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 23:25:41 +08:00
1 parent dcaa7baacc
commit 163f262753
7 files changed
+58 -14

No files matched your search

+15 -1
View File
@@ -11,6 +11,7 @@ import {
FolderKanban,
Gamepad2,
LogOut,
PanelLeftClose,
Plus,
RadioTower,
Settings as SettingsIcon,
@@ -90,6 +91,7 @@ export function Sidebar({
}: SidebarProps = {}) {
const { t } = useTranslation('common');
const storedSidebarCollapsed = useSettingsStore((state) => state.sidebarCollapsed);
const setSidebarCollapsed = useSettingsStore((state) => state.setSidebarCollapsed);
const sidebarWidth = useSettingsStore((state) => normalizeClassroomSidebarWidth(state.classroomSidebarWidth));
const sidebarPinnedCollapsed = !forceExpanded && storedSidebarCollapsed;
const sidebarCollapsed = sidebarPinnedCollapsed && !sidebarPeekOpen;
@@ -412,11 +414,23 @@ export function Sidebar({
)}
>
<div className="min-w-0 w-full">
{workspaceLayout && <div className="no-drag flex h-10 min-w-0 items-center gap-1" data-testid="classroom-sidebar-navigation">
<ModuleSwitcher sidebarCollapsed={sidebarCollapsed} toolbar />
{!sidebarPinnedCollapsed && ['darwin', 'win32'].includes(window.electron?.platform ?? '') && <button
type="button"
data-testid="titlebar-sidebar-toggle"
aria-label="折叠侧栏"
title="折叠侧栏"
aria-expanded="true"
onClick={() => setSidebarCollapsed(true)}
className="no-drag motion-press flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-subtle hover:text-foreground"
><PanelLeftClose className="h-4 w-4" /></button>}
</div>}
{workspaceLayout && <button type="button" aria-label="返回首页" title="返回首页" onClick={() => navigate('/module-select')} className="classroom-brand flex w-full items-center gap-2 rounded-lg text-left">
<span className="classroom-brand-mark"><img src={classroomMark} alt="" className="h-7 w-7" /></span>
<span className="min-w-0"><span className="block text-base font-semibold tracking-tight">麦洛</span><span className="classroom-brand-caption">把脑洞变成作品</span></span>
</button>}
<ModuleSwitcher sidebarCollapsed={sidebarCollapsed} compact={!sidebarCollapsed} />
{!workspaceLayout && <ModuleSwitcher sidebarCollapsed={sidebarCollapsed} compact={!sidebarCollapsed} />}
</div>
</div>}