From 7c96df2e119a728ff22e5ad78ddf483e3d702745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Garapich?= Date: Sun, 15 Dec 2024 12:13:34 +0100 Subject: [PATCH] feat: active navbar link --- src/documents/views/html/document.page.tsx | 4 +-- src/games/views/html/game-list.page.tsx | 2 +- src/games/views/html/game.page.tsx | 2 +- .../views/html/hall-of-fame.page.tsx | 2 +- src/html/components/games-link.tsx | 8 +++-- src/html/components/navigation-bar.tsx | 32 +++++++++++-------- src/players/views/html/player-list.page.tsx | 2 +- .../views/html/player-settings.page.tsx | 2 +- src/players/views/html/player.page.tsx | 2 +- src/queue/views/html/queue.page.tsx | 2 +- src/statistics/views/html/statistics.page.tsx | 2 +- 11 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/documents/views/html/document.page.tsx b/src/documents/views/html/document.page.tsx index 58bb8122..c84454ef 100644 --- a/src/documents/views/html/document.page.tsx +++ b/src/documents/views/html/document.page.tsx @@ -11,10 +11,10 @@ export function DocumentPage(document: DocumentModel, user?: User) { return ( - +
-
+
{document.name}
{safeParsed}
diff --git a/src/games/views/html/game-list.page.tsx b/src/games/views/html/game-list.page.tsx index 31ea7dd5..dc7498fe 100644 --- a/src/games/views/html/game-list.page.tsx +++ b/src/games/views/html/game-list.page.tsx @@ -21,7 +21,7 @@ export async function GameListPage(props: { user?: User | undefined; page: numbe return ( - +
Games
diff --git a/src/games/views/html/game.page.tsx b/src/games/views/html/game.page.tsx index 2c713204..e2d4de70 100644 --- a/src/games/views/html/game.page.tsx +++ b/src/games/views/html/game.page.tsx @@ -17,7 +17,7 @@ export async function GamePage(props: { game: GameModel; user?: User | undefined title={`game #${props.game.number}`} embedStyle={resolve(import.meta.dirname, 'style.css')} > - +
diff --git a/src/hall-of-game/views/html/hall-of-fame.page.tsx b/src/hall-of-game/views/html/hall-of-fame.page.tsx index cad4ac7a..fd47eae1 100644 --- a/src/hall-of-game/views/html/hall-of-fame.page.tsx +++ b/src/hall-of-game/views/html/hall-of-fame.page.tsx @@ -20,7 +20,7 @@ export async function HallOfFamePage(props: { user?: User | undefined }) { return ( - +
diff --git a/src/html/components/games-link.tsx b/src/html/components/games-link.tsx index 9e4cd4b0..be205f24 100644 --- a/src/html/components/games-link.tsx +++ b/src/html/components/games-link.tsx @@ -2,14 +2,18 @@ import { collections } from '../../database/collections' import { GameState } from '../../database/models/game.model' import { GameLiveIndicator } from './game-live-indicator' -export async function GamesLink() { +export async function GamesLink(props: { active: boolean }) { const gamesLiveCount = await collections.games.countDocuments({ state: { $in: [GameState.created, GameState.configuring, GameState.launching, GameState.started], }, }) return ( - 0 && 'accent']} id="navbar-games-link"> + 0 && 'accent', props.active && 'active']} + id="navbar-games-link" + > {gamesLiveCount > 0 ? : <>} Games diff --git a/src/html/components/navigation-bar.tsx b/src/html/components/navigation-bar.tsx index 1ff8cbbe..79237ee5 100644 --- a/src/html/components/navigation-bar.tsx +++ b/src/html/components/navigation-bar.tsx @@ -5,7 +5,7 @@ import { IconBrandSteam } from './icons/icon-brand-steam' import { Profile } from './profile' import Html from '@kitajs/html' -export function NavigationBar(props: Html.PropsWithChildren<{ user?: User | undefined }>) { +export function NavigationBar(props: { user?: User | undefined; currentPage: string }) { return (