forked from TryCatchLearn/DatingApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe8fc0d
commit 69af385
Showing
24 changed files
with
189 additions
and
53 deletions.
There are no files selected for viewing
Binary file not shown.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { inject } from '@angular/core'; | ||
import { CanActivateFn } from '@angular/router'; | ||
import { AccountService } from '../_services/account.service'; | ||
import { ToastrService } from 'ngx-toastr'; | ||
import { map } from 'rxjs'; | ||
|
||
export const authGuard: CanActivateFn = (route, state) => { | ||
const accountService = inject(AccountService); | ||
const toastr = inject(ToastrService); | ||
|
||
return accountService.currentUser$.pipe( | ||
map(user => { | ||
if (user) return true; | ||
else { | ||
toastr.error('you shall not pass!'); | ||
return false; | ||
} | ||
}) | ||
) | ||
}; |
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,20 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; | ||
import { ToastrModule } from 'ngx-toastr'; | ||
|
||
@NgModule({ | ||
declarations: [], | ||
imports: [ | ||
CommonModule, | ||
BsDropdownModule.forRoot(), | ||
ToastrModule.forRoot({ | ||
positionClass: 'toast-bottom-right' | ||
}) | ||
], | ||
exports: [ | ||
BsDropdownModule, | ||
ToastrModule | ||
] | ||
}) | ||
export class SharedModule { } |
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,5 +1,5 @@ | ||
<app-nav></app-nav> | ||
|
||
<div class="container" style="margin-top: 100px"> | ||
<app-home></app-home> | ||
<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
Empty file.
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 @@ | ||
<p>lists works!</p> |
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,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-lists', | ||
templateUrl: './lists.component.html', | ||
styleUrls: ['./lists.component.css'] | ||
}) | ||
export class ListsComponent { | ||
|
||
} |
Empty file.
1 change: 1 addition & 0 deletions
1
client/src/app/members/member-detail/member-detail.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 @@ | ||
<p>member-detail works!</p> |
10 changes: 10 additions & 0 deletions
10
client/src/app/members/member-detail/member-detail.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,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-member-detail', | ||
templateUrl: './member-detail.component.html', | ||
styleUrls: ['./member-detail.component.css'] | ||
}) | ||
export class MemberDetailComponent { | ||
|
||
} |
Empty file.
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 @@ | ||
<p>member-list works!</p> |
10 changes: 10 additions & 0 deletions
10
client/src/app/members/member-list/member-list.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,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-member-list', | ||
templateUrl: './member-list.component.html', | ||
styleUrls: ['./member-list.component.css'] | ||
}) | ||
export class MemberListComponent { | ||
|
||
} |
Empty file.
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 @@ | ||
<p>messages works!</p> |
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,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-messages', | ||
templateUrl: './messages.component.html', | ||
styleUrls: ['./messages.component.css'] | ||
}) | ||
export class MessagesComponent { | ||
|
||
} |
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,40 +1,34 @@ | ||
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> | ||
<div class="container"> | ||
<a class="navbar-brand" href="#">Dating App</a> | ||
<ul class="navbar-nav me-auto mb-2 mb-md-0" *ngIf="accountService.currentUser$ | async"> | ||
<li class="nav-item"> | ||
<a class="nav-link">Matches</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link">Lists</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link">Messages</a> | ||
</li> | ||
</ul> | ||
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-primary"> | ||
<div class="container"> | ||
<a class="navbar-brand" routerLink="/" routerLinkActive="active">Dating App</a> | ||
<ul class="navbar-nav me-auto mb-2 mb-md-0"> | ||
<ng-container *ngIf="accountService.currentUser$ | async"> | ||
<li class="nav-item"> | ||
<a class="nav-link" routerLink="/members" routerLinkActive="active">Matches</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" routerLink="/lists" routerLinkActive="active">Lists</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" routerLink="/messages" routerLinkActive="active">Messages</a> | ||
</li> | ||
</ng-container> | ||
</ul> | ||
|
||
<div class="dropdown" *ngIf="accountService.currentUser$ | async" dropdown> | ||
<a class="dropdown-toggle text-light text-decoration-none" dropdownToggle>Welcome user</a> | ||
<div class="dropdown-menu" *dropdownMenu> | ||
<a class="dropdown-item">Edit Profile</a> | ||
<a class="dropdown-item" (click)="logout()" >Logout</a> | ||
</div> | ||
</div> | ||
|
||
<form *ngIf="!(accountService.currentUser$ | async)" #loginForm="ngForm" class="d-flex" (ngSubmit)="login()" autocomplete="off"> | ||
<input | ||
name="username" | ||
[(ngModel)]="model.username" | ||
class="form-control me-2" | ||
type="text" | ||
placeholder="Username"> | ||
<input | ||
name="password" | ||
[(ngModel)]="model.password" | ||
class="form-control me-2" | ||
type="password" | ||
placeholder="Password"> | ||
<button class="btn btn-outline-success" type="submit">Login</button> | ||
</form> | ||
<div class="dropdown" *ngIf="(accountService.currentUser$ | async) as user" dropdown> | ||
<a class="dropdown-toggle text-light text-decoration-none" dropdownToggle>Welcome {{user.username | titlecase}}</a> | ||
<div class="dropdown-menu" *dropdownMenu> | ||
<a class="dropdown-item">Edit Profile</a> | ||
<a class="dropdown-item" (click)="logout()">Logout</a> | ||
</div> | ||
</nav> | ||
</div> | ||
|
||
<form *ngIf="!(accountService.currentUser$ | async)" #loginForm="ngForm" class="d-flex" (ngSubmit)="login()" | ||
autocomplete="off"> | ||
<input name="username" [(ngModel)]="model.username" class="form-control me-2" type="text" placeholder="Username"> | ||
<input name="password" [(ngModel)]="model.password" class="form-control me-2" type="password" | ||
placeholder="Password"> | ||
<button class="btn btn-success" type="submit">Login</button> | ||
</form> | ||
</div> | ||
</nav> |
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