Skip to content

Commit 0b07dd3

Browse files
authored
Merge pull request #190 from ag-ui-protocol/chore/add-disabling-of-sidebar
chore: add disabling of dojo sidebar and integration picker
2 parents 2554a8d + b4de2f5 commit 0b07dd3

File tree

2 files changed

+34
-27
lines changed

2 files changed

+34
-27
lines changed

typescript-sdk/apps/dojo/src/components/layout/main-layout.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import React, { useState } from "react";
44
import { ViewerLayout } from "@/components/layout/viewer-layout";
55
import { Sidebar } from "@/components/sidebar/sidebar";
66

7-
import { usePathname } from "next/navigation";
7+
import { usePathname, useSearchParams } from "next/navigation";
88
import featureConfig from "@/config";
99

1010
export function MainLayout({ children }: { children: React.ReactNode }) {
1111
const pathname = usePathname();
12+
const searchParams = useSearchParams();
13+
14+
const sidebarDisabled = searchParams.get("sidebar") === "disabled";
15+
const integrationPickerDisabled = searchParams.get("picker") === "false";
1216

1317
// Extract the current demo ID from the pathname
1418
const pathParts = pathname.split("/");
@@ -19,7 +23,7 @@ export function MainLayout({ children }: { children: React.ReactNode }) {
1923
<ViewerLayout showFileTree={false} showCodeEditor={false}>
2024
<div className="flex h-full w-full overflow-hidden">
2125
{/* Sidebar */}
22-
<Sidebar activeTab={"preview"} readmeContent={""} />
26+
{!sidebarDisabled && <Sidebar activeTab={"preview"} readmeContent={""} pickerDisabled={integrationPickerDisabled} />}
2327

2428
{/* Content */}
2529
<div className="flex-1 overflow-auto">

typescript-sdk/apps/dojo/src/components/sidebar/sidebar.tsx

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ interface SidebarProps {
2323
activeTab?: string;
2424
onTabChange?: (tab: string) => void;
2525
readmeContent?: string | null;
26+
pickerDisabled?: boolean;
2627
}
2728

28-
export function Sidebar({ activeTab = "preview", onTabChange, readmeContent }: SidebarProps) {
29+
export function Sidebar({ activeTab = "preview", onTabChange, readmeContent, pickerDisabled }: SidebarProps) {
2930
const router = useRouter();
3031
const pathname = usePathname();
3132
const [isDarkTheme, setIsDarkTheme] = useState<boolean>(false);
@@ -105,30 +106,32 @@ export function Sidebar({ activeTab = "preview", onTabChange, readmeContent }: S
105106
{/* Controls Section */}
106107
<div className="p-4 border-b bg-background">
107108
{/* Preview/Code Tabs */}
108-
<div className="mb-1">
109-
<label className="block text-sm font-medium text-muted-foreground mb-2">View</label>
110-
<DropdownMenu>
111-
<DropdownMenuTrigger asChild>
112-
<Button variant="outline" className="w-full justify-between">
113-
{currentIntegration ? currentIntegration.name : "Select Integration"}
114-
<ChevronDown className="h-4 w-4 opacity-50" />
115-
</Button>
116-
</DropdownMenuTrigger>
117-
<DropdownMenuContent className="w-56">
118-
{menuIntegrations.map((integration) => (
119-
<DropdownMenuItem
120-
key={integration.id}
121-
onClick={() => {
122-
router.push(`/${integration.id}`);
123-
}}
124-
className="cursor-pointer"
125-
>
126-
<span>{integration.name}</span>
127-
</DropdownMenuItem>
128-
))}
129-
</DropdownMenuContent>
130-
</DropdownMenu>
131-
</div>
109+
{!pickerDisabled && (
110+
<div className="mb-1">
111+
<label className="block text-sm font-medium text-muted-foreground mb-2">View</label>
112+
<DropdownMenu>
113+
<DropdownMenuTrigger asChild>
114+
<Button variant="outline" className="w-full justify-between">
115+
{currentIntegration ? currentIntegration.name : "Select Integration"}
116+
<ChevronDown className="h-4 w-4 opacity-50" />
117+
</Button>
118+
</DropdownMenuTrigger>
119+
<DropdownMenuContent className="w-56">
120+
{menuIntegrations.map((integration) => (
121+
<DropdownMenuItem
122+
key={integration.id}
123+
onClick={() => {
124+
router.push(`/${integration.id}`);
125+
}}
126+
className="cursor-pointer"
127+
>
128+
<span>{integration.name}</span>
129+
</DropdownMenuItem>
130+
))}
131+
</DropdownMenuContent>
132+
</DropdownMenu>
133+
</div>
134+
)}
132135
</div>
133136

134137
{/* Demo List */}

0 commit comments

Comments
 (0)