diff --git a/packages/bridge-ui/src/app/app.routes.ts b/packages/bridge-ui/src/app/app.routes.ts index df5b8ed..d65770e 100644 --- a/packages/bridge-ui/src/app/app.routes.ts +++ b/packages/bridge-ui/src/app/app.routes.ts @@ -2,10 +2,12 @@ import { Routes } from '@angular/router'; import { SeasonsComponent } from './pages/seasons/seasons.component'; import { SeasonDetailsComponent } from './pages/season-details/season-details.component'; import { GettingStartedComponent } from './pages/getting-started/getting-started.component'; +import { UserComponent } from './pages/user/user.component'; export const routes: Routes = [ { path: '', redirectTo: '/seasons', pathMatch:'full' }, { path: 'seasons', component: SeasonsComponent }, { path: 'seasons/:id', component: SeasonDetailsComponent }, { path: 'getting-started', component: GettingStartedComponent }, + { path: 'user/:id', component: UserComponent }, ]; diff --git a/packages/bridge-ui/src/app/components/top-bar/top-bar.component.html b/packages/bridge-ui/src/app/components/top-bar/top-bar.component.html index 4546a3c..bd81823 100644 --- a/packages/bridge-ui/src/app/components/top-bar/top-bar.component.html +++ b/packages/bridge-ui/src/app/components/top-bar/top-bar.component.html @@ -19,7 +19,7 @@ } @else { {{usersService.getUserName()}} - + + + + +
+

Tournament History

+

Not much going on yet...

+
+ diff --git a/packages/bridge-ui/src/app/pages/user/user.component.scss b/packages/bridge-ui/src/app/pages/user/user.component.scss new file mode 100644 index 0000000..f9f89d8 --- /dev/null +++ b/packages/bridge-ui/src/app/pages/user/user.component.scss @@ -0,0 +1,21 @@ +.container { + margin: 1rem auto; + width: 80%; +} + +.column { + float: left; +} + +.column.side { + width: 30% +} + +.column.middle { + width: 68%; + margin-left: 1rem; +} + +.user-image { + width: 200px; +} diff --git a/packages/bridge-ui/src/app/pages/user/user.component.spec.ts b/packages/bridge-ui/src/app/pages/user/user.component.spec.ts new file mode 100644 index 0000000..04025f1 --- /dev/null +++ b/packages/bridge-ui/src/app/pages/user/user.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserComponent } from './user.component'; + +describe('UserComponent', () => { + let component: UserComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [UserComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(UserComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/packages/bridge-ui/src/app/pages/user/user.component.ts b/packages/bridge-ui/src/app/pages/user/user.component.ts new file mode 100644 index 0000000..c8dff83 --- /dev/null +++ b/packages/bridge-ui/src/app/pages/user/user.component.ts @@ -0,0 +1,26 @@ +import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { MatCardModule } from '@angular/material/card'; +import { MatIconModule } from '@angular/material/icon'; +import { MatButtonModule } from '@angular/material/button'; + +import { UsersService } from '../../services/users.service'; + +@Component({ + selector: 'app-user', + standalone: true, + imports: [ + CommonModule, + MatCardModule, + MatIconModule, + MatButtonModule + ], + templateUrl: './user.component.html', + styleUrl: './user.component.scss' +}) +export class UserComponent { + constructor( + public usersService: UsersService, + ) {} +} diff --git a/packages/bridge-ui/src/app/services/users.service.ts b/packages/bridge-ui/src/app/services/users.service.ts index dca4343..dc2c027 100644 --- a/packages/bridge-ui/src/app/services/users.service.ts +++ b/packages/bridge-ui/src/app/services/users.service.ts @@ -13,6 +13,7 @@ export class UsersService { isAuthenticated = false; permissions: string[] = []; user: User | null | undefined = null; + additionalInfo : any = null; constructor( public authService: AuthService, @@ -58,12 +59,36 @@ export class UsersService { this.httpClient.post(this.serverEndpointService.getCurrentEndpoint()+"users/login", {id, nickname, picture, time}).subscribe(); } - getUserName() :string { + getUserName() : string { if(!this.isAuthenticated || !this.user) {return ""} return this.user.nickname || ""; } + getUserId() : string { + if(!this.isAuthenticated || !this.user) {return ""} + + return this.user.sub?.replace("auth0|", "") || ""; + } + + getUserPicture() : string { + if(!this.isAuthenticated || !this.user) {return ""} + + return this.user.picture || ""; + } + + getUserEmail() : string { + if(!this.isAuthenticated || !this.user) {return ""} + + return this.user.email || ""; + } + + getUserRealName() : string { + if(!this.isAuthenticated || !this.user || !this.additionalInfo) {return ""} + + return ""; + } + canCreateSeasons() : boolean { return this.hasPermission("create:seasons") }