diff --git a/desktop/src/ui/components/Sidebar.tsx b/desktop/src/ui/components/Sidebar.tsx index bfe1ad76..20db6870 100644 --- a/desktop/src/ui/components/Sidebar.tsx +++ b/desktop/src/ui/components/Sidebar.tsx @@ -8,7 +8,7 @@ type SidebarProps = ParentProps & { }; base: string; links: { - [key: string]: [JSX.Element, string, string][]; + [key: string]: ([JSX.Element, string, string] | undefined)[]; }; }; @@ -44,19 +44,24 @@ function Sidebar(props: SidebarProps) {

{section.toUpperCase()}

- {link => ( - goto(link[2])} - class={ - `px-3 py-1 rounded-md text-md hover:bg-component-bg-hover active:bg-component-bg-pressed ${isActive(link[2]) ? 'bg-gray-05' : ''}` - } - > - - {link[0]} - {link[1]} - - - )} + {(link) => { + if (!link) + return; + + return ( + goto(link[2])} + class={ + `px-3 py-1 rounded-md text-md hover:bg-component-bg-hover active:bg-component-bg-pressed ${isActive(link[2]) ? 'bg-gray-05' : ''}` + } + > + + {link[0]} + {link[1]} + + + ); + }}
diff --git a/desktop/src/ui/pages/cluster/ClusterRoot.tsx b/desktop/src/ui/pages/cluster/ClusterRoot.tsx index fb10608e..39ba267c 100644 --- a/desktop/src/ui/pages/cluster/ClusterRoot.tsx +++ b/desktop/src/ui/pages/cluster/ClusterRoot.tsx @@ -8,6 +8,7 @@ import ClusterOverview from './cluster/ClusterOverview'; import ClusterLogs from './cluster/ClusterLogs'; import ClusterMods from './cluster/ClusterMods'; import ClusterScreenshots from './cluster/ClusterScreenshots'; +import useCluster from '~ui/hooks/useCluster'; function ClusterRoutes() { return ( @@ -22,18 +23,25 @@ function ClusterRoutes() { function ClusterRoot(props: ParentProps) { const [searchParams] = useSearchParams(); + const cluster = useCluster(searchParams.id); + + if (!cluster) { + location.href = '/'; + return; + } return (
, 'Overview', '/'], // [, 'Accounts', '/users'], - [, 'Mods', '/mods'], + // TODO: Better way of checking mods + (cluster()?.meta.loader !== 'vanilla' ? [, 'Mods', '/mods'] : undefined), [, 'Screenshots', '/screenshots'], [, 'Worlds', '/worlds'], [, 'Logs', '/logs'],