New launch browser component

- Now possible to click links that launch the browser from the backend
- Version scheme change to account for different methods with desktop applications
This commit is contained in:
Tony Bark 2024-09-19 00:18:24 -04:00
parent 858762d54e
commit 80210156bb
28 changed files with 253 additions and 40 deletions

View file

@ -0,0 +1,18 @@
@inject IJSRuntime JsRuntime
<a @onclick="OpenBrowserAsync">@Text</a>
@code {
[Parameter]
[Required]
public string? Text { get; set; }
[Parameter]
[Required]
public string? Address { get; set; }
private async Task OpenBrowserAsync()
{
await JsRuntime.InvokeAsync<string>("__TAURI__.tauri.invoke", "open_browser", new { address = Address });
}
}

View file

@ -1,17 +1,21 @@
@inject IJSRuntime JsRuntime
@inject NavigationManager NavigationManager
<button @onclick="RedirectToStat">@Name</button>
<button @onclick="AddrRedirect">@Name</button>
@code
{
[Parameter] public string? Name { get; set; }
[Parameter]
[Required]
public string? Name { get; set; }
[Parameter] public string? Code { get; set; }
[Parameter]
[Required]
public string? Code { get; set; }
private async Task RedirectToStat()
private void AddrRedirect()
{
var address = await JsRuntime.InvokeAsync<string>("__TAURI__.tauri.invoke", "station", new { name = Code });
var address = $"https://dixielandsoftware.net/cgi-bin/solari_relay.pl?data={Code}";
NavigationManager.NavigateTo(address);
}

View file

@ -1,19 +1,19 @@
@inject IJSRuntime JsRuntime
@inject NavigationManager NavigationManager
<form class="row" @onsubmit="AddrRedirectAsync" @onsubmit:preventDefault="true">
<input id="greet-input" placeholder="3-character Station Code" @bind="CodeInput" />
<form class="row" @onsubmit="AddrRedirect" @onsubmit:preventDefault="true">
<input id="greet-input" placeholder="3-character Station Code" @bind="Code" />
<button type="submit">Submit</button>
</form>
@code
{
private string? CodeInput { get; set; }
private string? Code { get; set; }
private async Task AddrRedirectAsync()
private void AddrRedirect()
{
var address = await JsRuntime.InvokeAsync<string>("__TAURI__.tauri.invoke", "station", new { name = CodeInput });
var address = $"https://dixielandsoftware.net/cgi-bin/solari_relay.pl?data={Code}";
NavigationManager.NavigateTo(address);
}
}
}

View file

@ -1 +1 @@
0.105.10
0.104.2

View file

@ -3,6 +3,9 @@
<div class="container">
<img src="img/amtkstat.svg" class="logo" alt="Amtrak Status" />
<StationInput />
<p>Search
<LaunchBrowser Text="Station Codes" Address="https://dixielandsoftware.net/Amtrak/solari/StationSearch.html" />
</p>
<div class="row">
<div class="container">
<StationBtn Code="NYP" Name="NY Penn Station" />
@ -32,9 +35,9 @@
<sub>
<i>
<p>
<GitVersion /><br>Status Boards by Dixieland Software
<GitVersion /><br>Status Boards by
<LaunchBrowser Text="Dixieland Software" Address="https://dixielandsoftware.net/" />
</p>
</i>
</sub>
</footer>

View file

@ -33,6 +33,40 @@ footer {
bottom: 0;
}
/* The sidebar menu */
.sidenav {
height: 100%;
/* Full-height: remove this if you want "auto" height */
width: 160px;
/* Set the width of the sidebar */
position: fixed;
/* Fixed Sidebar (stay in place on scroll) */
z-index: 1;
/* Stay on top */
top: 0;
/* Stay at the top */
left: 0;
background-color: #111;
/* Black */
overflow-x: hidden;
/* Disable horizontal scroll */
padding-top: 20px;
}
/* The navigation menu links */
.sidenav a {
padding: 6px 8px 6px 16px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
}
/* When you mouse over the navigation links, change their color */
.sidenav a:hover {
color: #f1f1f1;
}
.logo {
height: 6em;
padding: 1.5em;

View file

@ -1,15 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri + Blazor</title>
<base href="/" />
<link rel="stylesheet" href="css/app.css" />
</head>
<body>
<div id="app"></div>
<script src="_framework/blazor.webassembly.js"></script>
</body>
</html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri + Blazor</title>
<base href="/" />
<link rel="stylesheet" href="css/app.css" />
</head>
<body>
<div id="app"></div>
<script src="_framework/blazor.webassembly.js"></script>
</body>
</html>