MCPcopy Create free account
hub / github.com/Botloader/botloader / GuildSideNav

Function GuildSideNav

frontend/src/components/GuildSideNav.tsx:8–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import { PluginIcon } from "./PluginIcon";
7
8export function GuildSideNav() {
9 const guild = useCurrentGuild();
10 const { value: data } = useCurrentGuildScripts()
11
12 const navItems = [
13 {
14 label: "Home",
15 isNavLink: true,
16 exact: true,
17 path: `/servers/${guild?.value?.guild.id}`,
18 },
19 ]
20
21 const guildScripts = data?.scripts.filter(v => !v.plugin_id)
22 const pluginScripts = data?.scripts.filter(v => Boolean(v.plugin_id))
23 // if (!pluginScripts) {
24 // navItems.push("loading" as any)
25 // } else {
26 // for (const script of pluginScripts) {
27 // navItems.push({
28 // label: script.name,
29 // path: `/servers/${guild?.value?.guild.id}/scripts/${script.id}`,
30 // exact: true,
31 // isNavLink: true,
32 // })
33 // }
34 // }
35
36 return <SideNav items={navItems}>
37 <Divider />
38 <ListItem>
39 <ListItemText
40 primaryTypographyProps={{
41 variant: "overline",
42 color: "grey"
43 }}
44 >Plugins</ListItemText>
45 </ListItem>
46 {!pluginScripts && <Loading />}
47 <List>
48
49 {pluginScripts?.map(script => (<NavItem
50 key={script.id}
51 item={{
52 label: script.name,
53 path: `/servers/${guild?.value?.guild.id}/scripts/${script.id}`,
54 exact: true,
55 isNavLink: true,
56 }}
57 icon={<PluginIcon
58 plugin={data?.plugins.find(v => v.id === script.plugin_id)!}
59 size="xs"
60 />}
61
62 indicator={<ScriptEnabledIndicator enabled={script.enabled} />}
63
64 // icon={<MailIcon />}
65 />))}

Callers

nothing calls this directly

Calls 2

useCurrentGuildFunction · 0.90
useCurrentGuildScriptsFunction · 0.90

Tested by

no test coverage detected