Convert to Blazor (#6)
Convert existing progress to Blazor on client and server
This commit was merged in pull request #6.
This commit is contained in:
36
src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor
Normal file
36
src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor
Normal file
@@ -0,0 +1,36 @@
|
||||
@page "/citizen/authorized"
|
||||
@inject HttpClient http
|
||||
@inject NavigationManager nav
|
||||
@inject AppState state
|
||||
|
||||
<p>@message</p>
|
||||
|
||||
@code {
|
||||
string message = "Logging you on with No Agenda Social...";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// Exchange authorization code for a JWT
|
||||
var query = QueryHelpers.ParseQuery(nav.ToAbsoluteUri(nav.Uri).Query);
|
||||
if (query.TryGetValue("code", out var authCode))
|
||||
{
|
||||
var logOnResult = await ServerApi.LogOn(http, authCode);
|
||||
|
||||
if (logOnResult.IsOk)
|
||||
{
|
||||
var logOn = logOnResult.Ok;
|
||||
state.User = new UserInfo(logOn.CitizenId, logOn.Name);
|
||||
state.Jwt = logOn.Jwt;
|
||||
nav.NavigateTo("/citizen/dashboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
message = logOnResult.Error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "Did not receive a token from No Agenda Social (perhaps you clicked \"Cancel\"?)";
|
||||
}
|
||||
}
|
||||
}
|
||||
47
src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
Normal file
47
src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
Normal file
@@ -0,0 +1,47 @@
|
||||
@page "/citizen/dashboard"
|
||||
@inject HttpClient http
|
||||
@inject AppState state
|
||||
|
||||
<h3>Welcome, @state.User!.Name!</h3>
|
||||
|
||||
@if (retrievingProfile)
|
||||
{
|
||||
<p>Retrieving your employment profile...</p>
|
||||
}
|
||||
else if (profile != null)
|
||||
{
|
||||
<p>Your employment profile was last updated @profile.LastUpdatedOn</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>You do not have an employment profile established; click “Profile”* in the menu to get started!</p>
|
||||
<p><em>* Once it's there...</em></p>
|
||||
}
|
||||
|
||||
@if (errorMessage != null)
|
||||
{
|
||||
<p>@errorMessage</p>
|
||||
}
|
||||
@code {
|
||||
|
||||
bool retrievingProfile = true;
|
||||
Profile? profile = null;
|
||||
string? errorMessage = null;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (state.User != null)
|
||||
{
|
||||
var profileResult = await ServerApi.RetrieveProfile(http, state);
|
||||
if (profileResult.IsOk)
|
||||
{
|
||||
profile = profileResult.Ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = profileResult.Error;
|
||||
}
|
||||
retrievingProfile = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
src/JobsJobsJobs/Client/Pages/Index.razor
Normal file
21
src/JobsJobsJobs/Client/Pages/Index.razor
Normal file
@@ -0,0 +1,21 @@
|
||||
@page "/"
|
||||
@inject IJSRuntime js
|
||||
|
||||
<p>
|
||||
Future home of No Agenda Jobs, where citizens of Gitmo Nation can assist one another in finding or enhancing their
|
||||
employment. This will enable them to continue providing value for value to Adam and John, as they continue their work
|
||||
deconstructing the misinformation that passes for news on a day-to-day basis.
|
||||
</p>
|
||||
<p>
|
||||
Do you not understand the terms in the paragraph above? No worries; just head over to
|
||||
<a href="https://noagendashow.net">
|
||||
The Best Podcast in the Universe
|
||||
</a> <em><a class="audio" @onclick="PlayTrue">(it’s true!)</a></em> and find out what you’re missing.
|
||||
</p>
|
||||
<audio id="itstrue">
|
||||
<source src="/audio/thats-true.mp3">
|
||||
</audio>
|
||||
|
||||
@code {
|
||||
async void PlayTrue() => await js.InvokeVoidAsync("Audio.play", "itstrue");
|
||||
}
|
||||
Reference in New Issue
Block a user