Skip to content

Commit

Permalink
update ship comparison UI
Browse files Browse the repository at this point in the history
  • Loading branch information
floribe2000 committed Oct 19, 2023
1 parent 11b1de3 commit 4da05d5
Show file tree
Hide file tree
Showing 23 changed files with 348 additions and 929 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
@Localizer.SimpleAppLocalization(nameof(Translation.ShipSelectionWindow_TierFilter))
</MudText>
<MudButtonGroup OverrideStyles="false" Class="gap-2 mb-1" Style="flex-wrap: wrap" Size="Size.Small">
<MudButton Variant="Variant.Text" Color="Color.Info" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllTiers(true))">
<MudButton Variant="Variant.Text" Color="Color.Primary" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllTiers(true))">
@Localizer.SimpleAppLocalization(nameof(Translation.ShipComparison_All))
</MudButton>
<MudButton Variant="Variant.Text" Color="Color.Info" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllTiers(false))">
<MudButton Variant="Variant.Text" Color="Color.Primary" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllTiers(false))">
@Localizer.SimpleAppLocalization(nameof(Translation.ShipComparison_None))
</MudButton>
</MudButtonGroup>
Expand All @@ -26,7 +26,7 @@
{
int tier = i;
bool isSelected = ViewModel!.SelectedTiers.Contains(tier);
<MudButton @key="tier" DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="GetColorFromBool(isSelected)" @onmouseup="@(args => ToggleTierSelection(tier, args))" oncontextmenu="return false;">
<MudButton @key="tier" DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="Color.Primary" @onmouseup="@(args => ToggleTierSelection(tier, args))" oncontextmenu="return false;">
@tier.ToTierString()
</MudButton>
}
Expand All @@ -36,10 +36,10 @@
@Localizer.SimpleAppLocalization(nameof(Translation.ShipSelectionWindow_ClassFilter))
</MudText>
<MudButtonGroup OverrideStyles="false" Class="gap-2 mb-1" Style="flex-wrap: wrap" Size="Size.Small">
<MudButton Variant="Variant.Text" Color="Color.Info" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllClasses(true))">
<MudButton Variant="Variant.Text" Color="Color.Primary" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllClasses(true))">
@Localizer.SimpleAppLocalization(nameof(Translation.ShipComparison_All))
</MudButton>
<MudButton Variant="Variant.Text" Color="Color.Info" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllClasses(false))">
<MudButton Variant="Variant.Text" Color="Color.Primary" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllClasses(false))">
@Localizer.SimpleAppLocalization(nameof(Translation.ShipComparison_None))
</MudButton>
</MudButtonGroup>
Expand All @@ -48,7 +48,7 @@
@foreach (var shipClass in ViewModel!.AvailableClasses)
{
bool isSelected = ViewModel.SelectedClasses.Contains(shipClass);
<MudButton @key="shipClass" DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="GetColorFromBool(isSelected)" @onmouseup="@(args => ToggleClassSelection(shipClass, args))" oncontextmenu="return false;">
<MudButton @key="shipClass" DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="Color.Primary" @onmouseup="@(args => ToggleClassSelection(shipClass, args))" oncontextmenu="return false;">
@Localizer.GetAppLocalization(shipClass.ShipClassToString()).Localization
</MudButton>
}
Expand All @@ -58,10 +58,10 @@
@Localizer.SimpleAppLocalization(nameof(Translation.ShipSelectionWindow_NationFilter))
</MudText>
<MudButtonGroup OverrideStyles="false" Class="gap-2 mb-1" Style="flex-wrap: wrap" Size="Size.Small">
<MudButton Variant="Variant.Text" Color="Color.Info" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllNations(true))">
<MudButton Variant="Variant.Text" Color="Color.Primary" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllNations(true))">
@Localizer.SimpleAppLocalization(nameof(Translation.ShipComparison_All))
</MudButton>
<MudButton Variant="Variant.Text" Color="Color.Info" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllNations(false))">
<MudButton Variant="Variant.Text" Color="Color.Primary" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllNations(false))">
@Localizer.SimpleAppLocalization(nameof(Translation.ShipComparison_None))
</MudButton>
</MudButtonGroup>
Expand All @@ -70,7 +70,7 @@
@foreach (var nation in ViewModel!.AvailableNations)
{
bool isSelected = ViewModel.SelectedNations.Contains(nation);
<MudButton @key="nation" DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="GetColorFromBool(isSelected)" @onmouseup="@(args => ToggleNationSelection(nation, args))" oncontextmenu="return false;">
<MudButton @key="nation" DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="Color.Primary" @onmouseup="@(args => ToggleNationSelection(nation, args))" oncontextmenu="return false;">
@Localizer.GetAppLocalization(nation.ShipNationToString()).Localization
</MudButton>
}
Expand All @@ -80,10 +80,10 @@
@Localizer.SimpleAppLocalization(nameof(Translation.ShipSelectionWindow_TypeFilter))
</MudText>
<MudButtonGroup OverrideStyles="false" Class="gap-2 mb-1" Style="flex-wrap: wrap" Size="Size.Small">
<MudButton Variant="Variant.Text" Color="Color.Info" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllCategories(true))">
<MudButton Variant="Variant.Text" Color="Color.Primary" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllCategories(true))">
@Localizer.SimpleAppLocalization(nameof(Translation.ShipComparison_All))
</MudButton>
<MudButton Variant="Variant.Text" Color="Color.Info" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllCategories(false))">
<MudButton Variant="Variant.Text" Color="Color.Primary" DisableElevation="true" Size="Size.Small" OnClick="@(() => ToggleAllCategories(false))">
@Localizer.SimpleAppLocalization(nameof(Translation.ShipComparison_None))
</MudButton>
</MudButtonGroup>
Expand All @@ -92,7 +92,7 @@
@foreach (var category in ViewModel!.AvailableShipCategories)
{
bool isSelected = ViewModel.SelectedCategories.Contains(category);
<MudButton @key="category" DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="GetColorFromBool(isSelected)" @onmouseup="@(args => ToggleCategorySelection(category, args))" oncontextmenu="return false;">
<MudButton @key="category" DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="Color.Primary" @onmouseup="@(args => ToggleCategorySelection(category, args))" oncontextmenu="return false;">
@Localizer.GetAppLocalization(category.ShipCategoryToString()).Localization
</MudButton>
}
Expand Down Expand Up @@ -120,7 +120,7 @@
{
int tier = i;
bool isSelected = ViewModel!.SelectedTiers.Contains(tier);
<MudButton DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="GetColorFromBool(isSelected)" @onmouseup="@(args => ToggleTierSelection(tier, args))" oncontextmenu="return false;">
<MudButton DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="Color.Primary" @onmouseup="@(args => ToggleTierSelection(tier, args))" oncontextmenu="return false;">
@tier.ToTierString()
</MudButton>
}
Expand All @@ -129,7 +129,7 @@
@foreach (var shipClass in ViewModel!.AvailableClasses)
{
bool isSelected = ViewModel.SelectedClasses.Contains(shipClass);
<MudButton DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="GetColorFromBool(isSelected)" @onmouseup="@(args => ToggleClassSelection(shipClass, args))" oncontextmenu="return false;">
<MudButton DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="Color.Primary" @onmouseup="@(args => ToggleClassSelection(shipClass, args))" oncontextmenu="return false;">
@Localizer.GetAppLocalization(shipClass.ShipClassToString()).Localization
</MudButton>
}
Expand All @@ -138,7 +138,7 @@
@foreach (var nation in ViewModel!.AvailableNations)
{
bool isSelected = ViewModel.SelectedNations.Contains(nation);
<MudButton DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="GetColorFromBool(isSelected)" @onmouseup="@(args => ToggleNationSelection(nation, args))" oncontextmenu="return false;">
<MudButton DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="Color.Primary" @onmouseup="@(args => ToggleNationSelection(nation, args))" oncontextmenu="return false;">
@Localizer.GetAppLocalization(nation.ShipNationToString()).Localization
</MudButton>
}
Expand All @@ -147,7 +147,7 @@
@foreach (var category in ViewModel!.AvailableShipCategories)
{
bool isSelected = ViewModel.SelectedCategories.Contains(category);
<MudButton DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="GetColorFromBool(isSelected)" @onmouseup="@(args => ToggleCategorySelection(category, args))" oncontextmenu="return false;">
<MudButton DisableElevation="true" Variant="GetVariantFromBool(isSelected)" Color="Color.Primary" @onmouseup="@(args => ToggleCategorySelection(category, args))" oncontextmenu="return false;">
@Localizer.GetAppLocalization(category.ShipCategoryToString()).Localization
</MudButton>
}
Expand Down Expand Up @@ -203,11 +203,6 @@
return active ? Variant.Filled : Variant.Outlined;
}

private static Color GetColorFromBool(bool active)
{
return active ? Color.Primary : Color.Secondary;
}

private async Task ToggleTierSelection(int tier, MouseEventArgs args)
{
if (args.Button == 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -50,9 +48,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -67,9 +63,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -84,9 +78,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -101,9 +93,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -118,9 +108,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -135,9 +123,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -152,9 +138,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -169,9 +153,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -186,9 +168,7 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
Expand All @@ -203,11 +183,9 @@
}
else
{
<MudText Typo="Typo.body2" Color="Color.Primary">
@ShipComparisonViewModel.DataNotAvailable
</MudText>
@UtilityFragments.DataNotAvailableFragment
}
</CellTemplate>
</TemplateColumn>
};
}
}
Loading

0 comments on commit 4da05d5

Please sign in to comment.