From bd9811971055750963b52170153fc3e4ecb946be Mon Sep 17 00:00:00 2001 From: Tony Bark Date: Tue, 17 Sep 2024 12:15:55 -0400 Subject: [PATCH] No more code in Home.razor - All functionality has been modularized to their new respective components (I love Blazor) - Minor versions are now in the triple digits, patches are in the double digits --- src-tauri/tauri.conf.json | 2 +- src/Components/GitVersion.razor | 19 ++++++++++ src/Components/StationBtn.razor | 18 +++++++++ src/Components/StationInput.razor | 20 ++++++++++ src/Gitinfo.txt | 2 +- src/Pages/Home.razor | 61 +++++++------------------------ src/Pages/StationBtn.razor | 18 --------- src/_Imports.razor | 1 + 8 files changed, 73 insertions(+), 68 deletions(-) create mode 100644 src/Components/GitVersion.razor create mode 100644 src/Components/StationBtn.razor create mode 100644 src/Components/StationInput.razor delete mode 100644 src/Pages/StationBtn.razor diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b9917cd..0802c3e 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "AMTK Status", - "version": "0.1.105" + "version": "0.105.10" }, "tauri": { "allowlist": { diff --git a/src/Components/GitVersion.razor b/src/Components/GitVersion.razor new file mode 100644 index 0000000..f1a3586 --- /dev/null +++ b/src/Components/GitVersion.razor @@ -0,0 +1,19 @@ +@PrintVersion + +@code +{ + // Bit of a workaround until I get native version from Tauri. + // Regardless, it's useful for printing the commit hash alone. + private string PrintVersion + { + get + { + var major = ThisAssembly.Git.SemVer.Major; + var minor = ThisAssembly.Git.SemVer.Minor; + var patch = ThisAssembly.Git.SemVer.Patch; + var commit = ThisAssembly.Git.Commit; + + return $"v{major}.{minor}.{patch}-{commit}"; + } + } +} \ No newline at end of file diff --git a/src/Components/StationBtn.razor b/src/Components/StationBtn.razor new file mode 100644 index 0000000..0e66808 --- /dev/null +++ b/src/Components/StationBtn.razor @@ -0,0 +1,18 @@ +@inject IJSRuntime JsRuntime +@inject NavigationManager NavigationManager + + + +@code +{ + [Parameter] public string? Name { get; set; } + + [Parameter] public string? Code { get; set; } + + private async Task RedirectToStat() + { + var address = await JsRuntime.InvokeAsync("__TAURI__.tauri.invoke", "station", new { name = Code }); + + NavigationManager.NavigateTo(address); + } +} \ No newline at end of file diff --git a/src/Components/StationInput.razor b/src/Components/StationInput.razor new file mode 100644 index 0000000..af22f59 --- /dev/null +++ b/src/Components/StationInput.razor @@ -0,0 +1,20 @@ +@inject IJSRuntime JsRuntime +@inject NavigationManager NavigationManager + +
+ + +
+ +@code +{ + private string? CodeInput { get; set; } + + + private async Task AddrRedirectAsync() + { + var address = await JsRuntime.InvokeAsync("__TAURI__.tauri.invoke", "station", new { name = CodeInput }); + + NavigationManager.NavigateTo(address); + } +} diff --git a/src/Gitinfo.txt b/src/Gitinfo.txt index ee66a6c..d0864bd 100644 --- a/src/Gitinfo.txt +++ b/src/Gitinfo.txt @@ -1 +1 @@ -0.1.105 \ No newline at end of file +0.105.10 \ No newline at end of file diff --git a/src/Pages/Home.razor b/src/Pages/Home.razor index 6a22071..980b997 100644 --- a/src/Pages/Home.razor +++ b/src/Pages/Home.razor @@ -1,34 +1,29 @@ @page "/" -@inject IJSRuntime JsRuntime -@inject NavigationManager NavigationManager
-
- - -
+
- +
- +
- +
- - - + + +
- - - + + +
@@ -36,40 +31,10 @@
-

@PrintVersion
Status Boards by Dixieland Software

+

+
Status Boards by Dixieland Software +

-@code -{ - private string? CodeInput { get; set; } - - private string? StationCode { get; set; } - - // Bit of a workaround until I get native version from Tauri. - // Regardless, it's useful for printing the commit hash alone. - private string PrintVersion - { - get - { - var major = ThisAssembly.Git.SemVer.Major; - var minor = ThisAssembly.Git.SemVer.Minor; - var patch = ThisAssembly.Git.SemVer.Patch; - var commit = ThisAssembly.Git.Commit; - - return $"v{major}.{minor}.{patch}-{commit}"; - } - } - - private async Task RedirectToStat(string code) - { - StationCode = await JsRuntime.InvokeAsync("__TAURI__.tauri.invoke", "station", new { name = code }); - - NavigationManager.NavigateTo(StationCode); - } - private async Task StationAsync() - { - await RedirectToStat(CodeInput!); - } -} diff --git a/src/Pages/StationBtn.razor b/src/Pages/StationBtn.razor deleted file mode 100644 index 4a38946..0000000 --- a/src/Pages/StationBtn.razor +++ /dev/null @@ -1,18 +0,0 @@ -@inject IJSRuntime JsRuntime -@inject NavigationManager NavigationManager - - - -@code -{ - [Parameter] public string? Station { get; set; } - - [Parameter] public string? Code { get; set; } - - private async Task RedirectToStat() - { - var code = await JsRuntime.InvokeAsync("__TAURI__.tauri.invoke", "station", new { name = Code }); - - NavigationManager.NavigateTo(code); - } -} \ No newline at end of file diff --git a/src/_Imports.razor b/src/_Imports.razor index 4119212..b19a116 100644 --- a/src/_Imports.razor +++ b/src/_Imports.razor @@ -7,3 +7,4 @@ @using Microsoft.AspNetCore.Components.WebAssembly.Http @using Microsoft.JSInterop @using AmtrakStatus +@using AmtrakStatus.Components \ No newline at end of file