diff --git a/app/providers.tsx b/app/providers.tsx index 8e1aeb1..6d2a43c 100644 --- a/app/providers.tsx +++ b/app/providers.tsx @@ -1,38 +1,13 @@ "use client"; -import Navbar from "@/components/custom/navbar"; import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable"; -import { Activity, Info, LogOut, Waypoints } from "lucide-react"; -import { SessionProvider, signOut } from "next-auth/react"; +import { SessionProvider } from "next-auth/react"; import { ThemeProvider } from 'next-themes' import { useEffect, useRef, useState } from "react"; import { ImperativePanelHandle } from "react-resizable-panels"; +import Navbar from "@/components/custom/navbar"; import useScreenSize from "./useScreenSize"; -const LINKS = [ - { - name: "Connection Details", - href: "/details", - icon: (), - }, - { - name: "Graph", - href: "/graph", - icon: (), - }, - { - name: "Monitor", - href: "/monitor", - icon: (), - }, - { - name: "Disconnect", - href: "", - icon: (), - onClick: () => { signOut({ callbackUrl: '/login' }) } - }, -] - export default function NextAuthProvider({ children }: { children: React.ReactNode }) { const { screenSize } = useScreenSize(); @@ -60,8 +35,8 @@ export default function NextAuthProvider({ children }: { children: React.ReactNo } } } - const panelSize = isSmallScreen ? 40 : 10 - const collapsedSize = isSmallScreen ? 20 : 3 + const panelSize = 9 + const collapsedSize = 3 return ( @@ -76,7 +51,7 @@ export default function NextAuthProvider({ children }: { children: React.ReactNo minSize={panelSize} onCollapse={() => { setCollapsed(true) }} onExpand={() => { setCollapsed(false) }}> - + {children} diff --git a/components/custom/navbar.tsx b/components/custom/navbar.tsx index 7fd7138..9f2bdb8 100644 --- a/components/custom/navbar.tsx +++ b/components/custom/navbar.tsx @@ -1,14 +1,16 @@ /* eslint-disable jsx-a11y/anchor-is-valid */ -import { Menu } from "lucide-react"; -import { useSession } from "next-auth/react"; +import { Activity, Info, LogOut, Menu, Settings, Waypoints } from "lucide-react"; +import { signOut, useSession } from "next-auth/react"; import Link from "next/link"; import { useEffect, useState } from "react"; import { useTheme } from "next-themes"; import { usePathname } from "next/navigation"; import { cn } from "@/lib/utils" +import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu"; import { Switch } from "../ui/switch"; import { Label } from "../ui/label"; import GithubMark from "./GithubMark"; +import { DropdownMenu, DropdownMenuContent } from "../ui/dropdown-menu"; export interface LinkDefinition { name: string, @@ -17,10 +19,36 @@ export interface LinkDefinition { onClick?: () => void } -export default function Navbar({ links, collapsed, onExpand }: { links: LinkDefinition[], collapsed: boolean, onExpand:()=>void }) { +const linksUp: LinkDefinition[] = [ + { + name: "Graph", + href: "/graph", + icon: (), + }, + { + name: "Monitor", + href: "/monitor", + icon: (), + }, +] + +const linksDown: LinkDefinition[] = [ + { + name: "Connection Details", + href: "/details", + icon: (), + }, + { + name: "Disconnect", + href: "", + icon: (), + onClick: () => { signOut({ callbackUrl: '/login' }) } + }, +] + +export default function Navbar({ collapsed, onExpand }: { collapsed: boolean, onExpand: () => void }) { const { status } = useSession() const { theme, setTheme, systemTheme } = useTheme() - const [mounted, setMounted] = useState(false) const pathName = usePathname() useEffect(() => { @@ -37,42 +65,94 @@ export default function Navbar({ links, collapsed, onExpand }: { links: LinkDefi const darkmode = theme === "dark" || (theme === "system" && systemTheme === "dark") return ( - ) } \ No newline at end of file diff --git a/e2e/homePage.spec.ts b/e2e/homePage.spec.ts index 60b3f45..005ea48 100644 --- a/e2e/homePage.spec.ts +++ b/e2e/homePage.spec.ts @@ -1,18 +1,17 @@ import { expect, test } from '@playwright/test'; test.beforeEach(async ({ page }) => { - await page.goto('http://localhost:3000/'); + await page.goto('http://localhost:3000/'); }); test('connect', async ({ page }) => { await page.getByRole('button').click(); await page.waitForURL('http://localhost:3000/login'); expect(page.url()).toBe('http://localhost:3000/login'); - }); test('themes', async ({ page }) => { - await page.getByLabel('system mode').click(); - await page.getByLabel('dark mode').click(); - await page.getByLabel('light mode').click(); + await page.getByLabel('system mode').click(); + await page.getByLabel('dark mode').click(); + await page.getByLabel('light mode').click(); }); \ No newline at end of file