Skip to content

Commit 150e592

Browse files
committed
feat: add users account list
1 parent 1eb50ed commit 150e592

File tree

4 files changed

+59
-5
lines changed

4 files changed

+59
-5
lines changed

src/app/core/fake-api/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export * from './db.data';
12
export * from './fake-api.service';
Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,51 @@
1-
<ng-container *ngrxLet="user$ as user">
1+
<section *ngrxLet="user$ as user">
22
<h1>
33
{{ greeting }},
4-
<span class="aa--text-primary"> {{ user?.firstName }} {{ user?.lastName }}</span>
4+
<span class="aa--text-primary">{{ user?.firstName }} {{ user?.lastName }}</span>
55
</h1>
66

7-
<p class="aa--text-xl">Shhh... 🤫 - This is a top secret feature!</p>
8-
</ng-container>
7+
<p class="aa--text-xl">
8+
Shhh... 🤫 - This is a <span class="aa--text-primary">top secret</span> feature!
9+
</p>
10+
</section>
11+
12+
<section>
13+
<h2 class="aa--mb-4">Users</h2>
14+
15+
<div class="card">
16+
<tui-notification class="aa--mb-4" status="warning">
17+
Note that we expose users' credentials for <b>demonstration purposes</b> only! Feel
18+
free to logout and login again using one of the following accounts.
19+
</tui-notification>
20+
21+
<table class="tui-table">
22+
<tbody>
23+
<tr class="tui-table__tr">
24+
<th class="tui-table__th">ID</th>
25+
<th class="tui-table__th">Full Name</th>
26+
<th class="tui-table__th">Username</th>
27+
<th class="tui-table__th">Password</th>
28+
</tr>
29+
<tr *ngFor="let user of users" class="tui-table__tr">
30+
<td class="tui-table__td">{{ user.id }}</td>
31+
<td class="tui-table__td">
32+
{{ user.firstName }} {{ user.lastName }}
33+
<tui-badge
34+
*ngIf="(user$ | async)?.id === user.id"
35+
class="md:aa--ml-2"
36+
size="s"
37+
status="success"
38+
value="Logged in"
39+
></tui-badge>
40+
</td>
41+
<td class="tui-table__td">
42+
<code>{{ user.username }}</code>
43+
</td>
44+
<td class="tui-table__td">
45+
<code>{{ user.password }}</code>
46+
</td>
47+
</tr>
48+
</tbody>
49+
</table>
50+
</div>
51+
</section>

src/app/features/secured-feat/secured-feat.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component } from '@angular/core';
22

33
import { AuthFacade } from '../../auth/store/auth.facade';
4+
import { USERS } from '../../core/fake-api';
45
import { GreetingUtil } from '../../shared/util';
56
@Component({
67
selector: 'aa-secured-feat',
@@ -9,6 +10,7 @@ import { GreetingUtil } from '../../shared/util';
910
export class SecuredFeatComponent {
1011
greeting = GreetingUtil.greet();
1112
user$ = this.authFacade.user$;
13+
users = USERS;
1214

1315
constructor(private authFacade: AuthFacade) {}
1416
}

src/app/features/secured-feat/secured-feat.module.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@ import { CommonModule } from '@angular/common';
22
import { NgModule } from '@angular/core';
33
import { RouterModule, Routes } from '@angular/router';
44
import { ReactiveComponentModule } from '@ngrx/component';
5+
import { TuiNotificationModule } from '@taiga-ui/core';
6+
import { TuiBadgeModule } from '@taiga-ui/kit';
57

68
import { SecuredFeatComponent } from './secured-feat.component';
79

810
const routes: Routes = [{ path: '', component: SecuredFeatComponent }];
911

1012
@NgModule({
11-
imports: [CommonModule, ReactiveComponentModule, RouterModule.forChild(routes)],
13+
imports: [
14+
CommonModule,
15+
ReactiveComponentModule,
16+
TuiNotificationModule,
17+
TuiBadgeModule,
18+
RouterModule.forChild(routes),
19+
],
1220
declarations: [SecuredFeatComponent],
1321
})
1422
export class SecuredFeatModule {}

0 commit comments

Comments
 (0)