diff --git a/src/app/[orgId]/settings/layout.tsx b/src/app/[orgId]/settings/layout.tsx
index cac644be3..598df4f74 100644
--- a/src/app/[orgId]/settings/layout.tsx
+++ b/src/app/[orgId]/settings/layout.tsx
@@ -80,7 +80,8 @@ export default async function SettingsLayout(props: SettingsLayoutProps) {
orgId={params.orgId}
orgs={orgs}
navItems={orgNavSections(env, {
- isPrimaryOrg: primaryOrg
+ isPrimaryOrg: primaryOrg,
+ isServerAdmin: user.serverAdmin
})}
commandNavItems={commandBarNavSections(env, {
isPrimaryOrg: primaryOrg
diff --git a/src/app/navigation.tsx b/src/app/navigation.tsx
index 9bd932f22..2f00744c0 100644
--- a/src/app/navigation.tsx
+++ b/src/app/navigation.tsx
@@ -47,6 +47,7 @@ export type SidebarNavSection = {
export type OrgNavSectionsOptions = {
isPrimaryOrg?: boolean;
+ isServerAdmin?: boolean;
};
// Merged from 'user-management-and-resources' branch
@@ -67,6 +68,27 @@ export const orgNavSections = (
env?: Env,
options?: OrgNavSectionsOptions
): SidebarNavSection[] => [
+ {
+ heading: "sidebarOverview",
+ items: [
+ {
+ title: "resourceSidebarLauncherTitle",
+ href: "/{orgId}",
+ icon: ,
+ exact: true
+ },
+ ...(options?.isServerAdmin
+ ? [
+ {
+ title: "serverAdmin",
+ href: "/admin",
+ icon: ,
+ exact: true
+ }
+ ]
+ : [])
+ ]
+ },
{
heading: "network",
items: [
diff --git a/src/components/CreateVirtualApiKeyForm.tsx b/src/components/CreateVirtualApiKeyForm.tsx
index 4a97d358a..5c2e75d0f 100644
--- a/src/components/CreateVirtualApiKeyForm.tsx
+++ b/src/components/CreateVirtualApiKeyForm.tsx
@@ -476,11 +476,6 @@ export default function CreateVirtualApiKeyForm({
-
- {t(
- "virtualApiKeysInferenceBudgetDescription"
- )}
-
-
- {t(
- "virtualApiKeysInferenceBudgetDescription"
- )}
-
org.orgId === orgId);
- const isSettingsPage = Boolean(
- orgId && pathname?.includes(`/${orgId}/settings`)
- );
- const canViewResourceLauncher = Boolean(
- currentOrg?.isAdmin || currentOrg?.isOwner
- );
const mobileNavLinkClassName = cn(
"flex items-center rounded transition-colors text-muted-foreground hover:text-foreground text-sm w-full hover:bg-secondary/50 dark:hover:bg-secondary/20 rounded-md px-3 py-1.5"
@@ -183,58 +171,6 @@ export function LayoutMobileMenu({
- {!isAdminPage &&
- isSettingsPage &&
- canViewResourceLauncher &&
- orgId && (
-
-
- setIsMobileMenuOpen(
- false
- )
- }
- >
-
-
-
-
- {t(
- "resourceSidebarLauncherTitle"
- )}
-
-
-
- )}
- {!isAdminPage &&
- user.serverAdmin && (
-
-
- setIsMobileMenuOpen(
- false
- )
- }
- >
-
-
-
-
- {t(
- "serverAdmin"
- )}
-
-
-
- )}
diff --git a/src/components/LayoutSidebar.tsx b/src/components/LayoutSidebar.tsx
index df1eb45d3..bf5f7bb4c 100644
--- a/src/components/LayoutSidebar.tsx
+++ b/src/components/LayoutSidebar.tsx
@@ -18,13 +18,7 @@ import { approvalQueries } from "@app/lib/queries";
import { build } from "@server/build";
import { useQuery } from "@tanstack/react-query";
import { ListUserOrgsResponse } from "@server/routers/org";
-import {
- ArrowRight,
- ExternalLink,
- LayoutGrid,
- PanelRightOpen,
- Server
-} from "lucide-react";
+import { ExternalLink, PanelRightOpen } from "lucide-react";
import { useTranslations } from "next-intl";
import dynamic from "next/dynamic";
import Link from "next/link";
@@ -136,13 +130,6 @@ export function LayoutSidebar({
const showTrial =
build === "saas" && Boolean(orgId) && subscriptionContext?.isTrial;
- const isSettingsPage = Boolean(
- orgId && pathname?.includes(`/${orgId}/settings`)
- );
- const canViewResourceLauncher = Boolean(
- currentOrg?.isAdmin || currentOrg?.isOwner
- );
-
return (
- {!isAdminPage &&
- isSettingsPage &&
- canViewResourceLauncher &&
- orgId && (
-
- {isSidebarCollapsed ? (
-
-
-
-
-
-
-
-
-
-
-
- {t(
- "resourceSidebarLauncherTitle"
- )}
-
-
-
-
- ) : (
-
-
-
-
-
- {t("resourceSidebarLauncherTitle")}
-
-
- )}
-
- )}
- {!isAdminPage && user.serverAdmin && (
-
- {isSidebarCollapsed ? (
-
-
-
-
-
-
-
-
-
-
- {t("serverAdmin")}
-
-
-
- ) : (
-
-
-
-
-
- {t("serverAdmin")}
-
-
- )}
-
- )}
{canShowProductUpdates ? (
diff --git a/src/components/SidebarNav.tsx b/src/components/SidebarNav.tsx
index eb8386ffc..258d43a56 100644
--- a/src/components/SidebarNav.tsx
+++ b/src/components/SidebarNav.tsx
@@ -34,6 +34,7 @@ export type SidebarNavItem = {
showEE?: boolean;
isBeta?: boolean;
items?: SidebarNavItem[];
+ exact?: boolean;
};
export type SidebarNavSection = {
@@ -49,7 +50,14 @@ export interface SidebarNavProps extends React.HTMLAttributes {
notificationCounts?: Record;
}
-function isPathActive(pathname: string, href: string): boolean {
+function isPathActive(
+ pathname: string,
+ href: string,
+ exact?: boolean
+): boolean {
+ if (exact) {
+ return pathname === href;
+ }
return pathname === href || pathname.startsWith(`${href}/`);
}
@@ -289,7 +297,11 @@ function CollapsedNavItemWithPopover({
childItem.href
);
const childIsActive = childHydratedHref
- ? isPathActive(pathname, childHydratedHref)
+ ? isPathActive(
+ pathname,
+ childHydratedHref,
+ childItem.exact
+ )
: false;
const childIsEE =
build === "enterprise" &&
@@ -396,7 +408,7 @@ export function SidebarNav({
function isItemOrChildActive(item: SidebarNavItem): boolean {
const hydratedHref = hydrateHref(item.href);
- if (hydratedHref && isPathActive(pathname, hydratedHref)) {
+ if (hydratedHref && isPathActive(pathname, hydratedHref, item.exact)) {
return true;
}
if (item.items) {
@@ -412,7 +424,7 @@ export function SidebarNav({
const hydratedHref = hydrateHref(item.href);
const hasNestedItems = item.items && item.items.length > 0;
const isActive = hydratedHref
- ? isPathActive(pathname, hydratedHref)
+ ? isPathActive(pathname, hydratedHref, item.exact)
: false;
const isChildActive = hasNestedItems
? isItemOrChildActive(item)