From ab07b38c98a973e65e37f9e24d558f612e1b89b7 Mon Sep 17 00:00:00 2001 From: 6d486f49 Date: Mon, 28 Sep 2026 14:17:59 -0400 Subject: [PATCH] Vibe galaxy map --- .../add-galaxy-map-and-ui-improvements.md | 182 ++++++++ .../ZeroSpace.Web/Layout/MainLayout.razor.css | 28 +- ZeroSpace/ZeroSpace.Web/Layout/NavMenu.razor | 26 +- .../ZeroSpace.Web/Layout/NavMenu.razor.css | 92 ++++- ZeroSpace/ZeroSpace.Web/Pages/Galaxy.razor | 390 ++++++++++++++++++ .../ZeroSpace.Web/Pages/Galaxy.razor.css | 390 ++++++++++++++++++ ZeroSpace/ZeroSpace.Web/Pages/Home.razor | 306 +++++++++++++- ZeroSpace/ZeroSpace.Web/Pages/Home.razor.css | 182 ++++++++ .../Pages/StarSystemDetail.razor | 13 +- .../ZeroSpace.Web/Pages/StarSystemIndex.razor | 45 +- .../Pages/SystemMasteryIndex.razor | 12 +- ZeroSpace/ZeroSpace.Web/wwwroot/css/app.css | 247 ++++++++++- 12 files changed, 1844 insertions(+), 69 deletions(-) create mode 100644 .junie/plans/add-galaxy-map-and-ui-improvements.md create mode 100644 ZeroSpace/ZeroSpace.Web/Pages/Galaxy.razor create mode 100644 ZeroSpace/ZeroSpace.Web/Pages/Galaxy.razor.css create mode 100644 ZeroSpace/ZeroSpace.Web/Pages/Home.razor.css diff --git a/.junie/plans/add-galaxy-map-and-ui-improvements.md b/.junie/plans/add-galaxy-map-and-ui-improvements.md new file mode 100644 index 0000000..ca55775 --- /dev/null +++ b/.junie/plans/add-galaxy-map-and-ui-improvements.md @@ -0,0 +1,182 @@ +--- +sessionId: session-260928-131223-1ueu +--- + +# Requirements + +### Overview & Goals +The goal of this initiative is to elevate the UI and user experience of `ZeroSpace.Web` and introduce an interactive **Galaxy Map** page. The Galaxy Map will visually display all planetary nodes positioned by their coordinates `(X, Y)`, render connection lines between interconnected systems, and provide instant hover information popups detailing yields, occupation buffs, masteries, and faction classifications. + +### Scope +#### In Scope +- **Galaxy Page (`/galaxy`)**: Interactive star map rendering all 78 star systems from `StarSystems.All` with their actual `(X, Y)` spatial coordinates. +- **Connection Lines**: Drawing connection paths between systems based on `StarSystemData.ConnectedSystems`. +- **Hover Information Popup**: Dynamic floating tooltip/card showing system name, kind, occupation buffs, system masteries, yield bonuses, and connections. +- **Click Navigation**: Direct navigation from galaxy nodes to `/StarSystem/{Id}` details page. +- **UI & Aesthetic Overhaul**: + - Updating `NavMenu.razor` with a dedicated Galaxy Map entry and modern styling. + - Revamping `Home.razor` from default template placeholder to an engaging sci-fi overview dashboard. + - Enhancing theme colors, badge indicators, cards, and typography in `app.css`. + +#### Out of Scope +- Backend database schema modifications (uses existing static/generated `ZeroSpace.Model` records). +- Real-time multiplayer synchronization or editing capabilities (map editing remains in `ZeroSpace.MapEditor`). + +### User Stories +- **As a player / wiki reader**, I want to view a visual galaxy map with all planetary nodes and connections so that I can understand system layout and routes across the galaxy. +- **As a player**, I want to hover over any planetary node to immediately see its occupation buff, yields, and system mastery without having to navigate to separate pages. +- **As a user**, I want to click on a star system node on the map to navigate directly to its detailed page. +- **As a user**, I want a sleek, cohesive dark sci-fi web interface with clear navigation and a functional dashboard. + +### Functional Requirements +1. **Galaxy Map Rendering**: + - The map shall render an SVG canvas encompassing coordinate bounds (0 to 1000) preserving aspect ratio. + - Lines must connect every system with its entries in `ConnectedSystems` without duplicate edge rendering. + - Planetary nodes shall be rendered as circular nodes styled and colored according to `StarSystemKind`: + - *Homeworld*: Vibrant Emerald / Green (`#43a047` / `#10b981`) + - *Core*: Vibrant Amber / Orange (`#fb8c00` / `#f59e0b`) + - *Side*: Vibrant Sky Blue / Cyan (`#4a90d9` / `#38bdf8`) +2. **Hover Information Popup**: + - Hovering over a planet node triggers a floating information popup. + - Popup content includes: + - Planet Name & Kind badge + - Occupation buff (e.g. `+50 Starting Hexite`) + - System mastery name (if present) + - Higher yield indicators (Influence, Credits, Energy, Items) + - Count and list of connected star systems + - Tooltip disappears smoothly when the cursor leaves the node. +3. **Map Interaction**: + - Hovering a node highlights the node (glow ring) and highlights incoming/outgoing connection lines. + - Clicking a node navigates to `/StarSystem/{Id}`. +4. **App Navigation & Home Page**: + - `NavMenu.razor` includes a link to `/galaxy` labeled "Galaxy Map" with an appropriate icon. + - `Home.razor` provides quick-launch cards to Galaxy Map, Star Systems, Masteries, and Units with summary counts. + +### Non-Functional Requirements +- **Performance**: Instant SVG rendering with zero lag for 78 nodes and ~200 connections; pure CSS/Blazor event handling with no external heavy mapping dependencies. +- **Responsiveness**: Map scales smoothly inside its container across desktop and mobile screens. +- **Accessibility**: Clear contrast ratios, readable tooltips, and keyboard/touch support for node selection. + +# Technical Design + +### Current Implementation +- `ZeroSpace.Model.StarSystems.All`: Contains all 78 star systems with records containing `Id`, `Name`, `Kind`, `X`, `Y`, `ConnectedSystems`, `OccupationBuff`, `SystemMastery`, and yield flags. +- `ZeroSpace.Web`: Blazor WebAssembly application using Bootstrap 5 and Telerik Blazor components. +- Existing pages include `StarSystemIndex.razor`, `StarSystemDetail.razor`, `SystemMasteryIndex.razor`, and `Units.razor`. +- `Home.razor` is currently a default "Hello World" template placeholder. + +### Key Decisions +1. **SVG Vector Graphics for Galaxy Map**: + - *Chosen Approach*: Native Blazor SVG rendering (``). + - *Rationale*: SVG offers vector sharpness at all display resolutions, reactive Blazor event binding (`@onmouseenter`, `@onmouseleave`, `@onclick`), lightweight footprint, and zero external JS dependency overhead. +2. **Dynamic Overlay Tooltip**: + - *Chosen Approach*: HTML/CSS floating glassmorphism card positioned relative to the hovered node/cursor with smooth fade transition. + - *Rationale*: Allows rich formatting (badges, icons, multi-column yields) and styling that matches the dark sci-fi aesthetic better than native SVG `` or basic browser tooltips. +3. **Connection Line Optimization**: + - *Chosen Approach*: Precompute unique undirected edge pairs `(From, To)` on initialization. + - *Rationale*: Prevents duplicate overlapping lines between reciprocal connections `A -> B` and `B -> A`, improving render performance and visual clarity. + +### Proposed Architecture & Flow + +```mermaid +graph TD + Nav[NavMenu.razor] -->|Navigate /galaxy| GalaxyPage[Galaxy.razor] + Home[Home.razor] -->|Quick Link| GalaxyPage + + subgraph Galaxy.razor + Model[StarSystems.All] --> EdgeBuilder[Connection Deduplicator] + EdgeBuilder --> SVGCanvas[SVG Canvas ViewBox 0 0 1000 1000] + Model --> NodeRenderer[Node Elements & Coordinates] + + SVGCanvas --> Lines[SVG Lines: Connection Paths] + SVGCanvas --> Nodes[SVG Circles & Glows: Planets] + + Nodes -->|@onmouseenter| HoverState[Hovered System State] + Nodes -->|@onclick| NavAction[NavigationManager.NavigateTo /StarSystem/Id] + + HoverState --> Popup[Floating Planet Info Card] + end +``` + +### Components & File Structure +- **New Files**: + - `ZeroSpace.Web/Pages/Galaxy.razor`: Main Galaxy map page containing the SVG viewport, control header, node filtering/legend, and popup overlay. + - `ZeroSpace.Web/Pages/Galaxy.razor.css`: Scoped styles for map container, SVG glow effects, connection styling, and animated hover card. +- **Modified Files**: + - `ZeroSpace.Web/Layout/NavMenu.razor`: Add "Galaxy Map" item with navigation icon. + - `ZeroSpace.Web/Pages/Home.razor`: Overhaul into a sci-fi hub with hero banner and feature cards. + - `ZeroSpace.Web/wwwroot/css/app.css`: Dark sci-fi styling improvements, badge colors, and glassmorphism utilities. + +### Data Models / Contracts +```csharp +public sealed record ConnectionEdge( + StarSystemData From, + StarSystemData To); + +public sealed class GalaxyMapState +{ + public IReadOnlyList Systems { get; set; } = StarSystems.All; + public IReadOnlyList Connections { get; set; } = []; + public StarSystemData? HoveredSystem { get; set; } + public double TooltipX { get; set; } + public double TooltipY { get; set; } + public string? SelectedKindFilter { get; set; } +} +``` + +### Risks & Mitigations +- **Tooltip overflow near screen edges**: Clamp calculated tooltip coordinates within container boundaries to prevent viewport clipping. +- **Coordinate overlap on small screens**: Ensure viewBox preserves 1:1 aspect ratio (`preserveAspectRatio="xMidYMid meet"`) and allow zooming/scaling via standard CSS/viewport responsiveness. + +# Testing + +### Validation Approach +Verification will be performed through build checks, component markup analysis, and interactive scenario validation in the Blazor runtime. + +### Key Scenarios +1. **Galaxy Map Rendering**: + - Verify that all 78 star systems are rendered at their designated `(X, Y)` positions. + - Verify that connection lines accurately connect linked systems without orphaned or broken lines. + - Verify node color coding matches `StarSystemKind` (Homeworld, Core, Side). +2. **Hover Information Popup**: + - Hovering over a planet node displays the popup immediately. + - Verify all fields render accurately (Occupation buff, System mastery, Yields, Connected systems list). + - Moving the mouse away dismisses the popup cleanly. +3. **Navigation & Interactivity**: + - Clicking a node navigates to the corresponding `/StarSystem/{Id}` route. + - Navigating via the "Galaxy Map" link in `NavMenu.razor` loads the page properly. +4. **UI & Responsiveness**: + - Verify `Home.razor` renders updated dashboard cards and quick links. + - Verify dark-theme sci-fi visual style across desktop and smaller browser viewports. + +### Regressions & Edge Cases +- Star systems without occupation buffs or masteries display clean fallback dashes (`—`) without layout breaks. +- Rapid mouse movements over adjacent nodes update the hover popup smoothly without flickering. + +# Delivery Steps + +### ✓ Step 1: Implement Galaxy Map SVG rendering and connection lines +A functional SVG-based Galaxy Map page (`Galaxy.razor`) renders all star system nodes and connection lines based on their world coordinates. + +- Create `ZeroSpace.Web/Pages/Galaxy.razor` with route `@page "/galaxy"` and navigation title. +- Parse `StarSystems.All` to extract unique undirected connection pairs and planetary node coordinate models. +- Render connection lines (``) in SVG with dark-steel futuristic line styling (`#3a4d6b`, opacity, glow). +- Render planetary nodes (`` / ``) positioned at `(system.X, system.Y)` using color coding based on `StarSystemKind` (Homeworld = green, Core = orange/amber, Side = blue/cyan). +- Add SVG viewBox scaling (e.g. `0 0 1000 1000`) and responsive container layout to ensure crisp vector rendering on all screen sizes. +- Implement click handlers on nodes to navigate directly to `/StarSystem/{Id}`. + +### ✓ Step 2: Implement dynamic planetary hover popup and interactive highlights +Interactive hover tooltip overlays display rich star system details when the user hovers over any planet node on the galaxy map. + +- Design a floating glassmorphism hover card component / markup positioned dynamically relative to the active node or cursor. +- Display star system metadata: system name, `Kind` badge, `OccupationBuff`, `SystemMastery` link, and `Yield` bonuses (Influence, Credits, Energy, Items). +- Add highlight visual effects when hovering over a node (pulsing glow radius, highlight connected lines). +- Handle edge cases such as tooltip boundary clamping near viewport edges and debounced mouse enter/leave events. + +### ✓ Step 3: Refine global UI, navigation menu, and dashboard landing page +ZeroSpace.Web navigation, Home landing dashboard, and global UI styles are updated to match a polished sci-fi space aesthetic. + +- Update `ZeroSpace.Web/Layout/NavMenu.razor` with a dedicated "Galaxy Map" navigation link with custom star/galaxy icon. +- Transform `ZeroSpace.Web/Pages/Home.razor` into an overview hub showcasing quick links and summary stats for Galaxy Map, Star Systems, System Masteries, and Units. +- Enhance `ZeroSpace.Web/wwwroot/css/app.css` and component stylesheets with refined dark-theme colors, glassmorphism cards, glowing badges, and smooth hover transitions. +- Verify solution builds cleanly and all navigation flows between the Galaxy map, system details, and other pages work seamlessly. \ No newline at end of file diff --git a/ZeroSpace/ZeroSpace.Web/Layout/MainLayout.razor.css b/ZeroSpace/ZeroSpace.Web/Layout/MainLayout.razor.css index cd870cb..2103f55 100644 --- a/ZeroSpace/ZeroSpace.Web/Layout/MainLayout.razor.css +++ b/ZeroSpace/ZeroSpace.Web/Layout/MainLayout.razor.css @@ -2,21 +2,32 @@ position: relative; display: flex; flex-direction: column; + min-height: 100vh; + background-color: #080c14; + background-image: + radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.04) 0%, transparent 40%), + radial-gradient(circle at 85% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 40%); } main { flex: 1; + min-width: 0; } .sidebar { - background-image: linear-gradient(180deg, #0d1117 0%, #161b22 70%); + background-color: #0b0f19; + background-image: linear-gradient(180deg, #0d131f 0%, #080c14 100%); + border-right: 1px solid rgba(56, 189, 248, 0.12); + box-shadow: 2px 0 16px rgba(0, 0, 0, 0.35); + z-index: 100; } .top-row { - background-color: #f7f7f7; - border-bottom: 1px solid #d6d5d5; + background-color: rgba(13, 19, 31, 0.8); + backdrop-filter: blur(8px); + border-bottom: 1px solid rgba(56, 189, 248, 0.15); justify-content: flex-end; - height: 3.5rem; + height: 3.75rem; display: flex; align-items: center; } @@ -25,10 +36,12 @@ main { white-space: nowrap; margin-left: 1.5rem; text-decoration: none; + color: #38bdf8; } .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { text-decoration: underline; + color: #7dd3fc; } .top-row ::deep a:first-child { @@ -56,6 +69,7 @@ main { height: 100vh; position: sticky; top: 0; + flex-shrink: 0; } .top-row { @@ -70,8 +84,10 @@ main { width: 0; } - .top-row, article { + article { padding-left: 2rem !important; - padding-right: 1.5rem !important; + padding-right: 2rem !important; + padding-top: 1.5rem !important; + padding-bottom: 2.5rem !important; } } diff --git a/ZeroSpace/ZeroSpace.Web/Layout/NavMenu.razor b/ZeroSpace/ZeroSpace.Web/Layout/NavMenu.razor index da4dede..1a6b694 100644 --- a/ZeroSpace/ZeroSpace.Web/Layout/NavMenu.razor +++ b/ZeroSpace/ZeroSpace.Web/Layout/NavMenu.razor @@ -1,6 +1,9 @@