Skip to content

Commit

Permalink
improvements from review
Browse files Browse the repository at this point in the history
  • Loading branch information
floribe2000 committed Oct 28, 2023
1 parent 6af636e commit 03aa64c
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@
@Localizer.GetAppLocalization(nameof(Translation.AccelerationChart_CustomDataTitle)).Localization
</MudButton>
<MudDivider Vertical FlexItem Light/>
<MudSelect Margin="Margin.Dense" AnchorOrigin="Origin.BottomCenter" Variant="Variant.Outlined" T="int" Value="@firstGear" Label="Initial Gear" ValueChanged="@(value => UpdateThrottle(0, value))">
<MudSelect Class="default-label-background" Margin="Margin.Dense" AnchorOrigin="Origin.BottomCenter" Variant="Variant.Outlined" T="int" Value="@firstGear" Label="Initial Gear" ValueChanged="@(value => UpdateThrottle(0, value))">
<MudSelectItem Value="AccelerationCalculator.FullReverse"> <MudText Color="Color.Default">-1</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.Zero"><MudText Color="Color.Default">0</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.OneQuarter"><MudText Color="Color.Default">1/4</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.Half"><MudText Color="Color.Default">2/4</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.ThreeQuarter"><MudText Color="Color.Default">3/4</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.FullAhead"><MudText Color="Color.Default">4/4</MudText></MudSelectItem>
</MudSelect>
<MudSelect Margin="Margin.Dense" AnchorOrigin="Origin.BottomCenter" Variant="Variant.Outlined" T="int" Value="@secondGear" Label="Middle Gear" ValueChanged="@(value => UpdateThrottle(1, value))">
<MudSelect Class="default-label-background" Margin="Margin.Dense" AnchorOrigin="Origin.BottomCenter" Variant="Variant.Outlined" T="int" Value="@secondGear" Label="Middle Gear" ValueChanged="@(value => UpdateThrottle(1, value))">
<MudSelectItem Value="AccelerationCalculator.FullReverse"> <MudText Color="Color.Default">-1</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.Zero"><MudText Color="Color.Default">0</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.OneQuarter"><MudText Color="Color.Default">1/4</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.Half"><MudText Color="Color.Default">2/4</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.ThreeQuarter"><MudText Color="Color.Default">3/4</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.FullAhead"><MudText Color="Color.Default">4/4</MudText></MudSelectItem>
</MudSelect>
<MudSelect Margin="Margin.Dense" AnchorOrigin="Origin.BottomCenter" Variant="Variant.Outlined" T="int" Value="@thirdGear" Label="Final Gear" ValueChanged="@(value => UpdateThrottle(2, value))">
<MudSelect Class="default-label-background" Margin="Margin.Dense" AnchorOrigin="Origin.BottomCenter" Variant="Variant.Outlined" T="int" Value="@thirdGear" Label="Final Gear" ValueChanged="@(value => UpdateThrottle(2, value))">
<MudSelectItem Value="AccelerationCalculator.FullReverse"> <MudText Color="Color.Default">-1</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.Zero"><MudText Color="Color.Default">0</MudText></MudSelectItem>
<MudSelectItem Value="AccelerationCalculator.OneQuarter"><MudText Color="Color.Default">1/4</MudText></MudSelectItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@implements IDisposable
@inject ILocalizer Localizer

<MudDialog ContentStyle="max-height: calc(90vh - 100px); overflow-y: scroll; padding: 12px;">
<MudDialog ContentStyle="max-height: calc(90vh - 100px); overflow-y: scroll; padding: 12px;" Style="background-color: #282828">
<DialogContent>
<ShipSelector SelectedShips="@selectedShips" MultiSelect AllowCopies EnableBuildImport EnableSavedBuildList DisableSelectedShipBuildEditing/>
</DialogContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
</MudTabPanel>
</MudTabs>
<MudScrollToTop TopOffset="100" Style="z-index:2001">
<MudFab Color="Color.Info" StartIcon="@Icons.Material.Filled.KeyboardDoubleArrowUp"/>
<MudFab Color="Color.Primary" StartIcon="@Icons.Material.Filled.KeyboardDoubleArrowUp"/>
</MudScrollToTop>
<BuildConfigurationDialogHelper @ref="buildConfigurationHelper" MaxWidth="MaxWidth.Large" FullWidth NoHeader />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<MudDialog Style="background-color: #282828">
<TitleContent>
<MudItem Class="d-flex align-center">
<MudIcon Icon="@Icons.Material.Filled.HelpOutline" Color="Color.Info" Size="Size.Large"/>
<MudText Typo="Typo.h6" Class="mx-auto">
@Localizer.GetAppLocalization(nameof(Translation.ShipAndShellSelectionDialogWeb_SelectShipsAndShells)).Localization
</MudText>
Expand All @@ -35,40 +34,38 @@
@Localizer.GetAppLocalization(Translation.ShipAndShellsSelectionDialog_NoShipSelected).Localization
</MudText>
}
<MudPaper>
@foreach (var dataWrapper in dataWrappers)
{
<MudItem Class="d-flex" Style="flex-direction: column">
<MudItem Class="d-flex mt-2" Style="justify-content: space-between">
<MudText Typo="Typo.caption" Class="my-auto">
@Localizer.GetGameLocalization($"{dataWrapper.ShipBuildContainer.Ship.Index}_FULL").Localization
</MudText>
<MudIconButton Icon="@Icons.Material.Filled.Clear" Color="Color.Primary" Size="Size.Small" OnClick="@(() => RemoveShip(dataWrapper))"/>
</MudItem>
@if (dataWrapper.ShipBuildContainer.Ship.MainBatteryModuleList.Any())
{
<MudButtonGroup OverrideStyles="false" VerticalAlign="true" Class="gap-1">
@foreach (string shell in dataWrapper.ShipBuildContainer.Ship.ShellCompatibilities.Keys)
{
<MudButton Disabled="@(disabledShells.ContainsKey(dataWrapper.ShipBuildContainer.Id) && disabledShells[dataWrapper.ShipBuildContainer.Id].Any(item => item.Value.Contains(shell)))" Color="@(GetColorFromBool(dataWrapper.SelectedShells.ContainsKey(shell)))" Variant="@(GetVariantFromBool(dataWrapper.SelectedShells.ContainsKey(shell)))" DisableElevation="true" OnClick="@(() => ToggleSelection(dataWrapper, shell))">
@Localizer.GetGameLocalization(shell).Localization
</MudButton>
}
</MudButtonGroup>
}
else
{
<MudText Color="Color.Dark">
@Localizer.GetAppLocalization(nameof(Translation.MessageBox_ShipNoGun)).Localization
</MudText>
}
<MudText Typo="Typo.caption" Class="my-1">
@($"{Localizer.GetAppLocalization(Translation.ChartsWeb_Build).Localization}: {(!string.IsNullOrWhiteSpace(dataWrapper.ShipBuildContainer.Build?.BuildName) ? dataWrapper.ShipBuildContainer.Build.BuildName : Build.DefaultBuildName)}")
@foreach (var dataWrapper in dataWrappers)
{
<MudItem Class="d-flex" Style="flex-direction: column">
<MudItem Class="d-flex mt-2" Style="justify-content: space-between">
<MudText Typo="Typo.caption" Class="my-auto">
@Localizer.GetGameLocalization($"{dataWrapper.ShipBuildContainer.Ship.Index}_FULL").Localization
</MudText>
<MudDivider Light="true"/>
<MudIconButton Icon="@Icons.Material.Filled.Clear" Color="Color.Secondary" Size="Size.Small" OnClick="@(() => RemoveShip(dataWrapper))"/>
</MudItem>
}
</MudPaper>
@if (dataWrapper.ShipBuildContainer.Ship.MainBatteryModuleList.Any())
{
<MudButtonGroup OverrideStyles="false" VerticalAlign="true" Class="gap-1">
@foreach (string shell in dataWrapper.ShipBuildContainer.Ship.ShellCompatibilities.Keys)
{
<MudButton Disabled="@(disabledShells.ContainsKey(dataWrapper.ShipBuildContainer.Id) && disabledShells[dataWrapper.ShipBuildContainer.Id].Any(item => item.Value.Contains(shell)))" Color="@(GetColorFromBool(dataWrapper.SelectedShells.ContainsKey(shell)))" Variant="@(GetVariantFromBool(dataWrapper.SelectedShells.ContainsKey(shell)))" DisableElevation="true" OnClick="@(() => ToggleSelection(dataWrapper, shell))">
@Localizer.GetGameLocalization(shell).Localization
</MudButton>
}
</MudButtonGroup>
}
else
{
<MudText Color="Color.Dark">
@Localizer.GetAppLocalization(nameof(Translation.MessageBox_ShipNoGun)).Localization
</MudText>
}
<MudText Typo="Typo.caption" Class="my-1">
@($"{Localizer.GetAppLocalization(Translation.ChartsWeb_Build).Localization}: {(!string.IsNullOrWhiteSpace(dataWrapper.ShipBuildContainer.Build?.BuildName) ? dataWrapper.ShipBuildContainer.Build.BuildName : Build.DefaultBuildName)}")
</MudText>
<MudDivider Light="true"/>
</MudItem>
}
</MudItem>
</MudGrid>
</MudContainer>
Expand Down Expand Up @@ -346,7 +343,7 @@

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

private void Cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@
</MudStack>
</MudItem>
<MudItem xs="2">
<MudList @bind-SelectedValue="selectedListValue" Dense Clickable Style="max-height: min(80vh, 850px); overflow-y: scroll;" Class="">
<MudList @bind-SelectedValue="selectedListValue" Dense Clickable Style="max-height: min(80vh, 850px); overflow-y: scroll;">
@for (var i = 0; i < Ships.Count; i++)
{
int index = i;
var shipData = Ships[index];
<MudListItem Value="index" OnClick="@(() => desktopTabs.ActivatePanel(index))">
<MudText >
<MudText Color="Color.Secondary">
@Localizer.GetGameLocalization(Ships[index].Ship.Index + "_FULL").Localization
</MudText>
<MudText Typo="Typo.body2" Class="ml-2">
<MudText Typo="Typo.body2" Class="ml-2" Color="Color.Secondary">
@(Localizer.GetAppLocalization(Translation.ChartsWeb_Build).Localization + ": " + (buildNameDictionary.TryGetValue(shipData.Id, out string? value) ? value : !string.IsNullOrEmpty(shipData.Build?.BuildName) ? shipData.Build.BuildName : Build.DefaultBuildName))
</MudText>
</MudListItem>
Expand Down Expand Up @@ -194,24 +194,20 @@
</MudStack>
</MudItem>
<MudItem xs="12" md="6">
<MudPaper>
<MudStack Row="true" Justify="Justify.Center" Style="margin-top: -14px">
<MudTextField @bind-Value="inputBuildString" Immediate DebounceInterval="150" Validation="@(new Func<string, Task<string?>>(ValidateBuildString))" Clearable="true" FullWidth="true" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Edit" Label="Alternative" Placeholder="@Localizer.SimpleAppLocalization(nameof(Translation.BuildStringInputDialog_EnterBuildStringOrLink))" Variant="Variant.Outlined"/>
<MudButton Disabled="@(string.IsNullOrWhiteSpace(buildString))" Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" Style="margin-top: 6px" OnClick="@ImportBuildFromString">
@Localizer.GetAppLocalization(Translation.BuildConfigurationDialog_Load).Localization
</MudButton>
<MudFileUpload T="IBrowserFile" FilesChanged="@FileSelected" Class="file-upload-full-height" Accept=".png">
<ButtonTemplate>
<MudButton HtmlTag="label" Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Image" Style="height: 100%;" for="@context">Import</MudButton>
</ButtonTemplate>
</MudFileUpload>
</MudStack>
</MudPaper>
<MudStack Row="true" Justify="Justify.Center" Style="margin-top: -14px">
<MudTextField @bind-Value="inputBuildString" Class="default-label-background" Immediate DebounceInterval="150" Validation="@(new Func<string, Task<string?>>(ValidateBuildString))" Clearable FullWidth Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Edit" Label="Alternative" Placeholder="@Localizer.SimpleAppLocalization(nameof(Translation.BuildStringInputDialog_EnterBuildStringOrLink))" Variant="Variant.Outlined"/>
<MudButton Disabled="@(string.IsNullOrWhiteSpace(buildString))" Variant="Variant.Outlined" Color="Color.Primary" Size="Size.Small" Style="margin-top: 6px" OnClick="@ImportBuildFromString">
@Localizer.GetAppLocalization(Translation.BuildConfigurationDialog_Load).Localization
</MudButton>
<MudFileUpload T="IBrowserFile" FilesChanged="@FileSelected" Class="file-upload-full-height" Accept=".png">
<ButtonTemplate>
<MudButton HtmlTag="label" Variant="Variant.Outlined" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Image" Style="height: 100%;" for="@context">Import</MudButton>
</ButtonTemplate>
</MudFileUpload>
</MudStack>
</MudItem>
<MudItem xs="12" md="6">
<MudPaper>
<MudTextField @bind-Value="ViewModel.BuildName" Immediate Validation="@(new Func<string, string?>(BuildValidation.ValidateBuildName))" DebounceInterval="150" Clearable="true" FullWidth="true" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Edit" Label="Build Name" Placeholder="Enter build name" Variant="Variant.Outlined" Class="mt-n2 mb-0"/>
</MudPaper>
<MudTextField @bind-Value="ViewModel.BuildName" Immediate Validation="@(new Func<string, string?>(BuildValidation.ValidateBuildName))" DebounceInterval="150" Clearable FullWidth Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Edit" Label="Build Name" Placeholder="Enter build name" Variant="Variant.Outlined" Class="mt-n2 mb-0 default-label-background"/>
</MudItem>
}
else
Expand Down
Loading

0 comments on commit 03aa64c

Please sign in to comment.