fix: place workbar toggle beside theme switch
Move the assistant workbar toggle from the floating content corner to the topbar immediately before the theme switch. Preserve toggle behavior and update layout tests and documentation. Release note: The workbar toggle now stays beside the light/dark theme switch instead of floating over the content area.
This commit is contained in:
@@ -10989,7 +10989,10 @@ describe("App", () => {
|
||||
expect(sidebar).not.toHaveClass("assistant-sidebar--open");
|
||||
const assistantTrigger = screen.getByLabelText("切换助手工作栏");
|
||||
expect(assistantTrigger.parentElement).toBe(
|
||||
container.querySelector(".app-content"),
|
||||
container.querySelector(".topbar__actions"),
|
||||
);
|
||||
expect(assistantTrigger.nextElementSibling).toBe(
|
||||
container.querySelector(".theme-toggle-button"),
|
||||
);
|
||||
expect(container.querySelector(".sidebar")?.parentElement).toBe(
|
||||
container.querySelector(".app-shell"),
|
||||
@@ -11019,7 +11022,7 @@ describe("App", () => {
|
||||
expect(container.querySelector(".topbar")).toContainElement(
|
||||
container.querySelector(".conversation-title"),
|
||||
);
|
||||
expect(container.querySelector(".topbar")).not.toContainElement(
|
||||
expect(container.querySelector(".topbar")).toContainElement(
|
||||
assistantTrigger,
|
||||
);
|
||||
expect(screen.queryByLabelText("关闭助手工作栏")).not.toBeInTheDocument();
|
||||
|
||||
+16
-17
@@ -9146,6 +9146,22 @@ function App(): React.JSX.Element {
|
||||
<span className="sr-only" id={runtimeDetailId}>
|
||||
{runtimeDetail}
|
||||
</span>
|
||||
<button
|
||||
aria-controls="assistant-sidebar"
|
||||
aria-expanded={assistantSidebarOpen}
|
||||
aria-label={t("topbar.toggleAssistantSidebar")}
|
||||
className="icon-button assistant-sidebar-toggle"
|
||||
onClick={() => setAssistantSidebarOpen((current) => !current)}
|
||||
ref={assistantSidebarToggleRef}
|
||||
title={t("topbar.toggleAssistantSidebar")}
|
||||
type="button"
|
||||
>
|
||||
{assistantSidebarOpen ? (
|
||||
<PanelRightClose aria-hidden="true" size={18} />
|
||||
) : (
|
||||
<PanelRightOpen aria-hidden="true" size={18} />
|
||||
)}
|
||||
</button>
|
||||
<button
|
||||
aria-label={
|
||||
resolvedAppearanceTheme === "dark"
|
||||
@@ -9173,23 +9189,6 @@ function App(): React.JSX.Element {
|
||||
</header>
|
||||
|
||||
<div className="app-content">
|
||||
<button
|
||||
aria-controls="assistant-sidebar"
|
||||
aria-expanded={assistantSidebarOpen}
|
||||
aria-label={t("topbar.toggleAssistantSidebar")}
|
||||
className="icon-button assistant-sidebar-toggle"
|
||||
onClick={() => setAssistantSidebarOpen((current) => !current)}
|
||||
ref={assistantSidebarToggleRef}
|
||||
title={t("topbar.toggleAssistantSidebar")}
|
||||
type="button"
|
||||
>
|
||||
{assistantSidebarOpen ? (
|
||||
<PanelRightClose aria-hidden="true" size={18} />
|
||||
) : (
|
||||
<PanelRightOpen aria-hidden="true" size={18} />
|
||||
)}
|
||||
</button>
|
||||
|
||||
<main
|
||||
aria-hidden={backgroundIsolated ? "true" : undefined}
|
||||
className="workspace"
|
||||
|
||||
@@ -322,9 +322,6 @@ describe('WorkspacePrimitives', () => {
|
||||
expect(stylesheet).toMatch(
|
||||
/\.workspace\s*\{[^}]*grid-template-rows:\s*minmax\(0,\s*1fr\);/u
|
||||
)
|
||||
expect(stylesheet).toMatch(
|
||||
/\.assistant-sidebar-toggle\s*\{[^}]*position:\s*absolute;[^}]*top:\s*6px;[^}]*right:\s*6px;/u
|
||||
)
|
||||
expect(stylesheet).toMatch(
|
||||
/\.conversation-task-strip\s*\{[^}]*min-height:\s*46px;[^}]*padding:\s*0\s+max\(/u
|
||||
)
|
||||
|
||||
@@ -4304,14 +4304,6 @@ button > svg {
|
||||
grid-template-columns: repeat(5, minmax(max-content, 1fr));
|
||||
}
|
||||
|
||||
.assistant-sidebar-toggle {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
top: 6px;
|
||||
right: 6px;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.assistant-sidebar__tab {
|
||||
position: relative;
|
||||
min-height: 32px;
|
||||
|
||||
Reference in New Issue
Block a user