From 5079a884767285b23f3a330b49e075189099825a Mon Sep 17 00:00:00 2001 From: nadia Date: Tue, 2 Jun 2026 15:06:12 +0200 Subject: [PATCH 1/5] add dashside highlight, not working for overview yet) --- .../tournament/dashboard/DashSide.tsx | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/components/tournament/dashboard/DashSide.tsx b/src/components/tournament/dashboard/DashSide.tsx index c20dd65..761779d 100644 --- a/src/components/tournament/dashboard/DashSide.tsx +++ b/src/components/tournament/dashboard/DashSide.tsx @@ -1,3 +1,5 @@ +"use client"; + import { LucideBetweenHorizontalStart, LucideCastle, @@ -16,6 +18,7 @@ import { import { ComponentType } from "react"; import { Link } from "@/i18n/navigation"; import "@/i18n/language-utils"; +import { usePathname } from "next/navigation"; import { useTranslations } from "next-intl"; import { DebatecoreLogo } from "@/components/debatecore/DebatecoreLogo"; import { GrandaLogo } from "@/components/debatecore/GrandaLogo"; @@ -41,14 +44,18 @@ type DashSidebarLinks = { links: DashSideLink[]; }[]; -const DashSide = ({ - tournament_path, - path_highlight, -}: { - tournament_path: string; - path_highlight?: string; -}) => { +const DashSide = ({ tournament_path }: { tournament_path: string }) => { const t = useTranslations("dash"); + const currentPathname = usePathname() ?? ""; + + const matchPaths = (str: string, target: string) => { + const getParam = (p: string) => + p.match( + /(?<=\/t\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/)[^\/]+/, + )?.[0]; + const s = getParam(str); + return !!s && s === getParam(target); + }; const links: DashSidebarLinks = [ { @@ -175,13 +182,15 @@ const DashSide = ({ {category.links.map((link) => { const Icon = link.icon; - const isHighlighted = link.name === path_highlight; + const isHighlighted = matchPaths(currentPathname, link.href); return ( Date: Fri, 5 Jun 2026 23:10:59 +0200 Subject: [PATCH 2/5] fix overview not working --- src/components/tournament/dashboard/DashSide.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/tournament/dashboard/DashSide.tsx b/src/components/tournament/dashboard/DashSide.tsx index 761779d..6538539 100644 --- a/src/components/tournament/dashboard/DashSide.tsx +++ b/src/components/tournament/dashboard/DashSide.tsx @@ -49,12 +49,16 @@ const DashSide = ({ tournament_path }: { tournament_path: string }) => { const currentPathname = usePathname() ?? ""; const matchPaths = (str: string, target: string) => { - const getParam = (p: string) => - p.match( - /(?<=\/t\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\/)[^\/]+/, - )?.[0]; + const getParam = (p: string) => { + const parts = p.split( + /\/t\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/, + ); + if (parts.length < 2) return undefined; + return parts[1].replace(/^\/|\/$/g, "").split("/")[0]; + }; + const s = getParam(str); - return !!s && s === getParam(target); + return s !== undefined && s === getParam(target); }; const links: DashSidebarLinks = [ From b9069fec6fa813469d47a804686ca84a0afe7438 Mon Sep 17 00:00:00 2001 From: nadia Date: Fri, 5 Jun 2026 23:13:10 +0200 Subject: [PATCH 3/5] bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4fe9429..af950f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "granda-front", - "version": "0.3.2", + "version": "0.3.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "granda-front", - "version": "0.3.2", + "version": "0.3.10", "dependencies": { "@radix-ui/react-dropdown-menu": "^2.1.6", "@radix-ui/react-select": "^2.2.6", diff --git a/package.json b/package.json index a20709f..2e759b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "granda-front", - "version": "0.3.2", + "version": "0.3.10", "private": true, "scripts": { "dev": "next dev --turbopack", From a48f686d91b4cdef1ff823f1a415ef612d887f80 Mon Sep 17 00:00:00 2001 From: nadia Date: Fri, 12 Jun 2026 13:06:29 +0200 Subject: [PATCH 4/5] add playwright test --- test/e2e/sidebarHighlight.test.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/e2e/sidebarHighlight.test.ts diff --git a/test/e2e/sidebarHighlight.test.ts b/test/e2e/sidebarHighlight.test.ts new file mode 100644 index 0000000..c51fe17 --- /dev/null +++ b/test/e2e/sidebarHighlight.test.ts @@ -0,0 +1,27 @@ +import { expect } from "@playwright/test"; +import { testInTournamentAsAdmin } from "./e2eUtils"; + +testInTournamentAsAdmin( + "sidebar highlights the current page", + async ({ page }) => { + // GIVEN + const overviewSidebarItem = page.getByRole("link", { name: "Overview" }); + const tournamentSidebarItem = page.getByRole("link", { + name: "Tournament Ladder", + }); + const debatesSidebarItem = page.getByRole("link", { name: "Debates" }); + + await expect(overviewSidebarItem).toHaveClass(/border-stone-600/); + await expect(tournamentSidebarItem).not.toHaveClass(/border-stone-600/); + await expect(debatesSidebarItem).not.toHaveClass(/border-stone-600/); + + // WHEN + await tournamentSidebarItem.click(); + + // THEN + await page.waitForURL(/\/en\/t\/[^/]+\/ladder$/); + await expect(overviewSidebarItem).not.toHaveClass(/border-stone-600/); + await expect(tournamentSidebarItem).toHaveClass(/border-stone-600/); + await expect(debatesSidebarItem).not.toHaveClass(/border-stone-600/); + }, +); From df6d518478c6415f996149d245e28b96c9f9d936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Dobrzy=C5=84ski?= Date: Wed, 10 Jun 2026 11:19:47 +0200 Subject: [PATCH 5/5] fix: use ghcr in testcontainers --- test/e2e/e2eUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/e2eUtils.ts b/test/e2e/e2eUtils.ts index edd5b48..6c883cc 100644 --- a/test/e2e/e2eUtils.ts +++ b/test/e2e/e2eUtils.ts @@ -229,7 +229,7 @@ export class TestContainers { .withNetworkAliases("postgres") .start(); const connectionString = `postgresql://${db.getUsername()}:${db.getPassword()}@postgres:5432/${db.getDatabase()}`; - const server = await new GenericContainer("tau:latest") + const server = await new GenericContainer("ghcr.io/debatecore/tau:latest") .withNetwork(network) .withExposedPorts(DEFAULT_BACKEND_PORT) .withWaitStrategy(Wait.forHttp("/health", DEFAULT_BACKEND_PORT))