MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / createSidePanel

Function createSidePanel

packages/frontend/src/SidePanel.tsx:33–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31export const action_icon = 'w-4 h-4'
32
33export function createSidePanel() {
34
35 const ctx = useAppCtx()
36 const {inspector} = ctx
37 const {state, openComponentLocation, setInspectedOwner} = inspector
38
39 const tabsTitleMap = {
40 inspector: 'Inspector',
41 dgraph: 'Graph',
42 } as const
43
44 const [openPanel, setOpenPanel] = s.createSignal<keyof typeof tabsTitleMap>('inspector')
45
46 const {OwnerName, pingUpdated} = ui.createHighlightedOwnerName()
47 s.createEffect(() => {
48 const id = inspector.inspected.ownerId
49 id && ctx.listenToNodeUpdate(id, pingUpdated)
50 })
51
52 function SidePanel() {
53 return (
54 <SidePanelCtx.Provider value={{openPanel, setOpenPanel}}>
55 <div
56 class="h-full grid"
57 style={{
58 'grid-template-rows': `${theme.spacing.header_height} 1fr`,
59 'grid-template-columns': '100%',
60 }}
61 >
62 <header class="relative p-l-4 flex items-center">
63 <div class={panel_header_el_border} />
64 <div class="flex items-center gap-x-2">
65 <OwnerName name={state.name} type={state.type} is_title />
66 {state.hmr && <>
67 <ui.Badge>HMR</ui.Badge>
68 </>}
69 </div>
70 <div class="p-x-1 ml-auto flex items-center gap-x-1">
71 {/* <button class={styles.actions.button}>
72 <Icon.Eye class={styles.actions.icon} />
73 </button> */}
74 {state.location && (
75 <button
76 title="Open component location"
77 class={action_button}
78 onClick={openComponentLocation}
79 >
80 <ui.icon.Code class={action_icon} />
81 </button>
82 )}
83 <button
84 title="Close inspector"
85 class={action_button}
86 onClick={() => setInspectedOwner(null)}
87 >
88 <ui.icon.Close class={action_icon} />
89 </button>
90 </div>

Callers 1

AppFunction · 0.90

Calls 1

useAppCtxFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…