Skip to content

Commit b4de2f5

Browse files
committed
chore: enable disabling of picker
1 parent d144b88 commit b4de2f5

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function MainLayout({ children }: { children: React.ReactNode }) {
1212
const searchParams = useSearchParams();
1313

1414
const sidebarDisabled = searchParams.get("sidebar") === "disabled";
15+
const integrationPickerDisabled = searchParams.get("picker") === "false";
1516

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

2728
{/* Content */}
2829
<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)