Refactor DataTables and cleanup redundant code
Refactored `WeaponTable` grid to use a typed parameter and improve readability. Removed outdated or unnecessary sample comments, consolidated duplicate code, and reorganized theme-related components in `PageLayout`. Simplified initialization logic and improved formatting consistency.
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
@using Services.Website
|
||||
@implements IDisposable
|
||||
|
||||
<MudThemeProvider/>
|
||||
|
||||
<MudThemeProvider @ref="@_mudThemeProvider" @bind-IsDarkMode="@_isDarkMode"/>
|
||||
<MudPopoverProvider/>
|
||||
<MudDialogProvider/>
|
||||
<MudSnackbarProvider/>
|
||||
@@ -75,9 +76,6 @@
|
||||
</MudLayout>
|
||||
|
||||
|
||||
<MudThemeProvider @ref="@_mudThemeProvider" @bind-IsDarkMode="@_isDarkMode"/>
|
||||
<MudDialogProvider/>
|
||||
<MudSnackbarProvider/>
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@layout PageLayout
|
||||
|
||||
@using IGP.Pages.DataTables.Parts
|
||||
@inherits BasePage
|
||||
|
||||
@@ -7,7 +6,7 @@
|
||||
|
||||
<LayoutMediumContentComponent>
|
||||
<WebsiteTitleComponent>Data Tables</WebsiteTitleComponent>
|
||||
|
||||
|
||||
<WeaponTable/>
|
||||
|
||||
<ContentDividerComponent></ContentDividerComponent>
|
||||
@@ -28,7 +27,7 @@
|
||||
</LayoutMediumContentComponent>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@code {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<h3>UnitTable</h3>
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
<h3>WeaponTable</h3>
|
||||
|
||||
|
||||
<MudDataGrid Items="@_entityWeapons" SortMode="SortMode.Multiple" Filterable="true">
|
||||
<MudDataGrid T="EntityWeaponModel" Items="@_entityWeapons"
|
||||
SortMode="SortMode.Multiple"
|
||||
Filterable="true"
|
||||
Hideable="true">
|
||||
<Columns>
|
||||
<PropertyColumn Property="x => x.Range" Title="Range"/>
|
||||
<PropertyColumn Property="x => x.Damage" Title="Damage"/>
|
||||
@@ -10,60 +13,18 @@
|
||||
<PropertyColumn Property="x => x.DamagePerSecondLight()" Title="DPS (Light)"/>
|
||||
<PropertyColumn Property="x => x.DamagePerSecondMedium()" Title="DPS (Medium)"/>
|
||||
<PropertyColumn Property="x => x.DamagePerSecondHeavy()" Title="DPS (Heavy)"/>
|
||||
|
||||
|
||||
<PropertyColumn Property="x => x.Parent.GetName()" Title="Owner Name"/>
|
||||
|
||||
<PropertyColumn Property="x => x.Parent.GetFaction()" Title="Faction"/>
|
||||
<PropertyColumn Property="x => x.Parent.GetImmortal()" Title="Immortal"/>
|
||||
</Columns>
|
||||
</MudDataGrid>
|
||||
|
||||
@{
|
||||
/**
|
||||
|
||||
<MudDataGrid T="Element" MultiSelection="true" Items="@Elements" SortMode="SortMode.Multiple" Filterable="true" QuickFilter="@_quickFilter"
|
||||
Hideable="true" RowClick="@RowClicked" RowContextMenuClick="RowRightClicked" SelectedItemsChanged="@SelectedItemsChanged">
|
||||
<ToolBarContent>
|
||||
<MudText Typo="Typo.h6">Periodic Elements</MudText>
|
||||
<MudSpacer />
|
||||
<MudTextField @bind-Value="_searchString" Placeholder="Search" Adornment="Adornment.Start" Immediate="true"
|
||||
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
|
||||
</ToolBarContent>
|
||||
<Columns>
|
||||
<SelectColumn T="Element" />
|
||||
<PropertyColumn Property="x => x.Number" Title="Nr" Sortable="false" Filterable="false" />
|
||||
<PropertyColumn Property="x => x.Sign" />
|
||||
<PropertyColumn Property="x => x.Name" SortBy="@_sortBy" />
|
||||
<PropertyColumn Property="x => x.Position" />
|
||||
<PropertyColumn Property="x => x.Molar" Title="Molar mass" />
|
||||
<PropertyColumn Property="x => x.Group" Title="Category" />
|
||||
</Columns>
|
||||
<PagerContent>
|
||||
<MudDataGridPager T="Element" />
|
||||
<MudDataGridPager T="EntityWeaponModel" />
|
||||
</PagerContent>
|
||||
</MudDataGrid>
|
||||
|
||||
|
||||
<div class="d-flex flex-wrap mt-4">
|
||||
<MudSwitch @bind-Value="@_sortNameByLength" Color="Color.Primary">Sort Name Column By Length</MudSwitch>
|
||||
</div>
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
List<EntityWeaponModel> _entityWeapons;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
|
||||
_entityWeapons = DATA.Get()
|
||||
.SelectMany(e => e.Value.EntityParts)
|
||||
.OfType<EntityWeaponModel>()
|
||||
.ToList();
|
||||
}
|
||||
|
||||
IEnumerable<EntityWeaponModel> _entityWeapons = DATA.Get()
|
||||
.SelectMany(e => e.Value.EntityParts)
|
||||
.OfType<EntityWeaponModel>()
|
||||
.ToList();
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Blazor.Analytics;
|
||||
using Blazored.LocalStorage;
|
||||
using IGP;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
@@ -39,12 +38,6 @@ builder.Services.AddBlazoredLocalStorageAsSingleton(config =>
|
||||
config.JsonSerializerOptions.WriteIndented = false;
|
||||
});
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddGoogleAnalytics("G-S96LW7TVFY");
|
||||
#else
|
||||
builder.Services.AddGoogleAnalytics(builder.Configuration["GATag"]);
|
||||
#endif
|
||||
|
||||
builder.Services.AddScoped<INavigationService, NavigationService>();
|
||||
builder.Services.AddScoped<IKeyService, KeyService>();
|
||||
builder.Services.AddScoped<IImmortalSelectionService, ImmortalSelectionService>();
|
||||
@@ -79,12 +72,6 @@ builder.Services.AddScoped(sp => new HttpClient
|
||||
|
||||
builder.Services.AddMudServices();
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
#else
|
||||
//builder.Services.AddDbContext<DatabaseContext>(options => { options.UseSqlite("Data Source=./Database.db"); });
|
||||
#endif
|
||||
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user