mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-22 20:42:24 +00:00
69 lines
3.2 KiB
Plaintext
69 lines
3.2 KiB
Plaintext
@page "/"
|
|
@layout ListLayout
|
|
|
|
<MudMenu @ref="ContextMenu" Dense="true" RelativeWidth="DropdownWidth.Ignore" PositionAtCursor="true" ListClass="unselectable" PopoverClass="unselectable">
|
|
<MudMenuItem Icon="@Icons.Material.Outlined.Info" IconColor="Color.Inherit" OnClick="ShowTorrentContextMenu">View torrent details</MudMenuItem>
|
|
<MudDivider />
|
|
<TorrentActions RenderType="RenderType.MenuItems" Hashes="GetContextMenuTargetHashes()" PrimaryHash="@(ContextMenuItem?.Hash)" Torrents="MainData.Torrents" Preferences="Preferences" />
|
|
</MudMenu>
|
|
|
|
<div style="overflow-x: auto; white-space: nowrap; width: 100%;">
|
|
<MudToolBar Gutters="false" Dense="true">
|
|
<MudIconButton Icon="@Icons.Material.Outlined.AddLink" OnClick="AddTorrentLink" title="Add torrent link" />
|
|
<MudIconButton Icon="@Icons.Material.Outlined.AddCircle" OnClick="AddTorrentFile" title="Add torrent file" />
|
|
<MudDivider Vertical="true" />
|
|
<TorrentActions RenderType="RenderType.InitialIconsOnly" Hashes="GetSelectedTorrentsHashes()" Torrents="MainData.Torrents" Preferences="Preferences" />
|
|
<MudDivider Vertical="true" />
|
|
<MudIconButton Icon="@Icons.Material.Outlined.Info" Color="Color.Inherit" Disabled="@(!ToolbarButtonsEnabled)" OnClick="ShowTorrentToolbar" title="View torrent details" />
|
|
<MudIconButton Icon="@Icons.Material.Outlined.ViewColumn" Color="Color.Inherit" OnClick="ColumnOptions" title="Choose Columns" />
|
|
<MudSpacer />
|
|
<MudTextField Value="SearchText" TextChanged="SearchTextChanged" Immediate="true" DebounceInterval="1000" Placeholder="Filter torrent list" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"></MudTextField>
|
|
</MudToolBar>
|
|
</div>
|
|
|
|
<MudContainer MaxWidth="MaxWidth.ExtraExtraLarge" Class="ma-0 pa-0">
|
|
<DynamicTable
|
|
@ref="Table"
|
|
T="Torrent"
|
|
Class="torrent-list"
|
|
ColumnDefinitions="Columns"
|
|
Items="Torrents"
|
|
OnRowClick="RowClick"
|
|
MultiSelection="true"
|
|
SelectOnRowClick="true"
|
|
SelectedItemsChanged="SelectedItemsChanged"
|
|
SortColumnChanged="SortColumnChangedHandler"
|
|
SortDirectionChanged="SortDirectionChangedHandler"
|
|
OnTableDataContextMenu="TableDataContextMenu"
|
|
OnTableDataLongPress="TableDataLongPress"
|
|
/>
|
|
</MudContainer>
|
|
|
|
@code {
|
|
private static RenderFragment<RowContext<Torrent>> ProgressBarColumn
|
|
{
|
|
get
|
|
{
|
|
return context => __builder =>
|
|
{
|
|
var value = (float?)context.GetValue();
|
|
var color = value < 1 ? Color.Success : Color.Info;
|
|
<MudProgressLinear title="Progress" Color="@color" Value="@((value ?? 0) * 100)" Class="progress-expand" Size="Size.Large">
|
|
@DisplayHelpers.Percentage(value)
|
|
</MudProgressLinear>;
|
|
};
|
|
}
|
|
}
|
|
|
|
private static RenderFragment<RowContext<Torrent>> IconColumn
|
|
{
|
|
get
|
|
{
|
|
return context => __builder =>
|
|
{
|
|
var (icon, color) = DisplayHelpers.GetStateIcon((string?)context.GetValue());
|
|
<MudIcon Icon="@icon" Color="@color" />
|
|
};
|
|
}
|
|
}
|
|
} |