From a7c810136b92a97d5a95abb845a8de91e099d8e4 Mon Sep 17 00:00:00 2001 From: Isaac Grynsztein Date: Sun, 26 Apr 2020 17:33:29 -0400 Subject: [PATCH] Added basic user profile component --- src/app/app.component.html | 4 +++ src/app/app.component.ts | 7 +++++ src/app/app.module.ts | 4 ++- .../user-profile-dialog.component.html | 23 +++++++++++++++ .../user-profile-dialog.component.scss | 0 .../user-profile-dialog.component.spec.ts | 25 +++++++++++++++++ .../user-profile-dialog.component.ts | 28 +++++++++++++++++++ 7 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 src/app/dialogs/user-profile-dialog/user-profile-dialog.component.html create mode 100644 src/app/dialogs/user-profile-dialog/user-profile-dialog.component.scss create mode 100644 src/app/dialogs/user-profile-dialog/user-profile-dialog.component.spec.ts create mode 100644 src/app/dialogs/user-profile-dialog/user-profile-dialog.component.ts diff --git a/src/app/app.component.html b/src/app/app.component.html index 0e03fe9..5de160c 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -14,6 +14,10 @@
+ +
+ + +
+
warnYou are not logged in.
+ +
+ diff --git a/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.scss b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.spec.ts b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.spec.ts new file mode 100644 index 0000000..364e28b --- /dev/null +++ b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserProfileDialogComponent } from './user-profile-dialog.component'; + +describe('UserProfileDialogComponent', () => { + let component: UserProfileDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UserProfileDialogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserProfileDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.ts b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.ts new file mode 100644 index 0000000..17d8c86 --- /dev/null +++ b/src/app/dialogs/user-profile-dialog/user-profile-dialog.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit } from '@angular/core'; +import { PostsService } from 'app/posts.services'; +import { Router } from '@angular/router'; +import { MatDialogRef } from '@angular/material/dialog'; + +@Component({ + selector: 'app-user-profile-dialog', + templateUrl: './user-profile-dialog.component.html', + styleUrls: ['./user-profile-dialog.component.scss'] +}) +export class UserProfileDialogComponent implements OnInit { + + constructor(public postsService: PostsService, private router: Router, public dialogRef: MatDialogRef) { } + + ngOnInit(): void { + } + + loginClicked() { + this.router.navigate(['/login']); + this.dialogRef.close(); + } + + logoutClicked() { + this.postsService.logout(); + this.dialogRef.close(); + } + +}