Skip to content

Commit

Permalink
Added error page
Browse files Browse the repository at this point in the history
  • Loading branch information
rfontanarosa committed Jul 12, 2024
1 parent 3581003 commit c0ddbe8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 37 deletions.
20 changes: 14 additions & 6 deletions web/src/app/pages/error/error.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@
limitations under the License.
-->

<div class="page">
<div class="page error-page">
<ground-header></ground-header>

<div class="container">
<div class="card">
<div class="content">
<div class="page-content">
<img src="/assets/img/access-denied.svg">

<ng-container *ngIf="errorType == ErrorType.GENERIC">
<h1>Oops, something went wrong</h1>

<h2>{{error}}</h2>
</div>
</ng-container>

<ng-container *ngIf="errorType == ErrorType.ACCESS_DENIED">
<h1>Access denied</h1>

<a mat-flat-button color="primary" href="https://forms.gle/RgnFcCz9ma1gLr6v7" target="_blank">
Click here for registration
</a>
</ng-container>
</div>
</div>
</div>
39 changes: 13 additions & 26 deletions web/src/app/pages/error/error.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,25 @@
* limitations under the License.
*/

.page {
.error-page {
min-height: 100%;
font-family: 'Manrope';

.container {
align-items: center;
.page-content {
display: flex;
flex-direction: column;
align-items: center;

.card {
border-radius: 18px;
display: flex;
margin-top: 24px;
width: 880px;

.content {
padding: 16px;
display: flex;
flex-direction: column;
width: 100%;

h1 {
font-size: 28px;
font-weight: 400;
line-height: 36px;
}
h1 {
font-size: 22px;
font-weight: 500;
line-height: 28px;
}

h2 {
font-size: 16px;
font-weight: 400;
line-height: 24px;
}
}
h2 {
font-size: 14px;
font-weight: 400;
line-height: 20px;
}
}
}
15 changes: 12 additions & 3 deletions web/src/app/pages/error/error.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,28 @@
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';

import {NavigationService} from 'app/services/navigation/navigation.service';
enum ErrorType {
GENERIC,
ACCESS_DENIED,
}

@Component({
selector: 'error',
templateUrl: './error.component.html',
styleUrls: ['./error.component.scss'],
})
export class ErrorComponent implements OnInit {
constructor(private route: ActivatedRoute) {}

error = '';
errorType: ErrorType = ErrorType.GENERIC;

ErrorType = ErrorType;

constructor(private route: ActivatedRoute) {}

ngOnInit(): void {
this.error = this.route.snapshot.paramMap.get('error') ?? '';
if (this.error.startsWith('FirebaseError: [code=permission-denied]')) {
this.errorType = ErrorType.ACCESS_DENIED;
}
}
}
4 changes: 2 additions & 2 deletions web/src/app/pages/error/error.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {MatButtonModule} from '@angular/material/button';
import {RouterModule} from '@angular/router';

import {HeaderModule} from 'app/components/header/header.module';
import {ErrorComponent} from 'app/pages/error/error.component';

@NgModule({
declarations: [ErrorComponent],
imports: [CommonModule, HeaderModule, RouterModule],
imports: [CommonModule, HeaderModule, RouterModule, MatButtonModule],
exports: [ErrorComponent],
})
export class ErrorModule {}

0 comments on commit c0ddbe8

Please sign in to comment.