Skip to content

Commit

Permalink
Make some changes to the look and feel of the site (#2)
Browse files Browse the repository at this point in the history
- Upcoming list is now on the home page
 - Main menu buttons are now simplified, but larger
 - Fixed issue where schools marked as "hidden" would show up in lists
  • Loading branch information
MarkStrendin authored Sep 26, 2024
1 parent f7eed49 commit 3a25d4e
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 86 deletions.
118 changes: 56 additions & 62 deletions src/SubNotify.FrontEnd/Components/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

[Inject]
PermissionsManager? _permissionsManager { get; set; }

[Inject]
SchoolService? _schoolService { get; set; }


[Inject]
SubEventService? _subEventService { get; set; }

[Inject ]
AuthenticationStateProvider? AuthenticationStateProvider { get; set;}


List<School> userSchools = new List<School>();
Dictionary<Guid, School> schoolsByID = new Dictionary<Guid, School>();
Expand All @@ -23,17 +26,17 @@


protected override async Task OnInitializedAsync()
{
List<School> allSchools = _schoolService?.GetAll().OrderBy(x => x.Name).ToList() ?? new List<School>();
{
List<School> allSchools = _schoolService?.GetEnabled().OrderBy(x => x.Name).ToList() ?? new List<School>();
schoolsByID = allSchools.ToDictionary(x => x.Id);

if (AuthenticationStateProvider != null)
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
ClaimsPrincipal user = authState.User;
userPermissions = _permissionsManager.GetCombinedPermissions(user);
}
}

// Load this user's schools
}
Expand All @@ -43,26 +46,40 @@

<AuthorizeView>
<Authorized>

<div style="text-align: right; font-size: 10pt;">
@if (_permissionsManager?.CanManageSchoolList(context?.User) ?? false)
{
<a class="admin_main_menu_link" href="/ManageSchools">Manage school list</a>
}

@if (_permissionsManager?.CanManageSubList(context?.User) ?? false)
{
<a class="admin_main_menu_link" href="/ManageSubList">Manage sub list</a>
}

@if (_permissionsManager?.CanManagePermissions(context?.User) ?? false)
{
<a class="admin_main_menu_link" href="/ManagePermissions">Manage permissions</a>
}

<br/>


</div>


<br/>
<div class="home_page_container">
<div style="text-align: center; border-bottom: 1px solid #C0C0C0;">
<h2>Main Menu</h2>
</div>
<div class="main_nav_container">
<div class="main_nav_container">

<a class="menu_link" href="/Notify">
<div class="main_nav_button">
<div class="main_nav_button_icon"><img src="/img/substitute.svg"></div>
<div class="main_nav_button_text">Notify SIS of an upcoming substitute secretary</div>
</div>
</a>

<a class="menu_link" href="/Upcoming">
<div class="main_nav_button">
<div class="main_nav_button_icon"><img src="/img/upcoming.svg"></div>
<div class="main_nav_button_text">View upcoming and active subs</div>
</div>
</a>

<a class="menu_link" href="/SubList">
<div class="main_nav_button">
<div class="main_nav_button_icon"><img src="/img/list.svg"></div>
Expand All @@ -73,58 +90,35 @@
</div>
<br/>

<div style="text-align: center;">
<h4 style="border-bottom: 1px solid #C0C0C0;">Schools that you have access to</h4>
<div style="display: flex; flex-wrap: wrap; justify-content: center; font-size: 0.75em;">
@foreach(Guid schoolGuid in userPermissions.SchoolGUIDs)
{
@if (schoolsByID.ContainsKey(schoolGuid)) {
School thisSchool = schoolsByID[schoolGuid];
<div style="display: inline; padding: 4px;margin: 5px;">@(thisSchool.Name)</div>
}
}
</div>
</div>

<br/><br/><br/>
<div class="main_nav_container">
@if (_permissionsManager?.CanManageSchoolList(context?.User) ?? false)
@foreach(Guid schoolGuid in userPermissions.SchoolGUIDs)
{
<a class="menu_link" href="/ManageSchools">
<div class="main_nav_button">
<div class="main_nav_button_icon"><img src="/img/school.svg"></div>
<div class="main_nav_button_text">Manage school list</div>
</div>
</a>
}
@if (schoolsByID.ContainsKey(schoolGuid)) {
School thisSchool = schoolsByID[schoolGuid];
List<SubEvent> active = _subEventService.GetActive(thisSchool).ToList();
List<SubEvent> upcoming = _subEventService.GetUpcoming(thisSchool).ToList();
List<SubEvent> combined = new List<SubEvent>();
combined.AddRange(active);
combined.AddRange(upcoming);

@if(combined.Count > 0)
{
<h2>@(thisSchool.Name)</h2>

<SubEventTable Events="@(combined)" />
<br/><br/><br/>
}

@if (_permissionsManager?.CanManageSubList(context?.User) ?? false)
{
<a class="menu_link" href="/ManageSubList">
<div class="main_nav_button">
<div class="main_nav_button_icon"><img src="/img/list-check.svg"></div>
<div class="main_nav_button_text">Manage sub list</div>
</div>
</a>
}

@if (_permissionsManager?.CanManagePermissions(context?.User) ?? false)
{
<a class="menu_link" href="/ManagePermissions">
<div class="main_nav_button">
<div class="main_nav_button_icon"><img src="/img/security.svg"></div>
<div class="main_nav_button_text">Manage permissions</div>
</div>
</a>
}
}

</div>

<br/>
<br/><br/>


</div>

<br/><br/><br/>


</Authorized>
<NotAuthorized>
<p>Not Authorized</p>
Expand Down
2 changes: 1 addition & 1 deletion src/SubNotify.FrontEnd/Components/Pages/Notify.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

protected override async Task OnInitializedAsync()
{
List<School> allSchools = _schoolService?.GetAll().OrderBy(x => x.Name).ToList() ?? new List<School>();
List<School> allSchools = _schoolService?.GetEnabled().OrderBy(x => x.Name).ToList() ?? new List<School>();
schoolsByID = allSchools.ToDictionary(x => x.Id);

if (AuthenticationStateProvider != null)
Expand Down
15 changes: 8 additions & 7 deletions src/SubNotify.FrontEnd/Components/Pages/NotifySpecific.razor
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,13 @@
<AuthorizeView>
<Authorized Context="AuthorizedUser">
<div class="page_container">
<h1>Sub notifications</h1>
<h1>Notify of an upcoming sub</h1>
<a href="/">Back to home</a>
<br/><br/><br/>


@if (selectedSchool != null)
{
<h2>Notify SIS team of an upcoming substitute secretary</h2>
{
<p>Use this form to notify the SIS team of a substitute secretary for your school.</p>

<br/><br/>
Expand Down Expand Up @@ -230,7 +229,8 @@

<div class="row form-group">
<div class="col-3 col-form-label">
<label for="subGUID">Which secretary is away?: </label>
<label for="subGUID">Which secretary will be away?: </label><br/>
<div style="font-size: 70%; font-style: italic;">For schools with multiple secretaries. Optional.</div>
</div>
<div class="col-9">
<InputText id="notes" class="form-control" @bind-Value="@newSubEvent.SubstituteFor"></InputText>
Expand All @@ -241,7 +241,8 @@

<div class="row form-group">
<div class="col-3 col-form-label">
<label for="subGUID">Additional notes: </label>
<label for="subGUID">Additional notes: </label><br/>
<div style="font-size: 70%; font-style: italic;">Any additional information that may be relevant. Optional.</div>
</div>
<div class="col-9">
<InputTextArea id="notes" class="form-control" @bind-Value="@newSubEvent.Notes"></InputTextArea>
Expand Down Expand Up @@ -284,14 +285,14 @@
@if(activeSubs.Count > 0)
{
<br/><br/><br/><br/>
<h2>Active subsitutes</h2>
<h2>Active subsitutes for @(selectedSchool.Name)</h2>
<SubEventTable Events="@(activeSubs)" />
}

@if(upcomingSubs.Count > 0)
{
<br/><br/><br/><br/>
<h2>Upcoming substitutes</h2>
<h2>Upcoming substitutes for @(selectedSchool.Name)</h2>
<SubEventTable Events="@(upcomingSubs)" />
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
</div>

<div style="text-align: center;">
<i>All sections below display and access the same app permissions, but they display them differently.</i>
<p>These permissions control who can log into and access this site, and what schools a given user can see and submit the form for.</p>
<p>There is only one set of permissions, the different links below just allow you to view the list of permissions differently.</p>
</div>

<div class="main_nav_container">
Expand Down
2 changes: 1 addition & 1 deletion src/SubNotify.FrontEnd/Components/Pages/SubList.razor
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

protected override async Task OnInitializedAsync()
{
List<School> allSchools = _schoolService?.GetAll().OrderBy(x => x.Name).ToList() ?? new List<School>();
List<School> allSchools = _schoolService?.GetEnabled().OrderBy(x => x.Name).ToList() ?? new List<School>();
schoolsByID = allSchools.ToDictionary(x => x.Id);

if (AuthenticationStateProvider != null)
Expand Down
2 changes: 1 addition & 1 deletion src/SubNotify.FrontEnd/Components/Pages/Upcoming.razor
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

protected override async Task OnInitializedAsync()
{
List<School> allSchools = _schoolService?.GetAll().OrderBy(x => x.Name).ToList() ?? new List<School>();
List<School> allSchools = _schoolService?.GetEnabled().OrderBy(x => x.Name).ToList() ?? new List<School>();
schoolsByID = allSchools.ToDictionary(x => x.Id);

if (AuthenticationStateProvider != null)
Expand Down
29 changes: 16 additions & 13 deletions src/SubNotify.FrontEnd/wwwroot/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,31 @@ h1:focus {
}

.main_nav_button {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 200px;
height: 200px;
border-radius: 15px;
display: grid;
grid-template-columns: 25% 75%;
grid-template-rows: auto;
width: 400px;
border-radius: 10px;
margin: 10px;
border: 2px solid #C0C0C0;
background-color: rgba(0,0,0,0.02);
padding: 10px;
}

.main_nav_button_icon {
width: 50%;
height: 300px;
}

.main_nav_button_icon img {
width: 100%;
width: 64px;
}

.main_nav_button_text {
width: 100%;
height: 200px;
font-size: 12pt;
font-weight: bold;
text-align: center;
text-align: left;
padding: 10px;
justify-self: start;
align-self: center;
}

.main_nav_container {
Expand All @@ -103,4 +102,8 @@ h1:focus {

.menu_link {
text-decoration: none;
}

.admin_main_menu_link {
margin-left: 10px;
}

0 comments on commit 3a25d4e

Please sign in to comment.