MCPcopy
hub / github.com/chartdb/chartdb / SidePanel

Function SidePanel

src/pages/editor-page/side-panel/side-panel.tsx:24–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22export interface SidePanelProps {}
23
24export const SidePanel: React.FC<SidePanelProps> = () => {
25 const { t } = useTranslation();
26 const { databaseType } = useChartDB();
27 const { selectSidebarSection, selectedSidebarSection } = useLayout();
28 const { isMd: isDesktop } = useBreakpoint('md');
29
30 return (
31 <aside className="flex h-full flex-col overflow-hidden">
32 {!isDesktop ? (
33 <div className="flex justify-center border-b pt-0.5">
34 <Select
35 value={selectedSidebarSection}
36 onValueChange={(value) =>
37 selectSidebarSection(value as SidebarSection)
38 }
39 >
40 <SelectTrigger className="rounded-none border-none font-semibold shadow-none hover:bg-secondary hover:underline focus:border-transparent focus:ring-0">
41 <SelectValue />
42 <div className="flex flex-1 justify-end px-2 text-xs font-normal text-muted-foreground">
43 {t('side_panel.view_all_options')}
44 </div>
45 </SelectTrigger>
46 <SelectContent>
47 <SelectGroup>
48 <SelectItem value="tables">
49 {t('side_panel.tables_section.tables')}
50 </SelectItem>
51 <SelectItem value="refs">
52 {t('side_panel.refs_section.refs')}
53 </SelectItem>
54 <SelectItem value="areas">
55 {t('side_panel.areas_section.areas')}
56 </SelectItem>
57 <SelectItem value="visuals">
58 {t('side_panel.visuals_section.visuals')}
59 </SelectItem>
60 {supportsCustomTypes(databaseType) ? (
61 <SelectItem value="customTypes">
62 {t(
63 'side_panel.custom_types_section.custom_types'
64 )}
65 </SelectItem>
66 ) : null}
67 </SelectGroup>
68 </SelectContent>
69 </Select>
70 </div>
71 ) : null}
72 {selectedSidebarSection === 'tables' ? (
73 <TablesSection />
74 ) : selectedSidebarSection === 'dbml' ? (
75 <DBMLSection />
76 ) : selectedSidebarSection === 'refs' ? (
77 <RefsSection />
78 ) : selectedSidebarSection === 'visuals' ? (
79 <VisualsSection />
80 ) : (
81 <CustomTypesSection />

Callers

nothing calls this directly

Calls 4

useChartDBFunction · 0.90
useLayoutFunction · 0.90
useBreakpointFunction · 0.90
supportsCustomTypesFunction · 0.90

Tested by

no test coverage detected