Skip to content

Commit

Permalink
Merge pull request #1005 from bcgov/feature/ALCS-638
Browse files Browse the repository at this point in the history
Update Main Page and Header
  • Loading branch information
dhaselhan authored Sep 25, 2023
2 parents de87b01 + f1891ad commit 9493070
Show file tree
Hide file tree
Showing 15 changed files with 174 additions and 8 deletions.
5 changes: 5 additions & 0 deletions portal-frontend/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ const routes: Routes = [
loadChildren: () =>
import('./features/notifications/edit-submission/edit-submission.module').then((m) => m.EditSubmissionModule),
},
{
title: 'Public Search',
path: 'public',
loadChildren: () => import('./features/public/public.module').then((m) => m.PublicModule),
},
{ path: '', redirectTo: '/login', pathMatch: 'full' },
];

Expand Down
20 changes: 16 additions & 4 deletions portal-frontend/src/app/features/login/login.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
<div class="login-wrapper">
<h3>Welcome to the ALCS Application Portal</h3>
<br />
<button (click)='onLogin()' mat-flat-button color='primary'>Login with BCeID</button>
</div>
<h3>Welcome to the ALC Portal</h3>
<section>
<div class="subheading2">Log in with BCeID to create or view your ALC submissions</div>
<button (click)="onLogin()" class="login" mat-flat-button color="primary">Portal Login</button>
<div class="left">
Don't have a BCeID?&nbsp;
<a class="left" target="_blank" href="https://www.bceid.ca/register/basic/account_details.aspx?type=regular"
>Register <mat-icon class="icon">open_in_new</mat-icon></a
>
</div>
</section>
<section>
<div class="subheading2">Search publicly available information</div>
<button (click)="navigateToPublicSearch()" mat-flat-button color="accent">Public Search</button>
</section>
</div>
24 changes: 24 additions & 0 deletions portal-frontend/src/app/features/login/login.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,27 @@
.login-wrapper {
min-height: rem(250);
}

.icon {
margin-left: rem(2);
}

section {
margin: rem(24) 0;
}

.subheading2 {
margin-bottom: rem(8) !important;
}

.login {
margin-bottom: rem(12) !important;
}

button {
width: 100%;

@media screen and (min-width: $tabletBreakpoint) {
width: unset;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AuthenticationService } from '../../services/authentication/authentication.service';

Expand All @@ -16,6 +17,7 @@ describe('LoginComponent', () => {
useValue: {},
},
],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();

fixture = TestBed.createComponent(LoginComponent);
Expand Down
4 changes: 4 additions & 0 deletions portal-frontend/src/app/features/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ export class LoginComponent implements OnInit {
window.location.href = `${res.loginUrl}${idpHint}`;
}
}

async navigateToPublicSearch() {
await this.router.navigateByUrl('/public');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>public works!</p>
Empty file.
24 changes: 24 additions & 0 deletions portal-frontend/src/app/features/public/public.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { PublicComponent } from './public.component';

describe('PublicComponent', () => {
let component: PublicComponent;
let fixture: ComponentFixture<PublicComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PublicComponent],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();

fixture = TestBed.createComponent(PublicComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
10 changes: 10 additions & 0 deletions portal-frontend/src/app/features/public/public.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-public',
templateUrl: './public.component.html',
styleUrls: ['./public.component.scss']
})
export class PublicComponent {

}
18 changes: 18 additions & 0 deletions portal-frontend/src/app/features/public/public.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { SharedModule } from '../../shared/shared.module';
import { PublicComponent } from './public.component';

const routes: Routes = [
{
path: '',
component: PublicComponent,
},
];

@NgModule({
declarations: [PublicComponent],
imports: [CommonModule, SharedModule, RouterModule.forChild(routes)],
})
export class PublicModule {}
13 changes: 13 additions & 0 deletions portal-frontend/src/app/shared/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
<header>
<div class="top-nav">
<ul>
<li>
<a href="https://www.alc.gov.bc.ca/">ALC Website</a>
</li>
<li *ngIf="showPublicSearchLink">
<a routerLink="/public">Public Search</a>
</li>
<li *ngIf="showPortalLink">
<a routerLink="/">Portal</a>
</li>
</ul>
</div>
<div class="title-wrapper">
<div class="title">
<img class="logo" src="assets/alc_logo.svg" alt="ALC Portal" />
Expand Down
44 changes: 40 additions & 4 deletions portal-frontend/src/app/shared/header/header.component.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
@use '../../../styles/functions' as *;
@use '../../../styles/colors' as colors;

.top-nav {
background-color: colors.$primary-color-dark;
padding: rem(8) rem(24);

@media screen and (min-width: $tabletBreakpoint) {
padding: rem(8) rem(36);
}


@media screen and (min-width: $desktopBreakpoint) {
padding: rem(8) rem(80);
}

a {
text-transform: uppercase;
color: #fff;
text-decoration: none;
line-height: rem(16);
}

ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}

li {
margin-right: rem(20);
font-size: rem(14);
letter-spacing: rem(0.14);
}
}

header {
.title-wrapper {
margin: rem(8) rem(24);
margin: rem(16) rem(24);

.title {
.logo {
Expand Down Expand Up @@ -38,16 +73,15 @@ header {
}

@media screen and (min-width: $tabletBreakpoint) {
margin: rem(12) rem(36) !important;
justify-content: space-between;

.burger-menu {
display: none;
}

.title-wrapper {
margin: rem(12) rem(36) !important;
display: flex;
margin: 0;
justify-content: space-between;
align-items: center;

Expand Down Expand Up @@ -85,6 +119,8 @@ header {
}

@media screen and (min-width: $desktopBreakpoint) {
margin: rem(18) rem(80) !important;
.title-wrapper {
margin: rem(18) rem(80) !important;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { BehaviorSubject } from 'rxjs';
Expand All @@ -22,6 +23,7 @@ describe('HeaderComponent', () => {
useValue: mockAuthService,
},
],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();

fixture = TestBed.createComponent(HeaderComponent);
Expand Down
8 changes: 8 additions & 0 deletions portal-frontend/src/app/shared/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export class HeaderComponent implements OnInit, OnDestroy {
private $destroy = new Subject<void>();
isAuthenticated = false;
isMenuOpen = false;
showPublicSearchLink = true;
showPortalLink = false;

constructor(
private authenticationService: AuthenticationService,
Expand All @@ -24,6 +26,12 @@ export class HeaderComponent implements OnInit, OnDestroy {
this.isAuthenticated = !!user;
this.changeDetectorRef.detectChanges();
});
this.router.events.pipe(takeUntil(this.$destroy)).subscribe(() => {
const url = window.location.href;
const isPublic = url.includes('public');
this.showPortalLink = isPublic;
this.showPublicSearchLink = !isPublic;
});
}

async onLogout() {
Expand Down
7 changes: 7 additions & 0 deletions portal-frontend/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ a {
align-items: center;
}

.left {
display: flex;
align-content: center;
justify-content: flex-start;
align-items: center;
}

.no-padding .mat-dialog-container {
padding: 0;
}
Expand Down

0 comments on commit 9493070

Please sign in to comment.