Made select file button more prominent. Browse to and expand root path on init.

dashboard
Pat Hartl 2023-02-13 23:00:52 -06:00
parent e84ce3c7b4
commit 0d1513a944
1 changed files with 18 additions and 5 deletions

View File

@ -6,11 +6,11 @@
<MudStack Row="true" Style="max-height: 100%"> <MudStack Row="true" Style="max-height: 100%">
<MudTreeView Items="Directories" Hover="true" @bind-SelectedValue="SelectedDirectory" T="ArchiveDirectory" Style="min-width: 18%"> <MudTreeView Items="Directories" Hover="true" @bind-SelectedValue="SelectedDirectory" T="ArchiveDirectory" Style="min-width: 18%">
<ItemTemplate> <ItemTemplate>
<MudTreeViewItem Value="@context" Items="@context.Children" Text="@context.Name" T="ArchiveDirectory" OnClick="() => ChangeDirectory(context)"></MudTreeViewItem> <MudTreeViewItem Expanded="@context.IsExpanded" Value="@context" Items="@context.Children" Text="@context.Name" T="ArchiveDirectory" OnClick="() => ChangeDirectory(context)"></MudTreeViewItem>
</ItemTemplate> </ItemTemplate>
</MudTreeView> </MudTreeView>
<MudTable Items="@CurrentPathEntries" Hover="true" Class="flex-grow-1" FixedHeader="true" Elevation="0" Height="calc(100vh - 64px)"> <MudTable Items="@CurrentPathEntries" Hover="true" Class="flex-grow-1 archive-browser" FixedHeader="true" Elevation="0" Height="calc(100vh - 64px)">
<HeaderContent> <HeaderContent>
<MudTh></MudTh> <MudTh></MudTh>
<MudTh>Name</MudTh> <MudTh>Name</MudTh>
@ -28,12 +28,23 @@
<MudTd>@context.LastWriteTime</MudTd> <MudTd>@context.LastWriteTime</MudTd>
@if (OnFileSelected.HasDelegate) @if (OnFileSelected.HasDelegate)
{ {
<MudTd><MudButton OnClick="() => OnFileSelected.InvokeAsync(context.FullName)">Select</MudButton></MudTd> <MudTd><MudButton Class="select-file-button" Color="Color.Primary" Variant="Variant.Filled" OnClick="() => OnFileSelected.InvokeAsync(context.FullName)">Select</MudButton></MudTd>
} }
</RowTemplate> </RowTemplate>
</MudTable> </MudTable>
</MudStack> </MudStack>
<style>
.select-file-button {
opacity: 0;
transition: .1s opacity;
}
.archive-browser tr:hover .select-file-button {
opacity: 1;
}
</style>
@code { @code {
[Parameter] public Guid ArchiveId { get; set; } [Parameter] public Guid ArchiveId { get; set; }
[Parameter] public Guid Archive { get; set; } [Parameter] public Guid Archive { get; set; }
@ -54,13 +65,15 @@
var root = new ArchiveDirectory() var root = new ArchiveDirectory()
{ {
Name = "/", Name = "/",
FullName = "" FullName = "",
IsExpanded = true
}; };
root.PopulateChildren(Entries); root.PopulateChildren(Entries);
Directories.Add(root); Directories.Add(root);
SelectedDirectory = root;
ChangeDirectory(root);
} }
private void ChangeDirectory(ArchiveDirectory selectedDirectory) private void ChangeDirectory(ArchiveDirectory selectedDirectory)