From 4f1c7b782a0f2ed83f711e2983bacb1a31675bc0 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 7 Jan 2021 22:49:10 -0500 Subject: [PATCH] Display profile now works wrapping up #2 --- .../Client/Pages/Citizen/Authorized.razor | 2 + .../Client/Pages/Citizen/Dashboard.razor | 6 ++- .../Client/Pages/Citizen/EditProfile.razor | 22 ++++---- .../Client/Pages/Citizen/EditProfile.razor.cs | 18 +++++-- src/JobsJobsJobs/Client/Pages/Index.razor | 8 +-- .../Client/Pages/Profile/View.razor | 41 ++++++++++++++- .../Client/Pages/Profile/View.razor.cs | 51 +++++++++++++++++-- .../Client/Shared/ErrorList.razor | 2 +- src/JobsJobsJobs/Client/Shared/NavMenu.razor | 2 +- .../Client/Shared/PageTitle.razor | 11 ++++ src/JobsJobsJobs/Client/wwwroot/index.html | 8 +++ .../Server/.config/dotnet-tools.json | 12 +++++ src/JobsJobsJobs/Server/Data/Converters.cs | 4 -- src/JobsJobsJobs/Server/Data/JobsDbContext.cs | 2 + .../Server/JobsJobsJobs.Server.csproj | 1 + .../Server/JobsJobsJobs.Server.csproj.user | 1 + .../PublishProfiles/FolderProfile.pubxml | 23 +++++++++ .../PublishProfiles/FolderProfile.pubxml.user | 9 ++++ 18 files changed, 192 insertions(+), 31 deletions(-) create mode 100644 src/JobsJobsJobs/Client/Shared/PageTitle.razor create mode 100644 src/JobsJobsJobs/Server/.config/dotnet-tools.json create mode 100644 src/JobsJobsJobs/Server/Properties/PublishProfiles/FolderProfile.pubxml create mode 100644 src/JobsJobsJobs/Server/Properties/PublishProfiles/FolderProfile.pubxml.user diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor b/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor index ebf5eee..dfec9cb 100644 --- a/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor +++ b/src/JobsJobsJobs/Client/Pages/Citizen/Authorized.razor @@ -3,4 +3,6 @@ @inject NavigationManager nav @inject AppState state + +

@Message

diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor index ecf4dc1..b687348 100644 --- a/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor +++ b/src/JobsJobsJobs/Client/Pages/Citizen/Dashboard.razor @@ -2,6 +2,8 @@ @inject HttpClient http @inject AppState state + +

Welcome, @state.User!.Name!

@if (RetrievingData) @@ -17,17 +19,19 @@ else Your employment profile was last updated . Your profile currently lists @Profile.Skills.Length skill@(Profile.Skills.Length != 1 ? "s" : "").

+

View Your Employment Profile

} else {

You do not have an employment profile established; click “Profile”* in the menu to get started!

} +

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! + Take a look around and see if you can help them find work! (coming soon) }

diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor index e652248..cf938a1 100644 --- a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor +++ b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor @@ -1,22 +1,16 @@ @page "/citizen/profile" @inject HttpClient http @inject AppState state +@inject NavigationManager nav @inject IToastService toast + +

Employment Profile

@if (AllLoaded) { - @if (ErrorMessages.Count > 0) - { -

Error

- @foreach (var msg in ErrorMessages) - { -

@msg

- } - } - else - { +
@@ -111,7 +105,13 @@
- } + @if (!IsNew) + { +

+
View Your User Profile +

+ } +
} else { diff --git a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs index 1a3f637..c26f519 100644 --- a/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs +++ b/src/JobsJobsJobs/Client/Pages/Citizen/EditProfile.razor.cs @@ -33,6 +33,11 @@ namespace JobsJobsJobs.Client.Pages.Citizen /// private IEnumerable Continents { get; set; } = Enumerable.Empty(); + /// + /// Whether this is a new profile or not + /// + private bool IsNew { get; set; } = false; + /// /// Error messages from API access /// @@ -57,9 +62,15 @@ namespace JobsJobsJobs.Client.Pages.Citizen if (profileTask.Result.IsOk) { - ProfileForm = (profileTask.Result.Ok == null) - ? new ProfileForm() - : ProfileForm.FromProfile(profileTask.Result.Ok); + if (profileTask.Result.Ok == null) + { + ProfileForm = new ProfileForm(); + IsNew = true; + } + else + { + ProfileForm = ProfileForm.FromProfile(profileTask.Result.Ok); + } if (ProfileForm.Skills.Count == 0) AddNewSkill(); } else @@ -98,6 +109,7 @@ namespace JobsJobsJobs.Client.Pages.Citizen if (res.IsSuccessStatusCode) { toast.ShowSuccess("Profile Saved Successfully"); + nav.NavigateTo($"/profile/view/{state.User!.Id}"); } else { diff --git a/src/JobsJobsJobs/Client/Pages/Index.razor b/src/JobsJobsJobs/Client/Pages/Index.razor index d99f9a8..8850a8b 100644 --- a/src/JobsJobsJobs/Client/Pages/Index.razor +++ b/src/JobsJobsJobs/Client/Pages/Index.razor @@ -1,6 +1,8 @@ @page "/" @inject IJSRuntime js + +

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 @@ -10,12 +12,12 @@ Do you not understand the terms in the paragraph above? No worries; just head over to The Best Podcast in the Universe - (it’s true!) and find out what you’re missing. + (that’s true!) and find out what you’re missing.

-