Skip to content

Commit

Permalink
feat(IndexRazor): use MusExpansionPanel for car details
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuehnel committed Jan 1, 2024
1 parent d214c65 commit 6fbc9c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 33 deletions.
1 change: 0 additions & 1 deletion TeslaSolarCharger/Client/Pages/BaseConfiguration.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@using TeslaSolarCharger.Shared.Dtos.BaseConfiguration
@using TeslaSolarCharger.Shared
@using TeslaSolarCharger.Shared.Enums
@using Majorsoft.Blazor.Components.Collapse
@using TeslaSolarCharger.Shared.Dtos
@inject HttpClient HttpClient
@inject NavigationManager NavigationManager
Expand Down
41 changes: 10 additions & 31 deletions TeslaSolarCharger/Client/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@using TeslaSolarCharger.Shared.Dtos.IndexRazor.PvValues
@using TeslaSolarCharger.Shared.Enums
@using TeslaSolarCharger.Shared.Resources
@using Majorsoft.Blazor.Components.Collapse
@using TeslaSolarCharger.Shared.Dtos.Settings
@using TeslaSolarCharger.Shared.Dtos.Table
@using System.Diagnostics
Expand Down Expand Up @@ -363,35 +362,15 @@ else
</p>

}

<CollapsePanel CollapsedColor="@_collapsedColor"
ExpandedColor="@_expandedColor"
HoverColor="@_hoverColor"
Disabled="@_isCollapseDisabled"
Collapsed="@_collapsedCarDetails.Any(h => h == car.CarId)"
ContentHeight="@_height"
Animate="@_isAnimated"
ShowContentOverflow="@_showOverflow"
OnCollapseChanged="(state) => OnCollapseChanged(state, car.CarId)">
<CollapsedHeaderContent>
<div class="w-100">
<b>More car details:</b>
<span class="fa fa-lg fa-chevron-circle-down" aria-hidden="true"></span>
</div>
</CollapsedHeaderContent>
<ExpandedHeaderContent>
<div class="w-100">
<b>Collapse</b>
<span class="fa fa-lg fa-chevron-circle-up" aria-hidden="true"></span>
</div>
</ExpandedHeaderContent>
<Content>

<MudExpansionPanels>
<MudExpansionPanel Text="More car details:" IsExpandedChanged="(state) => OnCollapseChanged(state, car.CarId)">
@if (_newCarDetailStates.Any(c => c.Key == car.CarId))
{
<TableComponent Content="@_newCarDetailStates[car.CarId]"></TableComponent>
}
</Content>
</CollapsePanel>
</MudExpansionPanel>
</MudExpansionPanels>
</div>
}
<div class="shadow p-3 mb-5 bg-white rounded">
Expand Down Expand Up @@ -615,16 +594,16 @@ else
_serverTimeZoneDisplayName = dtoServerTimeZoneId?.Value;
}

private async Task OnCollapseChanged(bool changedToCollapse, int carId)
private async Task OnCollapseChanged(bool changedToExpanded, int carId)
{
if (changedToCollapse)
if (changedToExpanded)
{
_collapsedCarDetails.Add(carId);
_collapsedCarDetails.Remove(carId);
_newCarDetailStates.Remove(carId);
}
else
{
_collapsedCarDetails.Remove(carId);
_newCarDetailStates.Remove(carId);
_collapsedCarDetails.Add(carId);
}
await RefreshAllVisableCarDetails().ConfigureAwait(false);
}
Expand Down
1 change: 0 additions & 1 deletion TeslaSolarCharger/Client/TeslaSolarCharger.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Majorsoft.Blazor.Components.Collapse" Version="1.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="MudBlazor" Version="6.11.2" />
Expand Down

0 comments on commit 6fbc9c3

Please sign in to comment.