+ {variant === "page" ? (
+
+ ) : null}
diff --git a/frontend/components/profile/profile-section-nav.tsx b/frontend/components/profile/profile-section-nav.tsx
index a5959afb..f72cd591 100644
--- a/frontend/components/profile/profile-section-nav.tsx
+++ b/frontend/components/profile/profile-section-nav.tsx
@@ -42,23 +42,26 @@ export function ProfileSectionNav({
if (tabs.length <= 1) return null
return (
-
}
+ subscriptions={
Subscriptions content
}
+ groups={
Groups content
}
+ activity={
Activity content
}
+ runList={
Report Runs content
}
+ atlasHistory={
Atlas History content
}
+ analytics={
Analytics content
}
+ />,
+ )
+
+ expect(screen.getByText("Report Runs content")).toBeInTheDocument()
+ expect(screen.queryByText("Stars content")).not.toBeInTheDocument()
+ })
+})
diff --git a/frontend/components/users/user-page-tabs.tsx b/frontend/components/users/user-page-tabs.tsx
index 68151653..c60cbca0 100644
--- a/frontend/components/users/user-page-tabs.tsx
+++ b/frontend/components/users/user-page-tabs.tsx
@@ -55,7 +55,7 @@ export function UserPageTabs({
return (
-
+
{stars}
diff --git a/frontend/components/users/user-section-nav.test.ts b/frontend/components/users/user-section-nav.test.ts
new file mode 100644
index 00000000..d184b1c3
--- /dev/null
+++ b/frontend/components/users/user-section-nav.test.ts
@@ -0,0 +1,41 @@
+import { describe, it, expect } from "vitest"
+import { getDefaultUserTab, type UserTabId } from "./user-section-nav"
+
+describe("getDefaultUserTab", () => {
+ const allTabs: UserTabId[] = [
+ "stars",
+ "subscriptions",
+ "groups",
+ "activity",
+ "run-list",
+ "atlas-history",
+ "analytics",
+ ]
+
+ it("returns stars when user is viewing their own profile and stars tab is available", () => {
+ const tab = getDefaultUserTab(true, allTabs)
+ expect(tab).toBe("stars")
+ })
+
+ it("returns run-list when user is viewing another profile and run-list is available", () => {
+ const tab = getDefaultUserTab(false, allTabs)
+ expect(tab).toBe("run-list")
+ })
+
+ it("returns the first available tab if the preferred default is not available for current user", () => {
+ const tabs: UserTabId[] = ["subscriptions", "groups", "activity"]
+ const tab = getDefaultUserTab(true, tabs)
+ expect(tab).toBe("subscriptions")
+ })
+
+ it("returns the first available tab if the preferred default is not available for other user", () => {
+ const tabs: UserTabId[] = ["subscriptions", "groups", "activity"]
+ const tab = getDefaultUserTab(false, tabs)
+ expect(tab).toBe("subscriptions")
+ })
+
+ it("defaults to stars if tabs array is unexpectedly empty", () => {
+ const tab = getDefaultUserTab(true, [])
+ expect(tab).toBe("stars")
+ })
+})
diff --git a/frontend/components/users/user-section-nav.tsx b/frontend/components/users/user-section-nav.tsx
index f47b7258..67a8ad6f 100644
--- a/frontend/components/users/user-section-nav.tsx
+++ b/frontend/components/users/user-section-nav.tsx
@@ -46,7 +46,7 @@ export function getUserTabs(options: {
export function getDefaultUserTab(isCurrentUser: boolean, tabs: UserTabId[]): UserTabId {
if (isCurrentUser && tabs.includes("stars")) return "stars"
- if (!isCurrentUser && tabs.includes("activity")) return "activity"
+ if (!isCurrentUser && tabs.includes("run-list")) return "run-list"
return tabs[0] ?? "stars"
}
@@ -59,11 +59,11 @@ export function getHashUserTab(hash: string | null, tabs: UserTabId[]): UserTabI
export function UserSectionNav({
activeTab,
tabs,
- onTabChange,
+ onTabChangeAction,
}: {
activeTab: UserTabId
tabs: UserTabId[]
- onTabChange: (tab: UserTabId) => void
+ onTabChangeAction: (tab: UserTabId) => void
}) {
const [currentHash, setCurrentHash] = useState("")
@@ -88,7 +88,7 @@ export function UserSectionNav({
event.preventDefault()
window.history.replaceState(null, "", `#${tab}`)
setCurrentHash(tab)
- onTabChange(tab)
+ onTabChangeAction(tab)
}}
className={
activeTab === tab || currentHash === tab