MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / SidebarContainer

Function SidebarContainer

apps/start/src/components/sidebar.tsx:74–177  ·  view source on GitHub ↗
({
  organizations,
  projects,
  children,
}: SidebarContainerProps)

Source from the content-addressed store, hash-verified

72}
73
74export function SidebarContainer({
75 organizations,
76 projects,
77 children,
78}: SidebarContainerProps) {
79 const [active, setActive] = useState(false);
80 const location = useLocation();
81 const { isSelfHosted } = useAppContext();
82 const { projectId } = useParams({ strict: false });
83 const { isOpen: chatOpen, openChatForContext, closeChat } = useChatState();
84
85 useEffect(() => {
86 setActive(false);
87 }, [location]);
88
89 return (
90 <>
91 <button
92 className={cn(
93 'fixed top-0 right-0 bottom-0 left-0 z-40 backdrop-blur-sm transition-opacity',
94 active
95 ? 'pointer-events-auto opacity-100'
96 : 'pointer-events-none opacity-0'
97 )}
98 onClick={() => setActive(false)}
99 type="button"
100 />
101 <div
102 className={cn(
103 'fixed top-0 left-0 z-40 flex h-screen w-72 flex-col border-border border-r bg-card transition-transform',
104 '-translate-x-72 lg:-translate-x-0', // responsive
105 active && 'translate-x-0' // force active on mobile
106 )}
107 >
108 <div className="absolute -right-12 flex h-16 items-center lg:hidden">
109 <Button
110 onClick={() => setActive((p) => !p)}
111 size="icon"
112 variant={'outline'}
113 >
114 {active ? <XIcon size={16} /> : <MenuIcon size={16} />}
115 </Button>
116 </div>
117 <div className="flex h-16 shrink-0 items-center gap-2 border-border border-b px-4">
118 <Link to="/">
119 <LogoSquare className="max-h-8" />
120 </Link>
121 <ProjectSelector
122 align="start"
123 organizations={organizations}
124 projects={projects}
125 />
126 </div>
127 <div
128 className={cn([
129 'hide-scrollbar flex-1 overflow-auto p-4',
130 "[&_a[data-status='active']]:bg-def-200",
131 ])}

Callers

nothing calls this directly

Calls 3

useAppContextFunction · 0.90
useChatStateFunction · 0.90
cnFunction · 0.90

Tested by

no test coverage detected