From 7b6329c30ab8bc77562df6074e54ae86b1a710e3 Mon Sep 17 00:00:00 2001 From: Alexandru Macocian Date: Mon, 29 Jun 2026 20:09:21 +0200 Subject: [PATCH] Focus View Grid layout and resizable components --- .../Configuration/Options/FocusViewOptions.cs | 29 +++ .../FocusView/TitleInformationComponent.razor | 29 ++- .../TitleInformationComponent.razor.css | 12 + .../FocusView/VanquishComponent.razor | 44 +++- .../FocusView/VanquishComponent.razor.css | 9 + Daybreak.Core/Views/FocusView.razor | 239 +++++++++++++++--- Daybreak.Core/Views/FocusView.razor.cs | 135 +++++++++- Daybreak.Core/Views/FocusView.razor.css | 195 ++++++++++++-- Daybreak.Core/wwwroot/Index.html | 3 + .../deps/gridstack/12.6.0/gridstack-all.js | 3 + .../deps/gridstack/12.6.0/gridstack.min.css | 1 + Daybreak.Core/wwwroot/js/focus-grid.js | 94 +++++++ .../Models/FocusView/FocusViewComponent.cs | 13 + .../Models/FocusView/FocusViewTile.cs | 24 ++ .../TitleInformationComponentContext.cs | 2 +- 15 files changed, 741 insertions(+), 91 deletions(-) create mode 100644 Daybreak.Core/wwwroot/deps/gridstack/12.6.0/gridstack-all.js create mode 100644 Daybreak.Core/wwwroot/deps/gridstack/12.6.0/gridstack.min.css create mode 100644 Daybreak.Core/wwwroot/js/focus-grid.js create mode 100644 Daybreak.Shared/Models/FocusView/FocusViewComponent.cs create mode 100644 Daybreak.Shared/Models/FocusView/FocusViewTile.cs diff --git a/Daybreak.Core/Configuration/Options/FocusViewOptions.cs b/Daybreak.Core/Configuration/Options/FocusViewOptions.cs index 7a86ce2a..9eb13f99 100644 --- a/Daybreak.Core/Configuration/Options/FocusViewOptions.cs +++ b/Daybreak.Core/Configuration/Options/FocusViewOptions.cs @@ -39,4 +39,33 @@ public sealed class FocusViewOptions [JsonPropertyName(nameof(EnergyDisplay))] [OptionName(Name = "Energy Display Mode", Description = "Sets how should the energy display show the information")] public PointsDisplay EnergyDisplay { get; set; } + + [JsonPropertyName(nameof(GridColumns))] + [OptionName(Name = "Layout Grid Columns", Description = "Number of columns in the focus view layout grid")] + [OptionIgnore] + public int GridColumns { get; set; } = DefaultGridColumns; + + [JsonPropertyName(nameof(GridRows))] + [OptionName(Name = "Layout Grid Rows", Description = "Number of rows in the focus view layout grid")] + [OptionIgnore] + public int GridRows { get; set; } = DefaultGridRows; + + [JsonPropertyName(nameof(Layout))] + [OptionName(Name = "Layout", Description = "Tile-based layout of the focus view components")] + public List Layout { get; set; } = DefaultLayout(); + + public const int DefaultGridColumns = 20; + public const int DefaultGridRows = 16; + + public static List DefaultLayout() => + [ + new() { Component = FocusViewComponent.Character, Column = 1, Row = 1, ColumnSpan = 10, RowSpan = 3 }, + new() { Component = FocusViewComponent.PlayerResources, Column = 1, Row = 4, ColumnSpan = 10, RowSpan = 3 }, + new() { Component = FocusViewComponent.Vanquish, Column = 1, Row = 7, ColumnSpan = 10, RowSpan = 1 }, + new() { Component = FocusViewComponent.Title, Column = 1, Row = 8, ColumnSpan = 10, RowSpan = 1 }, + new() { Component = FocusViewComponent.CurrentMap, Column = 1, Row = 9, ColumnSpan = 10, RowSpan = 1 }, + new() { Component = FocusViewComponent.QuestLog, Column = 1, Row = 10, ColumnSpan = 10, RowSpan = 7 }, + new() { Component = FocusViewComponent.Build, Column = 11, Row = 1, ColumnSpan = 10, RowSpan = 5 }, + new() { Component = FocusViewComponent.Browser, Column = 11, Row = 6, ColumnSpan = 10, RowSpan = 11 }, + ]; } diff --git a/Daybreak.Core/Views/Components/FocusView/TitleInformationComponent.razor b/Daybreak.Core/Views/Components/FocusView/TitleInformationComponent.razor index 16f6f94f..d839e4df 100644 --- a/Daybreak.Core/Views/Components/FocusView/TitleInformationComponent.razor +++ b/Daybreak.Core/Views/Components/FocusView/TitleInformationComponent.razor @@ -1,6 +1,23 @@ -@if (this.Context is not null) -{ -
+
+ @if (this.Context is null) + { + + } + else if (this.Context.Title is null) + { +
+
+ Title Track +
+
+
+
+ No active title +
+
+ } + else + {
Title Track @@ -18,8 +35,8 @@
-
-} + } + @code { [Parameter] @@ -69,7 +86,7 @@ private string GetTitleDescription() { - if (this.Context is null) + if (this.Context?.Title is null) { return string.Empty; } diff --git a/Daybreak.Core/Views/Components/FocusView/TitleInformationComponent.razor.css b/Daybreak.Core/Views/Components/FocusView/TitleInformationComponent.razor.css index 5d884a83..6f22cdc6 100644 --- a/Daybreak.Core/Views/Components/FocusView/TitleInformationComponent.razor.css +++ b/Daybreak.Core/Views/Components/FocusView/TitleInformationComponent.razor.css @@ -54,3 +54,15 @@ color: var(--neutral-foreground-rest); z-index: 1; } + +.title-idle { + width: 100%; + height: var(--font-size-x-large); + display: flex; + align-items: center; + justify-content: center; + background: var(--neutral-fill-rest); + border-radius: 0px 0px 8px 8px; + font-size: var(--font-size-medium); + color: var(--neutral-foreground-hint); +} diff --git a/Daybreak.Core/Views/Components/FocusView/VanquishComponent.razor b/Daybreak.Core/Views/Components/FocusView/VanquishComponent.razor index 4b2684de..9672b6a7 100644 --- a/Daybreak.Core/Views/Components/FocusView/VanquishComponent.razor +++ b/Daybreak.Core/Views/Components/FocusView/VanquishComponent.razor @@ -1,21 +1,34 @@ -@if (this.Context is not null && - this.Context.HardMode && - this.Context.Vanquishing) -{ -
+
+ @if (this.Context is null) + { + + } + else + {
Vanquishing
-
-
-
-
- @this.GetVanquishBarText() + @if (this.Context.HardMode && this.Context.Vanquishing) + { +
+
+
+
+ @this.GetVanquishBarText() +
-
-
-} + } + else + { +
+
+ Not vanquishing +
+
+ } + } +
@code { [Parameter] @@ -37,6 +50,11 @@ } var totalFoes = this.Context.FoesToKill + this.Context.FoesKilled; + if (totalFoes is 0) + { + return "width: 0%;"; + } + return $"width: {this.Context.FoesKilled * 100d / totalFoes}%;"; } diff --git a/Daybreak.Core/Views/Components/FocusView/VanquishComponent.razor.css b/Daybreak.Core/Views/Components/FocusView/VanquishComponent.razor.css index 8a84baca..8dd2d4e4 100644 --- a/Daybreak.Core/Views/Components/FocusView/VanquishComponent.razor.css +++ b/Daybreak.Core/Views/Components/FocusView/VanquishComponent.razor.css @@ -40,3 +40,12 @@ color: var(--neutral-foreground-rest); z-index: 1; } + +.vanquish-idle { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + font-size: var(--font-size-medium); + color: var(--neutral-foreground-hint); +} diff --git a/Daybreak.Core/Views/FocusView.razor b/Daybreak.Core/Views/FocusView.razor index a8115b38..f01854af 100644 --- a/Daybreak.Core/Views/FocusView.razor +++ b/Daybreak.Core/Views/FocusView.razor @@ -1,50 +1,82 @@ -@using Daybreak.Views.Components.FocusView +@using Daybreak.Shared.Models.FocusView +@using Daybreak.Views.Components.FocusView +@using Microsoft.JSInterop @page "/focus" @inherits ViewBase -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
+
+
+ @if (this.ViewModel.IsEditingLayout) + { + + +
+ + @if (this.isAddDropdownOpen && this.ViewModel.HiddenComponents.Any()) + { +
+ @foreach (var component in this.ViewModel.HiddenComponents) + { +
+ + @TileName(component) +
+ } +
+ } +
+ } + else + { + + }
-
-
- -
-
-