Skip to content

Commit 3974910

Browse files
authored
regression: sidebar toggle button position (#8186)
* fix: sidebar toggle button position * chore: remove border radius
1 parent 9bcb1fa commit 3974910

File tree

5 files changed

+46
-9
lines changed

5 files changed

+46
-9
lines changed

apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import { observer } from "mobx-react";
22
import { useParams } from "next/navigation";
33
// plane imports
44
import { Header, Row } from "@plane/ui";
5+
import { cn } from "@plane/utils";
56
// components
67
import { AppHeader } from "@/components/core/app-header";
78
import { TabNavigationRoot } from "@/components/navigation";
9+
import { AppSidebarToggleButton } from "@/components/sidebar/sidebar-toggle-button";
10+
// hooks
11+
import { useAppTheme } from "@/hooks/store/use-app-theme";
812
import { useIssueDetail } from "@/hooks/store/use-issue-detail";
913
import { useProjectNavigationPreferences } from "@/hooks/use-navigation-preferences";
1014
// local components
@@ -14,6 +18,7 @@ export const ProjectWorkItemDetailsHeader = observer(function ProjectWorkItemDet
1418
// router
1519
const { workspaceSlug, workItem } = useParams();
1620
// store hooks
21+
const { sidebarCollapsed } = useAppTheme();
1722
const {
1823
issue: { getIssueById, getIssueIdByIdentifier },
1924
} = useIssueDetail();
@@ -29,8 +34,13 @@ export const ProjectWorkItemDetailsHeader = observer(function ProjectWorkItemDet
2934
<div className="z-20">
3035
<Row className="h-header flex gap-2 w-full items-center border-b border-custom-border-200 bg-custom-sidebar-background-100">
3136
<div className="flex items-center gap-2 divide-x divide-custom-border-100 h-full w-full">
32-
<div className="flex items-center h-full w-full flex-1">
33-
<Header className="h-full">
37+
<div className="flex items-center gap-2 size-full flex-1">
38+
{sidebarCollapsed && (
39+
<div className="shrink-0">
40+
<AppSidebarToggleButton />
41+
</div>
42+
)}
43+
<Header className={cn("h-full", { "pl-1.5": !sidebarCollapsed })}>
3444
<Header.LeftItem className="h-full max-w-full">
3545
<TabNavigationRoot
3646
workspaceSlug={workspaceSlug}

apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
"use client";
22

3+
import { observer } from "mobx-react";
34
import { Outlet } from "react-router";
5+
// plane imports
46
import { Header, Row } from "@plane/ui";
7+
import { cn } from "@plane/utils";
8+
// components
59
import { TabNavigationRoot } from "@/components/navigation/tab-navigation-root";
10+
import { AppSidebarToggleButton } from "@/components/sidebar/sidebar-toggle-button";
11+
// hooks
12+
import { useAppTheme } from "@/hooks/store/use-app-theme";
613
import { useProjectNavigationPreferences } from "@/hooks/use-navigation-preferences";
14+
// local imports
715
import type { Route } from "./+types/layout";
816

9-
export default function ProjectLayout({ params }: Route.ComponentProps) {
17+
function ProjectLayout({ params }: Route.ComponentProps) {
1018
// router
1119
const { workspaceSlug, projectId } = params;
20+
// store hooks
21+
const { sidebarCollapsed } = useAppTheme();
1222
// preferences
1323
const { preferences: projectPreferences } = useProjectNavigationPreferences();
1424

@@ -18,9 +28,14 @@ export default function ProjectLayout({ params }: Route.ComponentProps) {
1828
<div className="z-20">
1929
<Row className="h-header flex gap-2 w-full items-center border-b border-custom-border-200 bg-custom-sidebar-background-100">
2030
<div className="flex items-center gap-2 divide-x divide-custom-border-100 h-full w-full">
21-
<div className="flex items-center h-full w-full flex-1">
22-
<Header className="h-full">
23-
<Header.LeftItem className="h-full max-w-full">
31+
<div className="flex items-center gap-2 size-full flex-1">
32+
{sidebarCollapsed && (
33+
<div className="shrink-0">
34+
<AppSidebarToggleButton />
35+
</div>
36+
)}
37+
<Header className={cn("h-full", { "pl-1.5": !sidebarCollapsed })}>
38+
<Header.LeftItem className="h-full max-w-full flex items-center gap-2">
2439
<TabNavigationRoot workspaceSlug={workspaceSlug} projectId={projectId} />
2540
</Header.LeftItem>
2641
</Header>
@@ -33,3 +48,5 @@ export default function ProjectLayout({ params }: Route.ComponentProps) {
3348
</>
3449
);
3550
}
51+
52+
export default observer(ProjectLayout);

apps/web/ce/components/common/extended-app-header.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
import type { ReactNode } from "react";
22
import { observer } from "mobx-react";
3+
import { useParams } from "react-router";
4+
// components
35
import { AppSidebarToggleButton } from "@/components/sidebar/sidebar-toggle-button";
6+
// hooks
47
import { useAppTheme } from "@/hooks/store/use-app-theme";
8+
import { useProjectNavigationPreferences } from "@/hooks/use-navigation-preferences";
59

610
export const ExtendedAppHeader = observer(function ExtendedAppHeader(props: { header: ReactNode }) {
711
const { header } = props;
12+
// params
13+
const { projectId, workItem } = useParams();
14+
// preferences
15+
const { preferences: projectPreferences } = useProjectNavigationPreferences();
816
// store hooks
917
const { sidebarCollapsed } = useAppTheme();
18+
// derived values
19+
const shouldShowSidebarToggleButton = projectPreferences.navigationMode === "accordion" || (!projectId && !workItem);
1020

1121
return (
1222
<>
13-
{sidebarCollapsed && <AppSidebarToggleButton />}
23+
{sidebarCollapsed && shouldShowSidebarToggleButton && <AppSidebarToggleButton />}
1424
<div className="w-full">{header}</div>
1525
</>
1626
);

apps/web/ce/components/workspace/content-wrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const WorkspaceContentWrapper = observer(function WorkspaceContentWrapper
1212
children: React.ReactNode;
1313
}) {
1414
return (
15-
<div className="flex flex-col relative size-full overflow-hidden bg-custom-background-90 rounded-lg transition-all ease-in-out duration-300">
15+
<div className="flex flex-col relative size-full overflow-hidden bg-custom-background-90 transition-all ease-in-out duration-300">
1616
<TopNavigationRoot />
1717
<div className="relative flex size-full overflow-hidden">
1818
<AppRailRoot />

apps/web/core/components/navigation/tab-navigation-root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export const TabNavigationRoot: FC<TTabNavigationRootProps> = observer((props) =
167167
/>
168168

169169
{/* container for the tab navigation */}
170-
<div className="flex items-center gap-3 overflow-hidden pl-1.5 size-full">
170+
<div className="flex items-center gap-3 overflow-hidden size-full">
171171
<div className="flex items-center gap-2 shrink-0">
172172
<ProjectHeader project={project} />
173173
<div className="shrink-0">

0 commit comments

Comments
 (0)