From 35982746f76279bb1a7180f6ce86e7469f6fa737 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 22 Jul 2026 09:58:55 -0700 Subject: [PATCH] Add persistent mobile home link --- .../src/components/app-layout/NavBar.test.tsx | 32 +++++------- frontend/src/components/app-layout/NavBar.tsx | 49 ++++++++++++++++--- frontend/src/components/app-layout/styles.tsx | 5 +- 3 files changed, 58 insertions(+), 28 deletions(-) diff --git a/frontend/src/components/app-layout/NavBar.test.tsx b/frontend/src/components/app-layout/NavBar.test.tsx index a390d4bc..cce0e6cc 100644 --- a/frontend/src/components/app-layout/NavBar.test.tsx +++ b/frontend/src/components/app-layout/NavBar.test.tsx @@ -1,37 +1,31 @@ -import { render, screen } from "@testing-library/react"; +import { screen } from "@testing-library/react"; import { describe, it, expect } from "vitest"; import NavBar from "./NavBar"; +import { renderWithProviders } from "../../tests/test-utils"; describe("NavBar", () => { - it("renders Working Groups link with correct URL", () => { - render(); + it("renders an explicit homepage link", () => { + renderWithProviders(); - const workingGroupsLink = screen.getByRole("link", { - name: /working groups/i, + const homeLink = screen.getByRole("link", { + name: /gpu mode home/i, }); - expect(workingGroupsLink).toBeInTheDocument(); - expect(workingGroupsLink).toHaveAttribute("href", "/working-groups"); - // Internal link should not have target="_blank" or rel="noopener" - expect(workingGroupsLink).not.toHaveAttribute("target", "_blank"); - expect(workingGroupsLink).not.toHaveAttribute("rel", "noopener"); + expect(homeLink).toHaveAttribute("href", "/home"); + expect(homeLink).toHaveTextContent("Home"); }); it("renders all expected navigation links in correct order", () => { - render(); + renderWithProviders(); const links = screen.getAllByRole("link"); const navigationLinks = links.filter((link) => - ["News", "Working Groups", "Events", "Resources", "Docs"].includes( - link.textContent || "", - ), + ["News", "Events", "Projects"].includes(link.textContent || ""), ); - expect(navigationLinks).toHaveLength(5); + expect(navigationLinks).toHaveLength(3); expect(navigationLinks[0]).toHaveTextContent("News"); - expect(navigationLinks[1]).toHaveTextContent("Working Groups"); - expect(navigationLinks[2]).toHaveTextContent("Events"); - expect(navigationLinks[3]).toHaveTextContent("Resources"); - expect(navigationLinks[4]).toHaveTextContent("Docs"); + expect(navigationLinks[1]).toHaveTextContent("Events"); + expect(navigationLinks[2]).toHaveTextContent("Projects"); }); }); diff --git a/frontend/src/components/app-layout/NavBar.tsx b/frontend/src/components/app-layout/NavBar.tsx index 8f10edbf..541503ca 100644 --- a/frontend/src/components/app-layout/NavBar.tsx +++ b/frontend/src/components/app-layout/NavBar.tsx @@ -4,6 +4,7 @@ import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward"; import LightModeIcon from "@mui/icons-material/LightMode"; import DarkModeIcon from "@mui/icons-material/DarkMode"; import SettingsBrightnessIcon from "@mui/icons-material/SettingsBrightness"; +import HomeRoundedIcon from "@mui/icons-material/HomeRounded"; import { useTheme } from "@mui/material/styles"; import { flexRowCenter, @@ -60,15 +61,42 @@ export default function NavBar() { ]; const Brand = () => ( - - - + + + + + Home + + @@ -80,12 +108,19 @@ export default function NavBar() { return ( - + {/* Left: Brand */} {/* Middle: Links */} - + {links.map(({ label, href, external }) => ( = { ...flexRowCenter, ...mediumText, fontWeight: "bold", - ml: -2, // Negative left margin to reduce space from left edge + flexShrink: 0, + ml: { xs: 0, sm: -2 }, // Keep the mobile home control fully visible mr: { - xs: 2, // margin on extra-small screens + xs: 1, // margin on extra-small screens sm: 4, // margin on small screens md: 8, // margin on medium screens lg: 16, // margin on large screens