From e71495533bbbdf0fcde17b9f5d43b59e26f8cc61 Mon Sep 17 00:00:00 2001 From: Marcel Baumgartner Date: Tue, 20 Jun 2023 02:55:50 +0200 Subject: [PATCH] Fixed ui bugs, improved plugins page, added new 404 component --- .../Components/Alerts/NotFoundAlert.razor | 31 ++++++++ .../Shared/Components/Forms/WButton.razor | 8 +- Moonlight/Shared/Views/Server/Index.razor | 14 +--- .../Shared/Views/Server/ServerAddons.razor | 39 +++++----- .../Views/Server/ServerNavigation.razor | 9 +-- .../Shared/Views/Server/ServerSettings.razor | 78 ++++++++++--------- .../wwwroot/assets/media/svg/notfound.svg | 1 + 7 files changed, 103 insertions(+), 77 deletions(-) create mode 100644 Moonlight/Shared/Components/Alerts/NotFoundAlert.razor create mode 100644 Moonlight/wwwroot/assets/media/svg/notfound.svg diff --git a/Moonlight/Shared/Components/Alerts/NotFoundAlert.razor b/Moonlight/Shared/Components/Alerts/NotFoundAlert.razor new file mode 100644 index 00000000..f97c7b45 --- /dev/null +++ b/Moonlight/Shared/Components/Alerts/NotFoundAlert.razor @@ -0,0 +1,31 @@ +
+
+
+ Not found +
+ + The requested resource was not found + +

+ We were not able to find the requested resource. This can have following reasons + +

+
  • + The resource was deleted +
  • +
  • + You have to permission to access this resource +
  • +
  • + You may have entered invalid data +
  • +
  • + A unknown bug occured +
  • +
  • + An api was down and not proper handled +
  • +
    +

    +
    +
    \ No newline at end of file diff --git a/Moonlight/Shared/Components/Forms/WButton.razor b/Moonlight/Shared/Components/Forms/WButton.razor index a949e900..fce58182 100644 --- a/Moonlight/Shared/Components/Forms/WButton.razor +++ b/Moonlight/Shared/Components/Forms/WButton.razor @@ -2,6 +2,7 @@ { } else @@ -20,14 +21,17 @@ else public string CssClasses { get; set; } = "btn-primary"; [Parameter] - public string Text { get; set; } = "Mache was"; + public string Text { get; set; } = ""; [Parameter] - public string WorkingText { get; set; } = "Verarbeite..."; + public string WorkingText { get; set; } = ""; [Parameter] public Func? OnClick { get; set; } + [Parameter] + public RenderFragment ChildContent { get; set; } + private async Task Do() { Working = true; diff --git a/Moonlight/Shared/Views/Server/Index.razor b/Moonlight/Shared/Views/Server/Index.razor index ddfad9c1..c22667a4 100644 --- a/Moonlight/Shared/Views/Server/Index.razor +++ b/Moonlight/Shared/Views/Server/Index.razor @@ -27,19 +27,7 @@ @if (CurrentServer == null) { -
    -
    - Not found image -
    -

    - Server not found -

    -

    - A server with that id cannot be found or you have no access for this server -

    -
    -
    -
    + } else { diff --git a/Moonlight/Shared/Views/Server/ServerAddons.razor b/Moonlight/Shared/Views/Server/ServerAddons.razor index 9b717527..ad0ba2b5 100644 --- a/Moonlight/Shared/Views/Server/ServerAddons.razor +++ b/Moonlight/Shared/Views/Server/ServerAddons.razor @@ -33,14 +33,14 @@
    - @foreach (var pluginsPart in Plugins.Chunk(3)) + @if (Plugins.Any()) {
    - @foreach (var plugin in pluginsPart) + @foreach (var plugin in Plugins) { -
    -
    -
    +
    +
    +
    @(plugin.Title)
    @@ -48,10 +48,14 @@

    @(plugin.Description)

    - +
    + + + + +
    @@ -59,6 +63,10 @@ }
    } + else + { + + }
    @@ -100,7 +108,7 @@ else if (string.IsNullOrEmpty(version) || version == "latest") version = "1.20.1"; // This should NOT be called at any time if all the images have the correct tags - + Plugins = await AddonPluginService.GetPluginsForVersion(version, PluginsSearch); } @@ -117,7 +125,7 @@ else SmartTranslateService.Translate("Please wait until the other plugin is installed")); return; } - + IsPluginInstalling = true; try @@ -131,13 +139,7 @@ else await ToastService.CreateProcessToast("pluginDownload", "Preparing"); - await AddonPluginService.InstallPlugin(fileAccess, version, project, delegate(string s) - { - Task.Run(async () => - { - await ToastService.UpdateProcessToast("pluginDownload", s); - }); - }); + await AddonPluginService.InstallPlugin(fileAccess, version, project, delegate(string s) { Task.Run(async () => { await ToastService.UpdateProcessToast("pluginDownload", s); }); }); await ToastService.Success( SmartTranslateService.Translate("Successfully installed " + project.Slug) @@ -154,5 +156,4 @@ else await ToastService.RemoveProcessToast("pluginDownload"); } } -} - +} \ No newline at end of file diff --git a/Moonlight/Shared/Views/Server/ServerNavigation.razor b/Moonlight/Shared/Views/Server/ServerNavigation.razor index 23d8018d..83df271f 100644 --- a/Moonlight/Shared/Views/Server/ServerNavigation.razor +++ b/Moonlight/Shared/Views/Server/ServerNavigation.razor @@ -42,10 +42,7 @@
    -
    -
    -
    -
    +
    @@ -107,8 +104,8 @@
    -
    -