mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-23 04:52:22 +00:00
Reorganise files in root and update menu/nav
This commit is contained in:
28
Lantean.QBTMudBlade/Components/ApplicationActions.razor
Normal file
28
Lantean.QBTMudBlade/Components/ApplicationActions.razor
Normal file
@@ -0,0 +1,28 @@
|
||||
@if (IsMenu)
|
||||
{
|
||||
@foreach (var action in Actions)
|
||||
{
|
||||
if (action.SeparatorBefore)
|
||||
{
|
||||
<MudDivider />
|
||||
}
|
||||
<MudMenuItem Icon="@action.Icon" IconColor="@action.Color" Href="@action.Href">@action.Text</MudMenuItem>
|
||||
}
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Undo" OnClick="ResetWebUI">Reset Web UI</MudMenuItem>
|
||||
<MudDivider />
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Logout" OnClick="Logout">Logout</MudMenuItem>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.ExitToApp" OnClick="Exit">Exit qBittorrent</MudMenuItem>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudNavLink Icon="@Icons.Material.Outlined.Navigation" OnClick="NavigateBack">Torrents</MudNavLink>
|
||||
<MudDivider />
|
||||
@foreach (var action in Actions)
|
||||
{
|
||||
if (action.SeparatorBefore)
|
||||
{
|
||||
<MudDivider />
|
||||
}
|
||||
<MudNavLink Icon="@action.Icon" IconColor="@action.Color" Href="@action.Href">@action.Text</MudNavLink>
|
||||
}
|
||||
}
|
78
Lantean.QBTMudBlade/Components/ApplicationActions.razor.cs
Normal file
78
Lantean.QBTMudBlade/Components/ApplicationActions.razor.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using System;
|
||||
using Lantean.QBTMudBlade.Pages;
|
||||
using static MudBlazor.CategoryTypes;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
public partial class ApplicationActions
|
||||
{
|
||||
private List<UIAction>? _actions;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
protected IDialogService DialogService { get; set; } = default!;
|
||||
|
||||
[Inject]
|
||||
protected IApiClient ApiClient { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public bool IsMenu { get; set; }
|
||||
|
||||
protected IEnumerable<UIAction> Actions => _actions ?? [];
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_actions =
|
||||
[
|
||||
new("Statistics", "Statistics", Icons.Material.Filled.PieChart, Color.Default, "/statistics"),
|
||||
new("Search", "Search", Icons.Material.Filled.Search, Color.Default, "/search"),
|
||||
new("RSS", "RSS", Icons.Material.Filled.RssFeed, Color.Default, "/rss"),
|
||||
new("Execution Log", "Execution Log", Icons.Material.Filled.List, Color.Default, "/log"),
|
||||
new("Blocked IPs", "Blocked IPs", Icons.Material.Filled.DisabledByDefault, Color.Default, "/blocks"),
|
||||
new("Tag Management", "Tag Management", Icons.Material.Filled.Label, Color.Default, "/tags", separatorBefore: true),
|
||||
new("Category Management", "Category Management", Icons.Material.Filled.List, Color.Default, "/categories"),
|
||||
new("Settings", "Settings", Icons.Material.Filled.Settings, Color.Default, "/settings", separatorBefore: true),
|
||||
];
|
||||
}
|
||||
|
||||
protected void NavigateBack()
|
||||
{
|
||||
NavigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
protected async Task ResetWebUI()
|
||||
{
|
||||
var preferences = new UpdatePreferences
|
||||
{
|
||||
AlternativeWebuiEnabled = false,
|
||||
};
|
||||
|
||||
await ApiClient.SetApplicationPreferences(preferences);
|
||||
|
||||
NavigationManager.NavigateTo("/", true);
|
||||
}
|
||||
|
||||
protected async Task Logout()
|
||||
{
|
||||
await DialogService.ShowConfirmDialog("Logout?", "Are you sure you want to logout?", async () =>
|
||||
{
|
||||
await ApiClient.Logout();
|
||||
|
||||
NavigationManager.NavigateTo("/login", true);
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task Exit()
|
||||
{
|
||||
await DialogService.ShowConfirmDialog("Quit?", "Are you sure you want to exit qBittorrent?", ApiClient.Shutdown);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
|
@@ -8,10 +8,4 @@
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
@if (MultiAction)
|
||||
{
|
||||
<MudButton OnClick="Cancel">Close</MudButton>
|
||||
}
|
||||
</DialogActions>
|
||||
</MudDialog>
|
@@ -10,7 +10,7 @@ namespace Lantean.QBTMudBlade.Components.Dialogs
|
||||
public MudDialogInstance MudDialog { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public TorrentAction? ParentAction { get; set; }
|
||||
public UIAction? ParentAction { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public Dictionary<string, Torrent> Torrents { get; set; } = default!;
|
||||
@@ -18,8 +18,6 @@ namespace Lantean.QBTMudBlade.Components.Dialogs
|
||||
[Parameter]
|
||||
public QBitTorrentClient.Models.Preferences? Preferences { get; set; }
|
||||
|
||||
protected bool MultiAction => ParentAction?.MultiAction ?? false;
|
||||
|
||||
[Parameter]
|
||||
public IEnumerable<string> Hashes { get; set; } = [];
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Lantean.QBTMudBlade.Components.Dialogs;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
|
@@ -3,6 +3,7 @@ using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components.Dialogs;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Filter;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
|
@@ -1,16 +1,3 @@
|
||||
<MudMenu Icon="@Icons.Material.Filled.MoreVert" Color="Color.Inherit" Dense="true" AnchorOrigin="Origin.BottomRight" TransformOrigin="Origin.TopLeft">
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.PieChart" Href="/statistics">Statistics</MudMenuItem>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Search" Href="/search">Search</MudMenuItem>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.RssFeed" Href="/rss">RSS</MudMenuItem>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.List" Href="/log">Execution Log</MudMenuItem>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.DisabledByDefault" Href="/blocks">Blocked IPs</MudMenuItem>
|
||||
<MudDivider />
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Label" Href="/tags">Tag Management</MudMenuItem>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.List" Href="/categories">Category Management</MudMenuItem>
|
||||
<MudDivider />
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Settings" Href="/settings">Settings</MudMenuItem>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Undo" OnClick="ResetWebUI">Reset Web UI</MudMenuItem>
|
||||
<MudDivider />
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Logout" OnClick="Logout">Logout</MudMenuItem>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.ExitToApp" OnClick="Exit">Exit qBittorrent</MudMenuItem>
|
||||
<ApplicationActions IsMenu="true" />
|
||||
</MudMenu>
|
@@ -1,5 +1,6 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Components.Options
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
@@ -155,7 +155,7 @@ else if (RenderType == RenderType.MenuItems)
|
||||
}
|
||||
}
|
||||
|
||||
private RenderFragment ChildItem(TorrentAction action)
|
||||
private RenderFragment ChildItem(UIAction action)
|
||||
{
|
||||
return __builder =>
|
||||
{
|
||||
@@ -168,7 +168,7 @@ else if (RenderType == RenderType.MenuItems)
|
||||
};
|
||||
}
|
||||
|
||||
private RenderFragment Menu(IEnumerable<TorrentAction> actions)
|
||||
private RenderFragment Menu(IEnumerable<UIAction> actions)
|
||||
{
|
||||
return __builder =>
|
||||
{
|
||||
@@ -178,7 +178,7 @@ else if (RenderType == RenderType.MenuItems)
|
||||
};
|
||||
}
|
||||
|
||||
private RenderFragment MenuContents(IEnumerable<TorrentAction> actions)
|
||||
private RenderFragment MenuContents(IEnumerable<UIAction> actions)
|
||||
{
|
||||
return __builder =>
|
||||
{
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components.Dialogs;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Interop;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
@@ -13,7 +14,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
{
|
||||
private bool _disposedValue;
|
||||
|
||||
private List<TorrentAction>? _actions;
|
||||
private List<UIAction>? _actions;
|
||||
|
||||
[Inject]
|
||||
public IApiClient ApiClient { get; set; } = default!;
|
||||
@@ -59,7 +60,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
public MudDialogInstance? MudDialog { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public TorrentAction? ParentAction { get; set; }
|
||||
public UIAction? ParentAction { get; set; }
|
||||
|
||||
public MudMenu? ActionsMenu { get; set; }
|
||||
|
||||
@@ -89,14 +90,14 @@ namespace Lantean.QBTMudBlade.Components
|
||||
new("firstLastPiecePrio", "Download first and last pieces first", Icons.Material.Filled.Check, Color.Info, CreateCallback(DownloadFirstLast)),
|
||||
new("forceRecheck", "Force recheck", Icons.Material.Filled.Loop, Color.Info, CreateCallback(ForceRecheck), separatorBefore: true),
|
||||
new("forceReannounce", "Force reannounce", Icons.Material.Filled.BroadcastOnHome, Color.Info, CreateCallback(ForceReannounce)),
|
||||
new("queue", "Queue", Icons.Material.Filled.Queue, Color.Transparent, new List<TorrentAction>
|
||||
new("queue", "Queue", Icons.Material.Filled.Queue, Color.Transparent, new List<UIAction>
|
||||
{
|
||||
new("queueTop", "Move to top", Icons.Material.Filled.VerticalAlignTop, Color.Inherit, CreateCallback(MoveToTop)),
|
||||
new("queueUp", "Move up", Icons.Material.Filled.ArrowUpward, Color.Inherit, CreateCallback(MoveUp)),
|
||||
new("queueDown", "Move down", Icons.Material.Filled.ArrowDownward, Color.Inherit, CreateCallback(MoveDown)),
|
||||
new("queueBottom", "Move to bottom", Icons.Material.Filled.VerticalAlignBottom, Color.Inherit, CreateCallback(MoveToBottom)),
|
||||
}, separatorBefore: true),
|
||||
new("copy", "Copy", Icons.Material.Filled.FolderCopy, Color.Info, new List<TorrentAction>
|
||||
new("copy", "Copy", Icons.Material.Filled.FolderCopy, Color.Info, new List<UIAction>
|
||||
{
|
||||
new("copyName", "Name", Icons.Material.Filled.TextFields, Color.Info, CreateCallback(() => Copy(t => t.Name))),
|
||||
new("copyHashv1", "Info hash v1", Icons.Material.Filled.Tag, Color.Info, CreateCallback(() => Copy(t => t.InfoHashV1))),
|
||||
@@ -335,7 +336,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
await ApiClient.SetFirstLastPiecePriority(null, Hashes.ToArray());
|
||||
}
|
||||
|
||||
protected async Task SubMenuTouch(TorrentAction action)
|
||||
protected async Task SubMenuTouch(UIAction action)
|
||||
{
|
||||
await DialogService.ShowSubMenu(Hashes, action, Torrents, Preferences);
|
||||
}
|
||||
@@ -351,9 +352,9 @@ namespace Lantean.QBTMudBlade.Components
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<TorrentAction> Actions => GetActions();
|
||||
private IEnumerable<UIAction> Actions => GetActions();
|
||||
|
||||
private IEnumerable<TorrentAction> GetActions()
|
||||
private IEnumerable<UIAction> GetActions()
|
||||
{
|
||||
var allAreSequentialDownload = true;
|
||||
var thereAreSequentialDownload = false;
|
||||
@@ -523,7 +524,7 @@ namespace Lantean.QBTMudBlade.Components
|
||||
return Filter(actionStates);
|
||||
}
|
||||
|
||||
private IEnumerable<TorrentAction> Filter(Dictionary<string, ActionState> actionStates)
|
||||
private IEnumerable<UIAction> Filter(Dictionary<string, ActionState> actionStates)
|
||||
{
|
||||
if (_actions is null)
|
||||
{
|
||||
@@ -641,54 +642,4 @@ namespace Lantean.QBTMudBlade.Components
|
||||
|
||||
MenuItems,
|
||||
}
|
||||
|
||||
public record TorrentAction
|
||||
{
|
||||
private readonly Color _color;
|
||||
|
||||
public TorrentAction(string name, string text, string? icon, Color color, EventCallback callback, bool separatorBefore = false)
|
||||
{
|
||||
Name = name;
|
||||
Text = text;
|
||||
Icon = icon;
|
||||
_color = color;
|
||||
Callback = callback;
|
||||
SeparatorBefore = separatorBefore;
|
||||
Children = [];
|
||||
}
|
||||
|
||||
public TorrentAction(string name, string text, string? icon, Color color, IEnumerable<TorrentAction> children, bool multiAction = false, bool useTextButton = false, bool separatorBefore = false)
|
||||
{
|
||||
Name = name;
|
||||
Text = text;
|
||||
Icon = icon;
|
||||
_color = color;
|
||||
Callback = default;
|
||||
Children = children;
|
||||
UseTextButton = useTextButton;
|
||||
SeparatorBefore = separatorBefore;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Text { get; }
|
||||
|
||||
public string? Icon { get; }
|
||||
|
||||
|
||||
|
||||
public Color Color => IsChecked is null || IsChecked.Value ? _color : Color.Transparent;
|
||||
|
||||
public EventCallback Callback { get; }
|
||||
|
||||
public bool SeparatorBefore { get; set; }
|
||||
|
||||
public IEnumerable<TorrentAction> Children { get; }
|
||||
|
||||
public bool UseTextButton { get; }
|
||||
|
||||
public bool MultiAction { get; }
|
||||
|
||||
public bool? IsChecked { get; internal set; }
|
||||
}
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Interop;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using MudBlazor;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
namespace Lantean.QBTMudBlade.Filter
|
||||
{
|
||||
internal static class ExpressionModifier
|
||||
{
|
@@ -1,11 +1,10 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components;
|
||||
using Lantean.QBTMudBlade.Components.Dialogs;
|
||||
using Lantean.QBTMudBlade.Filter;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
namespace Lantean.QBTMudBlade.Helpers
|
||||
{
|
||||
public static class DialogHelper
|
||||
{
|
||||
@@ -238,7 +237,7 @@ namespace Lantean.QBTMudBlade
|
||||
|
||||
public static async Task ShowConfirmDialog(this IDialogService dialogService, string title, string content, Action onSuccess)
|
||||
{
|
||||
await ShowConfirmDialog(dialogService, title, content, () =>
|
||||
await dialogService.ShowConfirmDialog(title, content, () =>
|
||||
{
|
||||
onSuccess();
|
||||
|
||||
@@ -389,7 +388,7 @@ namespace Lantean.QBTMudBlade
|
||||
await Task.Delay(0);
|
||||
}
|
||||
|
||||
public static async Task ShowSubMenu(this IDialogService dialogService, IEnumerable<string> hashes, TorrentAction parent, Dictionary<string, Torrent> torrents, QBitTorrentClient.Models.Preferences? preferences)
|
||||
public static async Task ShowSubMenu(this IDialogService dialogService, IEnumerable<string> hashes, UIAction parent, Dictionary<string, Torrent> torrents, QBitTorrentClient.Models.Preferences? preferences)
|
||||
{
|
||||
var parameters = new DialogParameters
|
||||
{
|
@@ -4,7 +4,7 @@ using MudBlazor;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
namespace Lantean.QBTMudBlade.Helpers
|
||||
{
|
||||
public static class DisplayHelpers
|
||||
{
|
@@ -1,6 +1,6 @@
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
namespace Lantean.QBTMudBlade.Helpers
|
||||
{
|
||||
public static class FilterHelper
|
||||
{
|
||||
@@ -192,7 +192,7 @@ namespace Lantean.QBTMudBlade
|
||||
break;
|
||||
|
||||
case Status.Completed:
|
||||
if ((state != "uploading") && (!state.Contains("UP")))
|
||||
if (state != "uploading" && !state.Contains("UP"))
|
||||
{
|
||||
return false;
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
@@ -81,7 +81,7 @@ namespace Lantean.QBTMudBlade.Layout
|
||||
var isDarkMode = await LocalStorage.GetItemAsync<bool?>(_isDarkModeStorageKey);
|
||||
if (isDarkMode is null)
|
||||
{
|
||||
IsDarkMode = await MudThemeProvider.GetSystemPreference();
|
||||
IsDarkMode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -3,18 +3,7 @@
|
||||
|
||||
<MudDrawer Open="DrawerOpen" ClipMode="DrawerClipMode.Always" Elevation="2" Overlay="false">
|
||||
<MudNavMenu>
|
||||
<MudNavLink Icon="@(Icons.Material.Outlined.Navigation)" OnClick="NavigateBack">Torrents</MudNavLink>
|
||||
<MudDivider />
|
||||
<MudNavLink Icon="@Icons.Material.Filled.PieChart" Href="/statistics">Statistics</MudNavLink>
|
||||
<MudNavLink Icon="@Icons.Material.Filled.Search" Href="/search">Search</MudNavLink>
|
||||
<MudNavLink Icon="@Icons.Material.Filled.RssFeed" Href="/rss">RSS</MudNavLink>
|
||||
<MudNavLink Icon="@Icons.Material.Filled.List" Href="/log">Execution Log</MudNavLink>
|
||||
<MudNavLink Icon="@Icons.Material.Filled.DisabledByDefault" Href="/blocks">Blocked IPs</MudNavLink>
|
||||
<MudDivider />
|
||||
<MudNavLink Icon="@Icons.Material.Filled.Label" Href="/tags">Tag Management</MudNavLink>
|
||||
<MudNavLink Icon="@Icons.Material.Filled.List" Href="/categories">Category Management</MudNavLink>
|
||||
<MudDivider />
|
||||
<MudNavLink Icon="@Icons.Material.Filled.Settings" Href="/settings">Settings</MudNavLink>
|
||||
<ApplicationActions IsMenu="false" />
|
||||
</MudNavMenu>
|
||||
</MudDrawer>
|
||||
<MudMainContent>
|
||||
|
@@ -4,15 +4,7 @@ namespace Lantean.QBTMudBlade.Layout
|
||||
{
|
||||
public partial class OtherLayout
|
||||
{
|
||||
[Inject]
|
||||
protected NavigationManager NavigationManager { get; set; } = default!;
|
||||
|
||||
[CascadingParameter(Name = "DrawerOpen")]
|
||||
public bool DrawerOpen { get; set; }
|
||||
|
||||
protected void NavigateBack()
|
||||
{
|
||||
NavigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,4 @@
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
namespace Lantean.QBTMudBlade.Models
|
||||
{
|
||||
public struct FilterState
|
||||
{
|
@@ -78,8 +78,7 @@ namespace Lantean.QBTMudBlade.Models
|
||||
{
|
||||
var modifiers = (CtrlKey ? "Ctrl" : "") + (ShiftKey ? "Shift" : "") + (AltKey ? "Alt" : "") + (MetaKey ? "Meta" : "");
|
||||
|
||||
return modifiers + (modifiers.Length == 0 ? "" : "+") + Key + (Repeat ? "-repeated" : "");
|
||||
//return Key + (CtrlKey ? '1' : '0') + (ShiftKey ? '1' : '0') + (AltKey ? '1' : '0') + (MetaKey ? '1' : '0') + (Repeat ? '1' : '0');
|
||||
return modifiers + (modifiers.Length == 0 ? "" : "+") + (Key == "+" ? "'+'" : "+") + (Repeat ? "-repeated" : "");
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
|
64
Lantean.QBTMudBlade/Models/UIAction.cs
Normal file
64
Lantean.QBTMudBlade/Models/UIAction.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Models
|
||||
{
|
||||
public record UIAction
|
||||
{
|
||||
private readonly Color _color;
|
||||
|
||||
public UIAction(string name, string text, string? icon, Color color, string href, bool separatorBefore = false)
|
||||
{
|
||||
Name = name;
|
||||
Text = text;
|
||||
Icon = icon;
|
||||
_color = color;
|
||||
Href = href;
|
||||
SeparatorBefore = separatorBefore;
|
||||
Children = [];
|
||||
}
|
||||
|
||||
public UIAction(string name, string text, string? icon, Color color, EventCallback callback, bool separatorBefore = false)
|
||||
{
|
||||
Name = name;
|
||||
Text = text;
|
||||
Icon = icon;
|
||||
_color = color;
|
||||
Callback = callback;
|
||||
SeparatorBefore = separatorBefore;
|
||||
Children = [];
|
||||
}
|
||||
|
||||
public UIAction(string name, string text, string? icon, Color color, IEnumerable<UIAction> children, bool useTextButton = false, bool separatorBefore = false)
|
||||
{
|
||||
Name = name;
|
||||
Text = text;
|
||||
Icon = icon;
|
||||
_color = color;
|
||||
Callback = default;
|
||||
Children = children;
|
||||
UseTextButton = useTextButton;
|
||||
SeparatorBefore = separatorBefore;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Text { get; }
|
||||
|
||||
public string? Icon { get; }
|
||||
|
||||
public Color Color => IsChecked is null || IsChecked.Value ? _color : Color.Transparent;
|
||||
|
||||
public EventCallback Callback { get; }
|
||||
|
||||
public string? Href { get; }
|
||||
|
||||
public bool SeparatorBefore { get; set; }
|
||||
|
||||
public IEnumerable<UIAction> Children { get; }
|
||||
|
||||
public bool UseTextButton { get; }
|
||||
|
||||
public bool? IsChecked { get; internal set; }
|
||||
}
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
@@ -48,7 +48,7 @@ namespace Lantean.QBTMudBlade.Pages
|
||||
#if DEBUG
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
return DoLogin("admin", "YZQC4Jhcw");
|
||||
return DoLogin("admin", "V9VpmhCvv");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBitTorrentClient.Models;
|
||||
using Lantean.QBTMudBlade.Components.Options;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using Lantean.QBitTorrentClient;
|
||||
using Lantean.QBTMudBlade.Components.UI;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Lantean.QBTMudBlade.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Http;
|
||||
|
||||
namespace Lantean.QBTMudBlade
|
||||
namespace Lantean.QBTMudBlade.Services
|
||||
{
|
||||
public class CookieHandler : DelegatingHandler
|
||||
{
|
@@ -1,4 +1,5 @@
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
using Lantean.QBTMudBlade.Helpers;
|
||||
using Lantean.QBTMudBlade.Models;
|
||||
|
||||
namespace Lantean.QBTMudBlade.Services
|
||||
{
|
||||
|
@@ -8,9 +8,10 @@
|
||||
@using Microsoft.JSInterop
|
||||
@using MudBlazor
|
||||
@using Lantean.QBTMudBlade
|
||||
@using Lantean.QBTMudBlade.Layout
|
||||
@using Lantean.QBTMudBlade.Models
|
||||
@using Lantean.QBTMudBlade.Components
|
||||
@using Lantean.QBTMudBlade.Components.Dialogs
|
||||
@using Lantean.QBTMudBlade.Components.Options
|
||||
@using Lantean.QBTMudBlade.Components.UI
|
||||
@using Lantean.QBTMudBlade.Components.UI
|
||||
@using Lantean.QBTMudBlade.Helpers
|
||||
@using Lantean.QBTMudBlade.Layout
|
||||
@using Lantean.QBTMudBlade.Models
|
Reference in New Issue
Block a user