From 415507299014523be83b6c4ce4d75b84202476ff Mon Sep 17 00:00:00 2001
From: "Daniel J. Summers"
Date: Tue, 19 Jan 2021 22:42:15 -0500
Subject: [PATCH] "Back" now works for search results (#3)
- Made the application only retrieve the list of continents once per visit
- Update the verbiage for phase 3 completion
---
src/JobsJobsJobs/Client/AppState.cs | 30 +++++++++
.../Client/Pages/Citizen/Dashboard.razor | 21 ++++---
.../Client/Pages/Citizen/EditProfile.razor | 6 +-
.../Client/Pages/Citizen/EditProfile.razor.cs | 11 +---
.../Client/Pages/Profile/Search.razor | 49 +--------------
.../Client/Pages/Profile/Search.razor.cs | 61 +++++++++++++------
.../Client/Shared/ProfileSearchForm.razor | 60 ++++++++++++++++++
7 files changed, 149 insertions(+), 89 deletions(-)
create mode 100644 src/JobsJobsJobs/Client/Shared/ProfileSearchForm.razor
diff --git a/src/JobsJobsJobs/Client/AppState.cs b/src/JobsJobsJobs/Client/AppState.cs
index 62abfa9..90e9825 100644
--- a/src/JobsJobsJobs/Client/AppState.cs
+++ b/src/JobsJobsJobs/Client/AppState.cs
@@ -1,5 +1,8 @@
using JobsJobsJobs.Shared;
using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Threading.Tasks;
namespace JobsJobsJobs.Client
{
@@ -45,6 +48,33 @@ namespace JobsJobsJobs.Client
}
}
+ private IEnumerable? _continents = null;
+
+ ///
+ /// Get a list of continents (only retrieves once per application load)
+ ///
+ /// The HTTP client to use to obtain continents the first time
+ /// The list of continents
+ /// If the continents cannot be loaded
+ public async Task> GetContinents(HttpClient http)
+ {
+ if (_continents == null)
+ {
+ ServerApi.SetJwt(http, this);
+ var continentResult = await ServerApi.RetrieveMany(http, "continent/all");
+
+ if (continentResult.IsOk)
+ {
+ _continents = continentResult.Ok;
+ }
+ else
+ {
+ throw new ApplicationException($"Could not load continents - {continentResult.Error}");
+ }
+ }
+ return _continents;
+ }
+
public AppState() { }
private void NotifyChanged() => OnChange.Invoke();
diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
index 0e5e79d..30f6e93 100644
--- a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
+++ b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor
@@ -28,29 +28,30 @@ else
started!
}
- @{
- /**
- This is phase 3 stuff...
There @(ProfileCount == 1 ? "is" : "are") @(ProfileCount == 0 ? "no" : ProfileCount) employment
profile@(ProfileCount != 1 ? "s" : "") from citizens of Gitmo Nation.
@if (ProfileCount > 0)
{
- Take a look around and see if you can help them find work!(coming soon)
+ Take a look around and see if you can help them find work!
}
-
*/
- }
+
}
-
Phase 3 – What Works (In Progress ~~ Last Updated January 10th, 2021)
+
+ Phase 3 – What Works
+ (v0.8 – Last Updated January 19th, 2021)
+
- The “View Profiles” link at the side does not have any search capabilities, but it does provide a list of
- citizens who have filled out profiles, along with a way to view those profiles.
+ The “View Profiles” link at the side now allows you to search for profiles by continent, the
+ citizen’s desire for remote work, a skill, or any text in their professional biography and experience. If you
+ find someone with whom you’d like to discuss potential opportunities, the name at the top of the profile links
+ to their No Agenda Social account, where you can use its features to get in touch.
-
Phase 2 – What Works (Last Updated January 8th, 2021)
+
Phase 2 – What Works (v0.7 – Last Updated January 8th, 2021)
If you’ve gotten this far, you’ve already passed
Phase 1, which enabled users of
diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor
index cf938a1..d735359 100644
--- a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor
+++ b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor
@@ -28,9 +28,9 @@
@foreach (var (id, name) in Continents)
- {
-
- }
+ {
+
+ }
ProfileForm.ContinentId) />
diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs
index c26f519..583cb1d 100644
--- a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs
+++ b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs
@@ -46,19 +46,12 @@ namespace JobsJobsJobs.Client.Pages.Citizen
protected override async Task OnInitializedAsync()
{
ServerApi.SetJwt(http, state);
- var continentTask = ServerApi.RetrieveMany(http, "continent/all");
+ var continentTask = state.GetContinents(http);
var profileTask = ServerApi.RetrieveProfile(http, state);
await Task.WhenAll(continentTask, profileTask);
- if (continentTask.Result.IsOk)
- {
- Continents = continentTask.Result.Ok;
- }
- else
- {
- ErrorMessages.Add(continentTask.Result.Error);
- }
+ Continents = continentTask.Result;
if (profileTask.Result.IsOk)
{
diff --git a/src/JobsJobsJobs/Client/Pages/Profile/Search.razor b/src/JobsJobsJobs/Client/Pages/Profile/Search.razor
index 7de385c..2265f4e 100644
--- a/src/JobsJobsJobs/Client/Pages/Profile/Search.razor
+++ b/src/JobsJobsJobs/Client/Pages/Profile/Search.razor
@@ -1,5 +1,6 @@
@page "/profile/search"
@inject HttpClient http
+@inject NavigationManager nav
@inject AppState state
@@ -17,53 +18,7 @@
Enter one or more criteria to filter results, or just click “Search” to list all profiles.