-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Init nav bar component * Add navigation bar * Add logo * Fix spacing issue caused by nav bar * Update on login * Fix nav bar not updating on login * Add access to questions and matching * oops --------- Co-authored-by: Samuel Lim <[email protected]>
- Loading branch information
1 parent
fa522fd
commit a04cd68
Showing
13 changed files
with
210 additions
and
31 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div class="flex flex-column h-full w-full justify-content-center align-items-center p-2"> | ||
<div class="flex flex-column h-full w-full justify-content-center align-items-center p-2" style="margin-top: -80px"> | ||
<h2 class="mb-2">Welcome to PeerPrep</h2> | ||
<router-outlet></router-outlet> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
<app-navigation-bar /> | ||
|
||
<router-outlet /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
frontend/src/app/navigation-bar/navigation-bar.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
::ng-deep .p-menubar { | ||
border-radius: 0; | ||
border-style: none; | ||
position: sticky; | ||
background-color: rgba(9, 9, 11, 0.8); | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); | ||
top: 0; | ||
z-index: 100; | ||
backdrop-filter: blur(10px); | ||
justify-content: center; | ||
height: 80px; | ||
} | ||
|
||
:host ::ng-deep p-menubarsub { | ||
width: 100%; | ||
} | ||
|
||
::ng-deep .p-submenu-list { | ||
right: 0%; | ||
left: unset; | ||
} | ||
|
||
a.fill-div { | ||
display: block; | ||
height: 100%; | ||
width: 100%; | ||
text-decoration: none; | ||
} | ||
|
||
/* fonts */ | ||
.poppins-thin { | ||
font-family: "Poppins", sans-serif; | ||
font-weight: 100; | ||
font-style: normal; | ||
} | ||
|
||
.poppins-bold { | ||
font-family: "Poppins", sans-serif; | ||
font-weight: 700; | ||
font-style: normal; | ||
} | ||
|
||
p.logo-font-size { | ||
font-size: 28px; | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
frontend/src/app/navigation-bar/navigation-bar.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;700&display=swap" rel="stylesheet" /> | ||
|
||
<p-menubar [model]="items"> | ||
<ng-template pTemplate="start"> | ||
<div class="pl-2 flex align-items-center" style="cursor: pointer" [routerLink]="['/matching']"> | ||
<img src="/logo.png" alt="logo" style="width: auto; height: 55px" /> | ||
<p class="pl-2 mr-3 poppins-bold logo-font-size">PeerPrep</p> | ||
</div> | ||
</ng-template> | ||
<ng-template pTemplate="item" let-item> | ||
<a [routerLink]="item.route" class="p-menuitem-link"> | ||
<span [class]="item.icon"></span> | ||
<span class="ml-2">{{ item.label }}</span> | ||
</a> | ||
</ng-template> | ||
</p-menubar> |
22 changes: 22 additions & 0 deletions
22
frontend/src/app/navigation-bar/navigation-bar.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { NavigationBarComponent } from './navigation-bar.component'; | ||
|
||
describe('NavigationBarComponent', () => { | ||
let component: NavigationBarComponent; | ||
let fixture: ComponentFixture<NavigationBarComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [NavigationBarComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(NavigationBarComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
89 changes: 89 additions & 0 deletions
89
frontend/src/app/navigation-bar/navigation-bar.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Router } from '@angular/router'; | ||
import { MenuItem } from 'primeng/api'; | ||
import { CommonModule, NgFor } from '@angular/common'; | ||
import { MenubarModule } from 'primeng/menubar'; | ||
import { AuthenticationService } from '../../_services/authentication.service'; | ||
import { User } from '../../_models/user.model'; | ||
|
||
@Component({ | ||
selector: 'app-navigation-bar', | ||
standalone: true, | ||
imports: [MenubarModule, CommonModule, NgFor], | ||
templateUrl: './navigation-bar.component.html', | ||
styleUrl: './navigation-bar.component.css', | ||
}) | ||
export class NavigationBarComponent implements OnInit { | ||
items: MenuItem[] | undefined; | ||
|
||
constructor( | ||
private router: Router, | ||
private authService: AuthenticationService, | ||
) {} | ||
|
||
ngOnInit() { | ||
this.setMenuItems(); | ||
this.authService.user$.subscribe(() => this.setMenuItems()); | ||
} | ||
|
||
setMenuItems() { | ||
if (this.authService.isLoggedIn) { | ||
const user = this.authService.userValue as User; | ||
this.items = [ | ||
{ | ||
label: user.username, | ||
icon: 'pi pi-user', | ||
// route: '/profile', | ||
style: { 'margin-left': 'auto' }, | ||
items: [ | ||
{ | ||
label: 'Find Match', | ||
icon: 'pi pi-users', | ||
// route: '', | ||
class: 'p-submenu-list', | ||
}, | ||
{ | ||
label: 'View Questions', | ||
icon: 'pi pi-file', | ||
route: '/questions', | ||
class: 'p-submenu-list', | ||
}, | ||
{ | ||
label: 'View Profile', | ||
icon: 'pi pi-user', | ||
// route: '', | ||
class: 'p-submenu-list', | ||
}, | ||
{ | ||
label: 'View Match History', | ||
icon: 'pi pi-trophy', | ||
// route: '', | ||
class: 'p-submenu-list', | ||
}, | ||
{ | ||
label: 'Logout', | ||
icon: 'pi pi-sign-out', | ||
class: 'p-submenu-list', | ||
command: () => this.authService.logout(), | ||
}, | ||
], | ||
}, | ||
]; | ||
} else { | ||
this.items = [ | ||
{ | ||
label: 'Login', | ||
icon: 'pi pi-sign-in', | ||
route: 'account/login', | ||
style: { 'margin-left': 'auto' }, | ||
}, | ||
{ | ||
label: 'Sign Up', | ||
icon: 'pi pi-pen-to-square', | ||
route: '/account/register', | ||
class: 'border', | ||
}, | ||
]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters