Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ export const routes: Routes = [
},
{ path: '', component: HomeComponent, title: 'Computing Science Student Society' },
// 404 will go down there
{ path: '**', component: HomeComponent }
{
path: '**',
loadComponent: () =>
import('./pages/not-found/not-found.component').then(m => m.NotFoundComponent),
title: makeTitle('Not Found')
}
] as const;

const BASE_ROUTES = routes.reduce((acc, route) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/nav-bar/nav-bar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $navbar-w: 20rem;
background-color: theme.$bg3;
border-right: $border;
z-index: 100;
overflow: scroll;
overflow: auto;

&__heading {
font-size: 1.1rem;
Expand Down
3 changes: 3 additions & 0 deletions src/app/pages/not-found/not-found.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>Not Found</h1>
<fa-icon [icon]="errorIcon" size="9x"></fa-icon>
<p>The editor could not open the file "{{ this.router.url }}"</p>
12 changes: 12 additions & 0 deletions src/app/pages/not-found/not-found.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:host {
display: flex;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
flex-direction: column;
}

fa-icon {
color: hsl(360 64.3% 44.8%);
}
23 changes: 23 additions & 0 deletions src/app/pages/not-found/not-found.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { NotFoundComponent } from './not-found.component';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [NotFoundComponent]
})
.compileComponents();

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
16 changes: 16 additions & 0 deletions src/app/pages/not-found/not-found.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { Router } from '@angular/router';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { faTriangleExclamation } from '@fortawesome/free-solid-svg-icons';

@Component({
selector: 'cs-not-found',
imports: [FontAwesomeModule],
templateUrl: './not-found.component.html',
styleUrl: './not-found.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class NotFoundComponent {
protected errorIcon = faTriangleExclamation;
protected router = inject(Router);
}