Help wanted #23

Merged
danieljsummers merged 20 commits from help-wanted into main 2021-09-01 01:16:43 +00:00
8 changed files with 62 additions and 46 deletions
Showing only changes of commit d1c41d0329 - Show all commits

View File

@ -12,6 +12,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{50B51580-9F09-41E2-BC78-DAD38C37B583}"
ProjectSection(SolutionItems) = preProject
.dockerignore = .dockerignore
..\.gitignore = ..\.gitignore
database\12-add-real-name.sql = database\12-add-real-name.sql
database\16-job-listing.sql = database\16-job-listing.sql
JobsJobsJobs\Directory.Build.props = JobsJobsJobs\Directory.Build.props

View File

@ -6,20 +6,36 @@
<PageTitle Title="My Job Listings" />
<h3>My Job Listings</h3>
<ErrorList Errors=@ErrorMessages>
@if (Loading)
<Loading OnLoad=@OnLoad Message=@(new MarkupString("Loading job listings&hellip;"))>
<p>
<a class="btn" href="/listing/new/edit">Add a New Job Listing</a>
</p>
@if (Listings.Any())
{
<p>Loading job listings&hellip;</p>
<table>
<thead>
<tr>
<th>Action</th>
<th>Title</th>
<th>Created</th>
<th>Updated</th>
</tr>
</thead>
<tbody>
@foreach (var listing in Listings)
{
<tr>
<td><a href="/listing/@listing.Id/edit">Edit</a></td>
<td>@listing.Title</td>
<td><FullDateTime TheDate=@listing.CreatedOn /></td>
<td><FullDateTime TheDate=@listing.UpdatedOn /></td>
</tr>
}
</tbody>
</table>
}
else
{
@if (Listings.Any())
{
<p>TODO: list them</p>
}
else
{
<p><em>No job listings found</em></p>
}
<p><em>No job listings found</em></p>
}
</ErrorList>
</Loading>

View File

@ -1,6 +1,5 @@
using JobsJobsJobs.Shared;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -9,22 +8,16 @@ namespace JobsJobsJobs.Client.Pages.Listings
{
public partial class Mine : ComponentBase
{
/// <summary>
/// Whether the page is loading data
/// </summary>
private bool Loading { get; set; } = true;
/// <summary>
/// Error messages encountered while searching for profiles
/// </summary>
private IList<string> ErrorMessages { get; } = new List<string>();
/// <summary>
/// The job listings entered by the current user
/// </summary>
private IEnumerable<Listing> Listings { get; set; } = Enumerable.Empty<Listing>();
protected override async Task OnInitializedAsync()
/// <summary>
/// Load the user's job listings
/// </summary>
/// <param name="errors">Error collection for possible problems</param>
private async Task OnLoad(ICollection<string> errors)
{
var listings = await ServerApi.RetrieveMany<Listing>(http, "listing/mine");
@ -34,7 +27,7 @@ namespace JobsJobsJobs.Client.Pages.Listings
}
else
{
ErrorMessages.Add(listings.Error);
errors.Add(listings.Error);
}
}
}

View File

@ -15,7 +15,7 @@ else
@code {
[Parameter]
public IList<string> Errors { get; set; } = default!;
public ICollection<string> Errors { get; set; } = default!;
[Parameter]
public RenderFragment ChildContent { get; set; } = default!;

View File

@ -2,17 +2,9 @@
{
<p>@Message</p>
}
else if (ErrorMessages.Count > 0)
else
{
<p>The following error@(ErrorMessages.Count == 1 ? "" : "s") occurred:</p>
<ul>
@foreach (var msg in ErrorMessages)
{
<li><pre>@msg</pre></li>
}
</ul>
}
else
{
@ChildContent
<ErrorList Errors=@ErrorMessages>
@ChildContent
</ErrorList>
}

View File

@ -38,12 +38,22 @@
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="/citizen/profile">
<span class="oi oi-pencil" aria-hidden="true"></span> Edit Your Profile
<span class="oi oi-pencil" aria-hidden="true"></span> My Profile
</NavLink>
</li>
<li class="nav-item separator px-3">
<NavLink class="nav-link" href="/profile/search">
<span class="oi oi-spreadsheet" aria-hidden="true"></span> View Profiles
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="/profile/search">
<span class="oi oi-spreadsheet" aria-hidden="true"></span> View Profiles
<NavLink class="nav-link" href="/listings/mine">
<span class="oi oi-signpost" aria-hidden="true"></span> My Job Listings
</NavLink>
</li>
<li class="nav-item separator px-3">
<NavLink class="nav-link" href="/listings/search">
<span class="oi oi-excerpt" aria-hidden="true"></span> View Listings
</NavLink>
</li>
<li class="nav-item px-3">
@ -53,7 +63,7 @@
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="/citizen/log-off">
<span class="oi oi-plus" aria-hidden="true"></span> Log Off
<span class="oi oi-account-logout" aria-hidden="true"></span> Log Off
</NavLink>
</li>
}

View File

@ -50,6 +50,9 @@
color: white;
}
.nav-item.separator {
border-bottom: solid 1px white;
}
@media (min-width: 641px) {
.navbar-toggler {
display: none;

View File

@ -1,4 +1,5 @@
using System;
using NodaTime;
using System;
namespace JobsJobsJobs.Shared
{
@ -8,15 +9,15 @@ namespace JobsJobsJobs.Shared
public record Listing(
ListingId Id,
CitizenId CitizenId,
DateTime CreatedOn,
Instant CreatedOn,
string Title,
ContinentId ContinentId,
string Region,
bool RemoteWork,
bool IsExpired,
DateTime UpdatedOn,
Instant UpdatedOn,
MarkdownString Text,
DateTime? NeededBy,
LocalDate? NeededBy,
bool? WasFilledHere)
{
/// <summary>