mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 13:01:56 +00:00
31 lines
755 B
TypeScript
31 lines
755 B
TypeScript
"use client";
|
|
|
|
import { useMountEffect } from "@/hooks/use-mount-effect";
|
|
import { useSidePanelStore } from "@/store/side-panel";
|
|
|
|
import { useAppSidebarMode } from "./app-sidebar-mode-store";
|
|
import type { AppSidebarMode } from "./types";
|
|
|
|
interface AppSidebarModeSyncProps {
|
|
mode: AppSidebarMode;
|
|
// The full-page chat dismisses the side panel: the chat lives in one place
|
|
// or the other, never both.
|
|
closeSidePanel?: boolean;
|
|
}
|
|
|
|
export function AppSidebarModeSync({
|
|
mode,
|
|
closeSidePanel = false,
|
|
}: AppSidebarModeSyncProps) {
|
|
const setMode = useAppSidebarMode((state) => state.setMode);
|
|
|
|
useMountEffect(() => {
|
|
setMode(mode);
|
|
if (closeSidePanel) {
|
|
useSidePanelStore.getState().closePanel();
|
|
}
|
|
});
|
|
|
|
return null;
|
|
}
|