Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: ensure sidebar has valid html (#47826)

Gildas Garcia2ec8e3b135ee
diff --git a/apps/studio/components/interfaces/Sidebar.tsx b/apps/studio/components/interfaces/Sidebar.tsx
index 7219188268e..994bc0e0e8a 100644
--- a/apps/studio/components/interfaces/Sidebar.tsx
+++ b/apps/studio/components/interfaces/Sidebar.tsx
@@ -132,11 +132,11 @@ export const SidebarContent = ({ footer }: { footer?: ReactNode }) => {
<AnimatePresence mode="wait">
<SidebarContentPrimitive>
{projectRef ? (
- <motion.div key="project-links">
+ <motion.nav key="project-links">
<ProjectLinks />
- </motion.div>
+ </motion.nav>
) : (
- <motion.div
+ <motion.nav
key="org-links"
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
@@ -144,7 +144,7 @@ export const SidebarContent = ({ footer }: { footer?: ReactNode }) => {
transition={{ duration: 0.2, ease: 'easeOut' }}
>
<OrganizationLinks />
- </motion.div>
+ </motion.nav>
)}
</SidebarContentPrimitive>
</AnimatePresence>
@@ -278,85 +278,94 @@ const ProjectLinks = () => {
const settingsRoutes = generateSettingsRoutes(ref)
return (
- <SidebarMenu>
+ <>
<SidebarGroup className="gap-0.5">
- <SideBarNavLink
- key="home"
- active={isUndefined(activeRoute) && !isUndefined(router.query.ref)}
- route={{
- key: 'HOME',
- label: 'Project Overview',
- icon: <Home size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,
- link: `/project/${ref}`,
- linkElement: <ProjectIndexPageLink projectRef={ref} />,
- shortcutId: SHORTCUT_IDS.NAV_HOME,
- }}
- />
- {toolRoutes.map((route, i) => (
+ <SidebarMenu>
<SideBarNavLink
- key={`tools-routes-${i}`}
- route={route}
- active={activeRoute === route.key}
- isLoading={isProjectPending}
+ key="home"
+ active={isUndefined(activeRoute) && !isUndefined(router.query.ref)}
+ route={{
+ key: 'HOME',
+ label: 'Project Overview',
+ icon: <Home size={ICON_SIZE} strokeWidth={ICON_STROKE_WIDTH} />,
+ link: `/project/${ref}`,
+ linkElement: <ProjectIndexPageLink projectRef={ref} />,
+ shortcutId: SHORTCUT_IDS.NAV_HOME,
+ }}
/>
- ))}
+ {toolRoutes.map((route, i) => (
+ <SideBarNavLink
+ key={`tools-routes-${i}`}
+ route={route}
+ active={activeRoute === route.key}
+ isLoading={isProjectPending}
+ />
+ ))}
+ </SidebarMenu>
</SidebarGroup>
<Separator className="w-[calc(100%-1rem)] mx-auto" />
<SidebarGroup className="gap-0.5">
- {productRoutes.map((route, i) => (
- <SideBarNavLink
- key={`product-routes-${i}`}
- route={route}
- active={activeRoute === route.key}
- isLoading={isProjectPending}
- />
- ))}
+ <SidebarMenu>
+ {productRoutes.map((route, i) => (
+ <SideBarNavLink
+ key={`product-routes-${i}`}
+ route={route}
+ active={activeRoute === route.key}
+ isLoading={isProjectPending}
+ />
+ ))}
+ </SidebarMenu>
</SidebarGroup>
<Separator className="w-[calc(100%-1rem)] mx-auto" />
<SidebarGroup className="gap-0.5">
- {otherRoutes.map((route) => {
- if (route.key === 'advisors') {
- return (
- <div className="relative" key={route.key}>
- {!route.disabled && (
- <ActiveDot
- hasErrors={errorLints.length > 0}
- hasWarnings={securityLints.length > 0}
- />
- )}
+ <SidebarMenu>
+ {otherRoutes.map((route) => {
+ if (route.key === 'advisors') {
+ return (
+ <SideBarNavLink
+ key={route.key}
+ route={route}
+ active={activeRoute === route.key}
+ isLoading={isProjectPending}
+ >
+ {route.icon}
+ <span>{route.label}</span>
+ {!route.disabled && (
+ <ActiveDot
+ hasErrors={errorLints.length > 0}
+ hasWarnings={securityLints.length > 0}
+ />
+ )}
+ </SideBarNavLink>
+ )
+ } else {
+ return (
<SideBarNavLink
key={route.key}
route={route}
active={activeRoute === route.key}
isLoading={isProjectPending}
/>
- </div>
- )
- } else {
- return (
- <SideBarNavLink
- key={route.key}
- route={route}
- active={activeRoute === route.key}
- isLoading={isProjectPending}
- />
- )
- }
- })}
+ )
+ }
+ })}
+ </SidebarMenu>
</SidebarGroup>
<Separator className="w-[calc(100%-1rem)] mx-auto" />
{/* Settings routes to be added in with project/org nav */}
<SidebarGroup className="gap-0.5">
- {settingsRoutes.map((route, i) => (
- <SideBarNavLink
- key={`settings-routes-${i}`}
- route={route}
- active={activeRoute === route.key}
- isLoading={isProjectPending}
- />
- ))}
+ <SidebarMenu>
+ {settingsRoutes.map((route, i) => (
+ <SideBarNavLink
+ key={`settings-routes-${i}`}
+ route={route}
+ active={activeRoute === route.key}
+ isLoading={isProjectPending}
+ />
+ ))}
+ </SidebarMenu>
</SidebarGroup>
- </SidebarMenu>
+ </>
)
}
@@ -434,8 +443,8 @@ const OrganizationLinks = () => {
if (!organizationSlug) return null
return (
- <SidebarMenu className="flex flex-col gap-1 items-start">
- <SidebarGroup className="gap-0.5">
+ <SidebarGroup className="gap-0.5">
+ <SidebarMenu className="flex flex-col gap-1">
{navMenuItems.map((item, i) => (
<SideBarNavLink
key={item.key}
@@ -456,7 +465,7 @@ const OrganizationLinks = () => {
}}
/>
))}
- </SidebarGroup>
- </SidebarMenu>
+ </SidebarMenu>
+ </SidebarGroup>
)
}