MCPcopy Index your code
hub / github.com/TanStack/devtools / PluginsTab

Function PluginsTab

packages/devtools/src/tabs/plugins-tab.tsx:9–158  ·  view source on GitHub ↗
(props: { isOpen: boolean })

Source from the content-addressed store, hash-verified

7import { PluginMarketplace } from './plugin-marketplace'
8
9export const PluginsTab = (props: { isOpen: boolean }) => {
10 const { plugins, activePlugins, toggleActivePlugins } = createPlugins()
11 const { expanded, hoverUtils, animationMs, setForceExpand } =
12 createDrawContext()
13 const [pluginRefs, setPluginRefs] = createSignal(
14 new Map<string, HTMLDivElement>(),
15 )
16 const [showMarketplace, setShowMarketplace] = createSignal(false)
17
18 const styles = createStyles()
19
20 const { theme } = createTheme()
21
22 const hasPlugins = createMemo(
23 () => plugins()?.length && plugins()!.length > 0,
24 )
25
26 // Keep sidebar expanded when marketplace is shown
27 createEffect(() => {
28 setForceExpand(showMarketplace())
29 })
30
31 createEffect(() => {
32 const currentActivePlugins = plugins()?.filter((plugin) =>
33 activePlugins().includes(plugin.id!),
34 )
35
36 currentActivePlugins?.forEach((plugin) => {
37 const ref = pluginRefs().get(plugin.id!)
38
39 if (ref) {
40 plugin.render(ref, {
41 theme: theme(),
42 devtoolsOpen: props.isOpen,
43 })
44 }
45 })
46 })
47
48 const handleMarketplaceClick = () => setShowMarketplace(!showMarketplace())
49
50 const handlePluginClick = (pluginId: string) => {
51 // Close marketplace when switching to a plugin
52 if (showMarketplace()) {
53 setShowMarketplace(false)
54 }
55 toggleActivePlugins(pluginId)
56 }
57
58 return (
59 <Show when={hasPlugins()} fallback={<PluginMarketplace />}>
60 <div class={styles().pluginsTabPanel}>
61 <div
62 class={clsx(
63 styles().pluginsTabDraw(expanded()),
64 {
65 [styles().pluginsTabDraw(expanded())]: expanded(),
66 },

Callers

nothing calls this directly

Calls 6

createPluginsFunction · 0.90
createDrawContextFunction · 0.90
createStylesFunction · 0.90
createThemeFunction · 0.90
handlePluginClickFunction · 0.85
renderMethod · 0.80

Tested by

no test coverage detected