Skip to content

Commit 08371af

Browse files
committed
Add the sidebar to the Members page layout and update app-sidebar to link to the correct page when navigating to the Members page.
1 parent b5e17ba commit 08371af

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/app/organizations/[id]/members/layout.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import "@/styles/globals.css";
33
import { siteConfig } from "@/site.config.ts";
44

55
import { SiteHeader } from "@/components/ui/site-header";
6+
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
7+
import { AppSidebar } from "@/components/ui/app-sidebar";
68
export const metadata: Metadata = {
79
title: siteConfig.name,
810
description: "Manage coaching members",
@@ -14,11 +16,14 @@ export default function MembersLayout({
1416
children: React.ReactNode;
1517
}>) {
1618
return (
17-
// Ensure that SiteHeader has enough vertical space to stay sticky at the top
18-
// of the page by using "min-h-screen" in the parent div
19-
<div className="min-h-screen">
20-
<SiteHeader />
21-
<main>{children}</main>
22-
</div>
19+
<SidebarProvider>
20+
<div className="flex min-h-screen min-w-full">
21+
<AppSidebar />
22+
<SidebarInset>
23+
<SiteHeader />
24+
<main className="flex-1 p-6">{children}</main>
25+
</SidebarInset>
26+
</div>
27+
</SidebarProvider>
2328
);
2429
}

src/components/ui/app-sidebar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
SidebarRail,
2121
SidebarSeparator,
2222
} from "@/components/ui/sidebar";
23+
import { useOrganizationStateStore } from "@/lib/providers/organization-state-store-provider";
2324

2425
// Custom styles for menu buttons to ensure consistent centering
2526
const menuButtonStyles = {
@@ -30,6 +31,8 @@ const menuButtonStyles = {
3031
};
3132

3233
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
34+
const { currentOrganizationId } = useOrganizationStateStore((state) => state);
35+
3336
return (
3437
<Sidebar collapsible="icon" {...props}>
3538
<SidebarHeader className="h-16 flex flex-col justify-between pb-0">
@@ -101,7 +104,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
101104
menuButtonStyles.buttonCollapsed
102105
)}
103106
>
104-
<a href="/members">
107+
<a href={`/organizations/${currentOrganizationId}/members`}>
105108
<span className={menuButtonStyles.iconWrapper}>
106109
<Users className="h-4 w-4" />
107110
</span>

0 commit comments

Comments
 (0)