Clean up code formatting and enhance data immutability

Standardized spacing and removed extraneous white space across multiple files for better readability. Updated several data grids to use `readonly` for `_data` collections, improving immutability and code clarity.
This commit is contained in:
Jonathan
2025-05-02 20:52:15 -04:00
parent 3d10256b9f
commit 2246847145
9 changed files with 31 additions and 25 deletions
+1 -1
View File
@@ -48,7 +48,7 @@
<MudIcon Icon="fa-solid fa-clipboard-list" Class="mr-2"/>
Database
</MudButton>
<MudButton Href="/data-tables"
Variant="Variant.Text"
Color="Color.Default"
+5 -3
View File
@@ -6,7 +6,7 @@
<LayoutLargeContentComponent>
<WebsiteTitleComponent>Data Tables</WebsiteTitleComponent>
<MudTabs Elevation="2" >
<MudTabs Elevation="2">
<MudTabPanel Text="Attacks">
<WeaponTable/>
</MudTabPanel>
@@ -20,7 +20,7 @@
<MovementTable/>
</MudTabPanel>
</MudTabs>
<ContentDividerComponent></ContentDividerComponent>
@@ -30,7 +30,9 @@
What is this tool?
</InfoQuestionComponent>
<InfoAnswerComponent>
This tool is a data table of all information belonging to a type of data. Such as viewing all weapons, so one can easily sort and see what weapon attack has the highest range, and what faction and unit that attack belongs to.
This tool is a data table of all information belonging to a type of data. Such as viewing all weapons,
so one can easily sort and see what weapon attack has the highest range, and what faction and unit that
attack belongs to.
</InfoAnswerComponent>
</InfoBodyComponent>
@@ -1,19 +1,21 @@
<MudDataGrid T="EntityMovementModel" Items="@_data"
SortMode="SortMode.Multiple"
<MudDataGrid T="EntityMovementModel" Items="@_data"
SortMode="SortMode.Multiple"
Filterable="true"
Hideable="true">
<Columns>
<PropertyColumn Property="x => x.Parent.GetName()" Title="Entity"/>
<PropertyColumn Property="x => x.Movement"/>
<PropertyColumn Property="x => x.Speed" />
<PropertyColumn Property="x => x.Speed"/>
<PropertyColumn Property="x => x.Parent.GetFaction()" Title="Faction"/>
<PropertyColumn Property="x => x.Parent.GetImmortal()" Title="Immortal"/>
</Columns>
</MudDataGrid>
@code {
IEnumerable<EntityMovementModel> _data = DATA.Get()
readonly IEnumerable<EntityMovementModel> _data = DATA.Get()
.SelectMany(e => e.Value.EntityParts)
.OfType<EntityMovementModel>()
.ToList();
}
@@ -1,5 +1,5 @@
<MudDataGrid T="EntityProductionModel" Items="@data"
SortMode="SortMode.Multiple"
<MudDataGrid T="EntityProductionModel" Items="@data"
SortMode="SortMode.Multiple"
Filterable="true"
Hideable="true">
<Columns>
@@ -18,4 +18,5 @@
.SelectMany(e => e.Value.EntityParts)
.OfType<EntityProductionModel>()
.ToList();
}
+10 -8
View File
@@ -1,23 +1,25 @@
<MudDataGrid T="EntityVitalityModel" Items="@_data"
SortMode="SortMode.Multiple"
<MudDataGrid T="EntityVitalityModel" Items="@_data"
SortMode="SortMode.Multiple"
Filterable="true"
Hideable="true">
<Columns>
<PropertyColumn Property="x => x.Parent.GetName()" Title="Entity"/>
<PropertyColumn Property="x => x.Health"/>
<PropertyColumn Property="x => x.Armor" />
<PropertyColumn Property="x => x.Defense" />
<PropertyColumn Property="x => x.DefenseLayer" />
<PropertyColumn Property="x => x.IsStructure" />
<PropertyColumn Property="x => x.IsEtheric" />
<PropertyColumn Property="x => x.Armor"/>
<PropertyColumn Property="x => x.Defense"/>
<PropertyColumn Property="x => x.DefenseLayer"/>
<PropertyColumn Property="x => x.IsStructure"/>
<PropertyColumn Property="x => x.IsEtheric"/>
<PropertyColumn Property="x => x.Parent.GetFaction()" Title="Faction"/>
<PropertyColumn Property="x => x.Parent.GetImmortal()" Title="Immortal"/>
</Columns>
</MudDataGrid>
@code {
IEnumerable<EntityVitalityModel> _data = DATA.Get()
readonly IEnumerable<EntityVitalityModel> _data = DATA.Get()
.SelectMany(e => e.Value.EntityParts)
.OfType<EntityVitalityModel>()
.ToList();
}
+6 -4
View File
@@ -1,5 +1,5 @@
<MudDataGrid T="EntityWeaponModel" Items="@_data"
SortMode="SortMode.Multiple"
<MudDataGrid T="EntityWeaponModel" Items="@_data"
SortMode="SortMode.Multiple"
Filterable="true"
Hideable="true">
<Columns>
@@ -17,13 +17,15 @@
<PropertyColumn Property="x => x.Parent.GetImmortal()" Title="Immortal"/>
</Columns>
<PagerContent>
<MudDataGridPager T="EntityWeaponModel" />
<MudDataGridPager T="EntityWeaponModel"/>
</PagerContent>
</MudDataGrid>
@code {
IEnumerable<EntityWeaponModel> _data = DATA.Get()
readonly IEnumerable<EntityWeaponModel> _data = DATA.Get()
.SelectMany(e => e.Value.EntityParts)
.OfType<EntityWeaponModel>()
.ToList();
}
-1
View File
@@ -1,7 +1,6 @@
@layout PageLayout
@inherits BasePage
@page "/database"
@using Model
@implements IDisposable
@@ -5,7 +5,6 @@
@page "/database/{text}"
@inject IEntityDisplayService EntityDisplayService
@using Model
@implements IDisposable
-1
View File
@@ -80,7 +80,6 @@ builder.Services.AddScoped(sp => new HttpClient
builder.Services.AddMudServices();
await builder.Build().RunAsync();