From 8e3f34f375a86370d71aa329e5449b14d7992753 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 21 Jan 2021 11:09:22 +0200 Subject: Added a simple error (not found) page --- src/DevHive.Angular/src/app/app-routing.module.ts | 4 +++- src/DevHive.Angular/src/app/app.module.ts | 4 +++- .../src/app/components/error/error.component.css | 23 +++++++++++++++++++++ .../src/app/components/error/error.component.html | 10 +++++++++ .../src/app/components/error/error.component.ts | 24 ++++++++++++++++++++++ .../app/components/profile/profile.component.ts | 1 - 6 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 src/DevHive.Angular/src/app/components/error/error.component.css create mode 100644 src/DevHive.Angular/src/app/components/error/error.component.html create mode 100644 src/DevHive.Angular/src/app/components/error/error.component.ts (limited to 'src/DevHive.Angular') 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 @@ +
+
+ Page not found! +
+
+
+ + +
+
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 -- cgit v1.2.3 From 2c8867d3f238a17235b53a806c53e3be096a1e5c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 21 Jan 2021 11:25:59 +0200 Subject: Added settings and logout buttons to the feed page (user sidebar) --- .../src/app/components/feed/feed.component.css | 13 +++++++++++-- .../src/app/components/feed/feed.component.html | 20 ++++++++++++-------- .../src/app/components/feed/feed.component.ts | 9 +++++++++ src/DevHive.Angular/src/app/services/user.service.ts | 4 ++++ 4 files changed, 36 insertions(+), 10 deletions(-) (limited to 'src/DevHive.Angular') diff --git a/src/DevHive.Angular/src/app/components/feed/feed.component.css b/src/DevHive.Angular/src/app/components/feed/feed.component.css index aa3c392..c54315f 100644 --- a/src/DevHive.Angular/src/app/components/feed/feed.component.css +++ b/src/DevHive.Angular/src/app/components/feed/feed.component.css @@ -72,7 +72,16 @@ #profile-bar-name { text-align: center; - margin-bottom: .5em; +} + +#profile-bar-username { + margin: .5em 0; +} + +#profile-bar > #profile-info { + display: flex; + flex-direction: column; + align-items: center; } /* Top bar */ @@ -120,7 +129,7 @@ /* Elements, that act as buttons */ -#profile-bar:hover, +#profile-bar > #profile-info:hover, #top-bar-profile-pic:hover { cursor: pointer; } diff --git a/src/DevHive.Angular/src/app/components/feed/feed.component.html b/src/DevHive.Angular/src/app/components/feed/feed.component.html index 5d7c86a..a12aab6 100644 --- a/src/DevHive.Angular/src/app/components/feed/feed.component.html +++ b/src/DevHive.Angular/src/app/components/feed/feed.component.html @@ -4,16 +4,20 @@
-