aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Angular
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-01-21 11:09:22 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-01-21 11:09:22 +0200
commit8e3f34f375a86370d71aa329e5449b14d7992753 (patch)
tree8187876adeaa3870000db14749959dc4b2248720 /src/DevHive.Angular
parentc2221e76a757bf6fd49bb4c8db4f082d37f1ecb7 (diff)
downloadDevHive-8e3f34f375a86370d71aa329e5449b14d7992753.tar
DevHive-8e3f34f375a86370d71aa329e5449b14d7992753.tar.gz
DevHive-8e3f34f375a86370d71aa329e5449b14d7992753.zip
Added a simple error (not found) page
Diffstat (limited to 'src/DevHive.Angular')
-rw-r--r--src/DevHive.Angular/src/app/app-routing.module.ts4
-rw-r--r--src/DevHive.Angular/src/app/app.module.ts4
-rw-r--r--src/DevHive.Angular/src/app/components/error/error.component.css23
-rw-r--r--src/DevHive.Angular/src/app/components/error/error.component.html10
-rw-r--r--src/DevHive.Angular/src/app/components/error/error.component.ts24
-rw-r--r--src/DevHive.Angular/src/app/components/profile/profile.component.ts1
6 files changed, 63 insertions, 3 deletions
diff --git a/src/DevHive.Angular/src/app/app-routing.module.ts b/src/DevHive.Angular/src/app/app-routing.module.ts
index 7817dcb..c511fe2 100644
--- a/src/DevHive.Angular/src/app/app-routing.module.ts
+++ b/src/DevHive.Angular/src/app/app-routing.module.ts
@@ -5,13 +5,15 @@ import { LoginComponent } from './components/login/login.component';
import { RegisterComponent } from './components/register/register.component';
import { ProfileComponent } from './components/profile/profile.component';
import {ProfileSettingsComponent} from './components/profile-settings/profile-settings.component';
+import {ErrorComponent} from './components/error/error.component';
const routes: Routes = [
{ path: '', component: FeedComponent },
{ path: 'login', component: LoginComponent },
{ path: 'register', component: RegisterComponent },
{ path: 'profile/:username', component: ProfileComponent },
- { path: 'profile/:username/settings', component: ProfileSettingsComponent }
+ { path: 'profile/:username/settings', component: ProfileSettingsComponent },
+ { path: '**', component: ErrorComponent }
];
@NgModule({
diff --git a/src/DevHive.Angular/src/app/app.module.ts b/src/DevHive.Angular/src/app/app.module.ts
index 7158941..e4f60e0 100644
--- a/src/DevHive.Angular/src/app/app.module.ts
+++ b/src/DevHive.Angular/src/app/app.module.ts
@@ -14,6 +14,7 @@ import { FeedComponent } from './components/feed/feed.component';
import { PostComponent } from './components/post/post.component';
import { ProfileComponent } from './components/profile/profile.component';
import { ProfileSettingsComponent } from './components/profile-settings/profile-settings.component';
+import { ErrorComponent } from './components/error/error.component';
@NgModule({
declarations: [
@@ -23,7 +24,8 @@ import { ProfileSettingsComponent } from './components/profile-settings/profile-
FeedComponent,
PostComponent,
ProfileComponent,
- ProfileSettingsComponent
+ ProfileSettingsComponent,
+ ErrorComponent
],
imports: [
BrowserModule,
diff --git a/src/DevHive.Angular/src/app/components/error/error.component.css b/src/DevHive.Angular/src/app/components/error/error.component.css
new file mode 100644
index 0000000..ef6231d
--- /dev/null
+++ b/src/DevHive.Angular/src/app/components/error/error.component.css
@@ -0,0 +1,23 @@
+#content {
+ font-size: 1.3em;
+}
+
+#content hr {
+ width: 100%;
+ border: 1px solid black;
+ box-sizing: border-box;
+}
+
+#back-btns {
+ width: 100%;
+ display: flex;
+}
+
+#back-btns > * {
+ flex: 1;
+ margin-right: .2em;
+}
+
+#back-btns > *:nth-last-child(1) {
+ margin-right: 0;
+}
diff --git a/src/DevHive.Angular/src/app/components/error/error.component.html b/src/DevHive.Angular/src/app/components/error/error.component.html
new file mode 100644
index 0000000..8394810
--- /dev/null
+++ b/src/DevHive.Angular/src/app/components/error/error.component.html
@@ -0,0 +1,10 @@
+<div id="content">
+ <div class="title">
+ Page not found!
+ </div>
+ <hr>
+ <div id="back-btns">
+ <button class="submit-btn" type="submit" (click)="backToFeed()">Back to feed</button>
+ <button class="submit-btn" type="submit" (click)="backToLogin()">Back to login</button>
+ </div>
+</div>
diff --git a/src/DevHive.Angular/src/app/components/error/error.component.ts b/src/DevHive.Angular/src/app/components/error/error.component.ts
new file mode 100644
index 0000000..7069dc0
--- /dev/null
+++ b/src/DevHive.Angular/src/app/components/error/error.component.ts
@@ -0,0 +1,24 @@
+import { Component, OnInit } from '@angular/core';
+import {Router} from '@angular/router';
+
+@Component({
+ selector: 'app-error',
+ templateUrl: './error.component.html',
+ styleUrls: ['./error.component.css']
+})
+export class ErrorComponent implements OnInit {
+
+ constructor(private _router: Router)
+ { }
+
+ ngOnInit(): void {
+ }
+
+ backToFeed(): void {
+ this._router.navigate(['/']);
+ }
+
+ backToLogin(): void {
+ this._router.navigate(['/login']);
+ }
+}
diff --git a/src/DevHive.Angular/src/app/components/profile/profile.component.ts b/src/DevHive.Angular/src/app/components/profile/profile.component.ts
index 16bb053..51fc066 100644
--- a/src/DevHive.Angular/src/app/components/profile/profile.component.ts
+++ b/src/DevHive.Angular/src/app/components/profile/profile.component.ts
@@ -23,7 +23,6 @@ export class ProfileComponent implements OnInit {
ngOnInit(): void {
const username = this._router.url.substring(9);
- console.log(username);
if (sessionStorage.getItem('UserCred')) {
// Workaround for waiting the fetch response