@tech4good/angular-schematics 20.2.0 → 20.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/publish-npm/SKILL.md +2 -0
- package/.agents/skills/publish-npm/eval.yaml +1 -1
- package/.t4g/agent-memory.db +0 -0
- package/CHANGELOG.md +44 -0
- package/README.md +16 -7
- package/package.json +1 -1
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.scss.template +1 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +1 -1
- package/src/ng-add/files/.gitignore.template +3 -0
- package/src/ng-add/files/package.json.template +3 -2
- package/src/ng-add/files/public/images/abstract.png +0 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.html.template +27 -22
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.scss.template +35 -4
- package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.ts.template +31 -75
- package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.html.template +25 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.scss.template +67 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.ts.template +74 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.animations.ts.template +4 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.component.html.template +4 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.component.scss.template +22 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.component.spec.ts.template +37 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-count-pill/admin-count-pill.component.ts.template +36 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.animations.ts.template +4 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.html.template +11 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.scss.template +22 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.spec.ts.template +37 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.ts.template +47 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.html.template +52 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.scss.template +66 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.ts.template +220 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.animations.ts.template +4 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.html.template +81 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.scss.template +136 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.spec.ts.template +37 -0
- package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.ts.template +118 -0
- package/src/ng-add/files/src/app/app.component.html.template +2 -0
- package/src/ng-add/files/src/app/app.component.ts.template +2 -0
- package/src/ng-add/files/src/app/app.routes.ts.template +14 -18
- package/src/ng-add/files/src/app/core/auth/auth.service.ts.template +58 -0
- package/src/ng-add/files/src/app/core/auth/guards/admin-override.ts.template +9 -0
- package/src/ng-add/files/src/app/core/auth/guards/index.ts.template +11 -0
- package/src/ng-add/files/src/app/core/auth/guards/redirect-if-authenticated.guard.ts.template +42 -0
- package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.ts.template +39 -0
- package/src/ng-add/files/src/app/core/auth/guards/require-auth-and-consent.guard.ts.template +69 -0
- package/src/ng-add/files/src/app/core/auth/guards/require-auth.guard.ts.template +35 -0
- package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +1 -1
- package/src/ng-add/files/src/app/core/firebase/firebase.service.ts.template +7 -1
- package/src/ng-add/files/src/app/core/store/app.model.ts.template +1 -1
- package/src/ng-add/files/src/app/core/store/app.store.ts.template +71 -6
- package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +94 -53
- package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +5 -5
- package/src/ng-add/files/src/app/core/store/user/user.model.ts.template +5 -7
- package/src/ng-add/files/src/app/core/store/user-context/user-context.mock.ts.template +3 -5
- package/src/ng-add/files/src/app/core/store/user-context/user-context.model.ts.template +2 -5
- package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +4 -3
- package/src/ng-add/files/src/app/first-time/consent/consent.guard.ts.template +54 -0
- package/src/ng-add/files/src/app/first-time/early-access/early-access.animations.ts.template +6 -0
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.html.template +70 -52
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.scss.template +73 -6
- package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +59 -111
- package/src/ng-add/files/src/app/first-time/early-access/early-access.guard.ts.template +44 -0
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.animations.ts.template +15 -0
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.html.template +12 -0
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.scss.template +79 -0
- package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +20 -0
- package/src/ng-add/files/src/app/first-time/landing/landing.component.html.template +1 -1
- package/src/ng-add/files/src/app/first-time/landing/landing.component.scss.template +11 -8
- package/src/ng-add/files/src/app/first-time/landing/landing.component.ts.template +2 -0
- package/src/ng-add/files/src/app/first-time/landing/rotating-quotes/rotating-quotes.component.html.template +3 -0
- package/src/ng-add/files/src/app/first-time/landing/rotating-quotes/rotating-quotes.component.scss.template +26 -0
- package/src/ng-add/files/src/app/first-time/landing/rotating-quotes/rotating-quotes.component.ts.template +52 -0
- package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.html.template +21 -0
- package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.scss.template +71 -0
- package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.ts.template +70 -0
- package/src/ng-add/files/src/app/shared/hint-visibility/hint-visibility.directive.ts.template +131 -0
- package/src/ng-add/files/src/app/shared/navbar/navbar.component.html.template +1 -1
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +1 -1
- package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +2 -2
- package/src/ng-add/files/src/environments/environment.ts.template +1 -1
- package/src/ng-add/files/src/index.html.template +3 -2
- package/src/ng-add/files/src/styles/_variables.scss.template +1 -0
- package/src/ng-add/files/src/styles.scss.template +4 -2
- package/src/ng-add/files/src/app/core/auth/auth.guard.ts.template +0 -96
|
@@ -29,7 +29,9 @@ This skill assists with the process of publishing a new version of the `@tech4go
|
|
|
29
29
|
```bash
|
|
30
30
|
npm run release:<type>
|
|
31
31
|
npm run build
|
|
32
|
+
npm login
|
|
32
33
|
npm publish
|
|
33
34
|
```
|
|
34
35
|
*(Replace `<type>` with the agreed-upon bump type: `patch`, `minor`, or `major`)*.
|
|
35
36
|
3. Remind them that `npm run release:<type>` will automatically bump the root `package.json`, update the `CHANGELOG.md`, stage the files, and create a new git tag.
|
|
37
|
+
4. Remind the user they must have access to the `@tech4good` organization to publish successfully.
|
|
@@ -13,5 +13,5 @@ tasks:
|
|
|
13
13
|
Did the agent correctly recommend a version bump type and wait for user approval?
|
|
14
14
|
Did the agent correctly update the "@tech4good/angular-schematics" dependency version in "src/ng-add/files/package.json.template" while preserving the semver prefix?
|
|
15
15
|
Did the agent trigger the git-commit skill to commit the template update?
|
|
16
|
-
Did the agent provide the final npm run release, build, and publish commands?
|
|
16
|
+
Did the agent provide the final npm run release, build, npm login, and npm publish commands?
|
|
17
17
|
weight: 1.0
|
|
Binary file
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
## [20.3.0](https://github.com/tech4good-lab/angular-schematics/compare/v20.2.0...v20.3.0) (2026-05-26)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* clarify npm publish and login commands in workflow ([04c406f](https://github.com/tech4good-lab/angular-schematics/commit/04c406f4acb8aa1881b9b6d6340eab01ca65db37))
|
|
6
|
+
* **component:** restructure early-access survey and update models ([318f9dc](https://github.com/tech4good-lab/angular-schematics/commit/318f9dcdfe51fc80add84b75ed833777df5d70c3))
|
|
7
|
+
* **landing:** implement hero and rotating quotes components ([3fc4b53](https://github.com/tech4good-lab/angular-schematics/commit/3fc4b5390d2e8dda3908799e6b8c9e2959f093de))
|
|
8
|
+
* **ng-add, entity:** add local storage persistence for mockdb ([ca4383e](https://github.com/tech4good-lab/angular-schematics/commit/ca4383eb124a89e2100e194969a81dd2968a08f2))
|
|
9
|
+
* **ng-add:** add admin override notification bar and split admin panel into tabs ([2b639d8](https://github.com/tech4good-lab/angular-schematics/commit/2b639d8b4deefa2ff74540e7f6a0adc9d6fc7187))
|
|
10
|
+
* **ng-add:** add code-check script to package.json template ([f1506f8](https://github.com/tech4good-lab/angular-schematics/commit/f1506f8ddb5dc4ba68306fa61c12154b779656b8))
|
|
11
|
+
* **ng-add:** split waitlist and active users into separate responsive tables ([ea98e24](https://github.com/tech4good-lab/angular-schematics/commit/ea98e246521b6de7c4be7e99e37282e1bbfa4fb1))
|
|
12
|
+
* **ng-add:** support multiple orderBy conditions in firestore queries ([32225ea](https://github.com/tech4good-lab/angular-schematics/commit/32225eace0ca41cdcb81994fd1dad98d2ea23c21))
|
|
13
|
+
* **ng-add:** unify dev status bar and admin deep-linking ([4794b0c](https://github.com/tech4good-lab/angular-schematics/commit/4794b0c87080d5677b98a016f016b23a069da5f6))
|
|
14
|
+
* **styles:** apply base typography and theme variables ([dcc3e05](https://github.com/tech4good-lab/angular-schematics/commit/dcc3e0526a6c3a6aa07a37ff0656836f13e61307))
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **auth:** fix profile image rendering and reorder signup flow ([feb7e8d](https://github.com/tech4good-lab/angular-schematics/commit/feb7e8d39c2afc384f4b6a2201df2e458c3db89a))
|
|
19
|
+
* **ng-add:** add reactive redirect and lower survey threshold in early-access ([1a19cbe](https://github.com/tech4good-lab/angular-schematics/commit/1a19cbe541313b67425b7ee325937284d56b3633))
|
|
20
|
+
* **ng-add:** ensure deterministic mock photo URLs to prevent caching issues ([3169e02](https://github.com/tech4good-lab/angular-schematics/commit/3169e0287238a4d82d8e3698a964a91c04235a91))
|
|
21
|
+
* **ng-add:** resolve async race condition in route guards ([7d0a244](https://github.com/tech4good-lab/angular-schematics/commit/7d0a2445808920b067b870d4057c85e940df2ee3))
|
|
22
|
+
* resolve missing user document creation in AuthStore template ([904bb74](https://github.com/tech4good-lab/angular-schematics/commit/904bb74567b6079a83ef0b4c643b9f44576882a6))
|
|
23
|
+
|
|
24
|
+
### Code Refactoring
|
|
25
|
+
|
|
26
|
+
* **auth:** remove insecure client-side token storage from schematics ([db1c995](https://github.com/tech4good-lab/angular-schematics/commit/db1c99508a963227ae64da1a60f8a195c7bf888e))
|
|
27
|
+
* **core:** extract route guards logic and fix admin overrides ([feae4fc](https://github.com/tech4good-lab/angular-schematics/commit/feae4fcebd8cbd88f4a465e0b72f519eac837b3d))
|
|
28
|
+
* **core:** remove unused imports in redeployment warning component and service ([114147c](https://github.com/tech4good-lab/angular-schematics/commit/114147c83dadb4cd9c7c28af422f94b11abc1893))
|
|
29
|
+
* **ng-add:** extract user table and counts into separate components ([2161168](https://github.com/tech4good-lab/angular-schematics/commit/2161168015e5f7980d875091576559ef0e029ec3))
|
|
30
|
+
* **ng-add:** replace class-based AuthGuard with functional guards ([2cfe25b](https://github.com/tech4good-lab/angular-schematics/commit/2cfe25bdfa3671c8f27e5fa6cc51953df4d29f96))
|
|
31
|
+
|
|
32
|
+
### Tests
|
|
33
|
+
|
|
34
|
+
* update mock user data and component template styling ([ffc3ad8](https://github.com/tech4good-lab/angular-schematics/commit/ffc3ad83a530a57423403343086c3380269633b5))
|
|
35
|
+
|
|
36
|
+
### Build System
|
|
37
|
+
|
|
38
|
+
* **ng-add:** add .t4g/ to gitignore ([f1433b2](https://github.com/tech4good-lab/angular-schematics/commit/f1433b21d1c99d4188ad271d244c55815a7c884a))
|
|
39
|
+
* **ng-add:** bump template dependency for release ([d793d8f](https://github.com/tech4good-lab/angular-schematics/commit/d793d8fb81cf8ba4c0e3e0999a9882f2288adc92))
|
|
40
|
+
|
|
41
|
+
### Chores
|
|
42
|
+
|
|
43
|
+
* **ng-add:** add .t4g to gitignore ([567bf3d](https://github.com/tech4good-lab/angular-schematics/commit/567bf3dfe21a9d9c6a11cb1c6c074320b06cf3bc))
|
|
44
|
+
* **ng-add:** enable mockdb by default in dev environment ([8c512e0](https://github.com/tech4good-lab/angular-schematics/commit/8c512e03cb81b371c84728019d588e9f69de9efd))
|
|
1
45
|
## [20.2.0](https://github.com/tech4good-lab/angular-schematics/compare/v20.1.0...v20.2.0) (2026-05-08)
|
|
2
46
|
|
|
3
47
|
### Features
|
package/README.md
CHANGED
|
@@ -36,14 +36,23 @@ ng generate @tech4good/angular-schematics:<schematic>
|
|
|
36
36
|
|
|
37
37
|
### Publishing
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
**Option 1: Agent-Assisted Workflow (Recommended)**
|
|
40
|
+
|
|
41
|
+
You can trigger the `publish-npm` skill via your agent assistant, which will guide you through calculating the version bump, updating the internal template, and committing the changes. Once the agent is done, run the final commands below.
|
|
42
|
+
|
|
43
|
+
**Option 2: Manual Workflow**
|
|
44
|
+
|
|
45
|
+
1. Determine the appropriate version bump (`patch`, `minor`, or `major`) by analyzing recent git commits.
|
|
46
|
+
2. Update the `@tech4good/angular-schematics` dependency version in `src/ng-add/files/package.json.template` to match the upcoming version.
|
|
47
|
+
3. Commit the template update to git (e.g., `build(ng-add): bump template dependency for release`).
|
|
48
|
+
|
|
49
|
+
**Final Release Commands**
|
|
50
|
+
|
|
51
|
+
Whether using the agent or doing it manually, run the following commands in your local terminal to complete the release:
|
|
40
52
|
|
|
41
53
|
```bash
|
|
54
|
+
npm run release:<type> # E.g., patch, minor, or major
|
|
42
55
|
npm run build
|
|
56
|
+
npm login
|
|
43
57
|
npm publish # will ask for a OTP (see Google Authenticator: npm)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
That's it!
|
|
47
|
-
|
|
48
|
-
You can also use `npm version <version>` to update the version before publishing.
|
|
49
|
-
* Don't forget to also update `src/ng-add/files/package.json.template` so that the latest version of `@tech4good/anguar-schematics` is being used in the dependencies.
|
|
58
|
+
```
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { signalStore } from '@ngrx/signals';
|
|
|
5
5
|
|
|
6
6
|
export const <%= classify(name) %>MockDB = signalStore(
|
|
7
7
|
{ providedIn: 'root' },
|
|
8
|
-
withEntitiesForMockDB<<%= classify(name) %>>(),
|
|
8
|
+
withEntitiesForMockDB<<%= classify(name) %>>('<%= camelize(name) %>s'),
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
export const <%= classify(name).toUpperCase() %>_DB = [
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"test:watch": "jest --watch",
|
|
12
12
|
"test:coverage": "jest --coverage",
|
|
13
13
|
"lint": "ng lint",
|
|
14
|
-
"lintfix": "ng lint --fix"
|
|
14
|
+
"lintfix": "ng lint --fix",
|
|
15
|
+
"code-check": "ngc --noEmit && sass src:dist/css-check --no-source-map && rm -rf dist/css-check && npm run lintfix"
|
|
15
16
|
},
|
|
16
17
|
"private": true,
|
|
17
18
|
"dependencies": {
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"@angular/cli": "^20.3.2",
|
|
49
50
|
"@angular/compiler-cli": "^20.3.0",
|
|
50
51
|
"@ngx-env/builder": "^20.1.1",
|
|
51
|
-
"@tech4good/angular-schematics": "^20.
|
|
52
|
+
"@tech4good/angular-schematics": "^20.3.0",
|
|
52
53
|
"@types/estree": "^1.0.0",
|
|
53
54
|
"@types/jest": "^29.5.14",
|
|
54
55
|
"@types/node": "^18.19.47",
|
|
Binary file
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
<div class="admin-panel-container">
|
|
2
|
-
|
|
2
|
+
<!-- Tab Navigation -->
|
|
3
|
+
<div class="tab-bar">
|
|
4
|
+
<button
|
|
5
|
+
class="tab-button"
|
|
6
|
+
[class.active]="activeTab() === 'users'"
|
|
7
|
+
(click)="setTab('users')"
|
|
8
|
+
>
|
|
9
|
+
<mat-icon>people</mat-icon>
|
|
10
|
+
<span>Users</span>
|
|
11
|
+
</button>
|
|
12
|
+
<button
|
|
13
|
+
class="tab-button"
|
|
14
|
+
[class.active]="activeTab() === 'settings'"
|
|
15
|
+
(click)="setTab('settings')"
|
|
16
|
+
>
|
|
17
|
+
<mat-icon>settings</mat-icon>
|
|
18
|
+
<span>Settings</span>
|
|
19
|
+
</button>
|
|
20
|
+
</div>
|
|
3
21
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<th mat-header-cell *matHeaderCellDef> Access State </th>
|
|
13
|
-
<td mat-cell *matCellDef="let user">
|
|
14
|
-
<span class="update-btn" [matMenuTriggerFor]="accessStateMenu" aria-label="accessState">{{ user.accessState }}</span>
|
|
15
|
-
<mat-menu #accessStateMenu="matMenu">
|
|
16
|
-
<button mat-menu-item (click)="updateState(user, 'accessState', option)" *ngFor="let option of accessOptions">{{ option }}</button>
|
|
17
|
-
</mat-menu>
|
|
18
|
-
</td>
|
|
19
|
-
</ng-container>
|
|
20
|
-
|
|
21
|
-
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
|
|
22
|
-
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
23
|
-
</table>
|
|
24
|
-
</div>
|
|
22
|
+
<!-- Tab Content -->
|
|
23
|
+
@if (activeTab() === 'users') {
|
|
24
|
+
<app-admin-user-list></app-admin-user-list>
|
|
25
|
+
}
|
|
26
|
+
@if (activeTab() === 'settings') {
|
|
27
|
+
<app-admin-settings></app-admin-settings>
|
|
28
|
+
}
|
|
29
|
+
</div>
|
|
@@ -1,14 +1,45 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
|
+
|
|
3
4
|
.admin-panel-container {
|
|
4
5
|
width: 100%;
|
|
6
|
+
padding: 8px 24px;
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
.tab-bar {
|
|
9
|
+
display: flex;
|
|
10
|
+
gap: 4px;
|
|
11
|
+
margin-bottom: 24px;
|
|
12
|
+
border-bottom: 1px solid #e0e0e0;
|
|
8
13
|
|
|
9
|
-
.
|
|
14
|
+
.tab-button {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 6px;
|
|
18
|
+
padding: 10px 20px;
|
|
19
|
+
border: none;
|
|
20
|
+
background: none;
|
|
10
21
|
cursor: pointer;
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
color: #666;
|
|
25
|
+
border-bottom: 2px solid transparent;
|
|
26
|
+
transition: color 0.2s ease, border-color 0.2s ease;
|
|
27
|
+
|
|
28
|
+
mat-icon {
|
|
29
|
+
font-size: 20px;
|
|
30
|
+
width: 20px;
|
|
31
|
+
height: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
color: #333;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.active {
|
|
39
|
+
color: #1976d2;
|
|
40
|
+
border-bottom-color: #1976d2;
|
|
41
|
+
}
|
|
11
42
|
}
|
|
12
43
|
}
|
|
13
44
|
}
|
|
14
|
-
}
|
|
45
|
+
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, ChangeDetectionStrategy, inject, input, linkedSignal } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
2
3
|
import { AdminPanelAnimations } from './admin-panel.animations';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
7
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
8
|
-
import { NgFor } from '@angular/common';
|
|
9
|
-
import { MatMenuTrigger, MatMenu, MatMenuItem } from '@angular/material/menu';
|
|
10
|
-
import { MatTable, MatColumnDef, MatHeaderCellDef, MatHeaderCell, MatCellDef, MatCell, MatHeaderRowDef, MatHeaderRow, MatRowDef, MatRow } from '@angular/material/table';
|
|
11
|
-
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
4
|
+
import { MatIcon } from '@angular/material/icon';
|
|
5
|
+
import { AdminUserListComponent } from './admin-user-list/admin-user-list.component';
|
|
6
|
+
import { AdminSettingsComponent } from './admin-settings/admin-settings.component';
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
type
|
|
8
|
+
/** The available tabs in the admin panel. */
|
|
9
|
+
type AdminTab = 'users' | 'settings';
|
|
15
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Parent admin panel component that provides tab-based navigation
|
|
13
|
+
* between the user management list and admin settings.
|
|
14
|
+
*/
|
|
16
15
|
@Component({
|
|
17
16
|
selector: 'app-admin-panel',
|
|
18
17
|
templateUrl: './admin-panel.component.html',
|
|
@@ -20,79 +19,36 @@ type UpdateValueTypes = AccessState;
|
|
|
20
19
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
20
|
animations: AdminPanelAnimations,
|
|
22
21
|
imports: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
MatHeaderCell,
|
|
27
|
-
MatCellDef,
|
|
28
|
-
MatCell,
|
|
29
|
-
MatMenuTrigger,
|
|
30
|
-
MatMenu,
|
|
31
|
-
NgFor,
|
|
32
|
-
MatMenuItem,
|
|
33
|
-
MatHeaderRowDef,
|
|
34
|
-
MatHeaderRow,
|
|
35
|
-
MatRowDef,
|
|
36
|
-
MatRow,
|
|
22
|
+
MatIcon,
|
|
23
|
+
AdminUserListComponent,
|
|
24
|
+
AdminSettingsComponent,
|
|
37
25
|
],
|
|
38
26
|
})
|
|
39
|
-
export class AdminPanelComponent
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
27
|
+
export class AdminPanelComponent {
|
|
28
|
+
private readonly route = inject(ActivatedRoute);
|
|
29
|
+
private readonly router = inject(Router);
|
|
42
30
|
|
|
43
31
|
// --------------- INPUTS AND OUTPUTS ------------------
|
|
44
32
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/** Access options for menu sorted alphabetically. */
|
|
48
|
-
accessOptions: AccessState[] = Object.keys(AccessState)
|
|
49
|
-
.map((k) => AccessState[k] as AccessState)
|
|
50
|
-
.sort((a, b) => {
|
|
51
|
-
if (a > b) {
|
|
52
|
-
return 1;
|
|
53
|
-
} else if (a < b) {
|
|
54
|
-
return -1;
|
|
55
|
-
} else {
|
|
56
|
-
return 0;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
/** Columns to display in the table */
|
|
61
|
-
displayedColumns = ['userName', 'accessState'];
|
|
33
|
+
/** The tab query parameter. */
|
|
34
|
+
tab = input<AdminTab>();
|
|
62
35
|
|
|
63
36
|
// --------------- COMPUTED DATA -----------------------
|
|
64
37
|
|
|
65
|
-
/**
|
|
66
|
-
|
|
38
|
+
/** The currently active tab. */
|
|
39
|
+
activeTab = linkedSignal<AdminTab>(() => {
|
|
40
|
+
const tabParam = this.tab();
|
|
41
|
+
return (tabParam === 'settings' || tabParam === 'users') ? tabParam : 'users';
|
|
42
|
+
});
|
|
67
43
|
|
|
68
44
|
// --------------- EVENT HANDLING ----------------------
|
|
69
45
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.snackBar.open(`Set ${user.name}'s ${key} to ${value}`, '', { duration: 3000 });
|
|
78
|
-
} catch (e) {
|
|
79
|
-
console.error(e);
|
|
80
|
-
this.snackBar.open('Failed to submit response', '', { duration: 3000 });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// --------------- OTHER -------------------------------
|
|
85
|
-
|
|
86
|
-
constructor(
|
|
87
|
-
private snackBar: MatSnackBar,
|
|
88
|
-
private injector: Injector,
|
|
89
|
-
@Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
|
|
90
|
-
) {
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// --------------- LOAD AND CLEANUP --------------------
|
|
94
|
-
|
|
95
|
-
ngOnInit() {
|
|
96
|
-
this.userStore.load([], {});
|
|
46
|
+
setTab(tab: AdminTab) {
|
|
47
|
+
this.activeTab.set(tab);
|
|
48
|
+
this.router.navigate([], {
|
|
49
|
+
relativeTo: this.route,
|
|
50
|
+
queryParams: { tab },
|
|
51
|
+
queryParamsHandling: 'merge',
|
|
52
|
+
});
|
|
97
53
|
}
|
|
98
54
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<div class="settings-container">
|
|
2
|
+
<div class="override-section">
|
|
3
|
+
<h3>Route Override</h3>
|
|
4
|
+
<p class="override-description">
|
|
5
|
+
Toggle routes to bypass auth guards. When a route is enabled, you can
|
|
6
|
+
view that page regardless of your access state. An orange notification
|
|
7
|
+
bar will appear when you're browsing with overridden permissions.
|
|
8
|
+
</p>
|
|
9
|
+
<div class="override-routes">
|
|
10
|
+
@for (route of availableOverrideRoutes; track route.path) {
|
|
11
|
+
<div class="override-route-item">
|
|
12
|
+
<mat-icon
|
|
13
|
+
class="override-toggle"
|
|
14
|
+
[class.active]="isRouteOverridden(route.path)"
|
|
15
|
+
(click)="toggleOverridePath(route.path)"
|
|
16
|
+
>
|
|
17
|
+
{{ isRouteOverridden(route.path) ? 'toggle_on' : 'toggle_off' }}
|
|
18
|
+
</mat-icon>
|
|
19
|
+
<span class="route-path">{{ route.path }}</span>
|
|
20
|
+
<span class="route-label">{{ route.label }}</span>
|
|
21
|
+
</div>
|
|
22
|
+
}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
|
|
4
|
+
.settings-container {
|
|
5
|
+
.override-section {
|
|
6
|
+
padding: 20px;
|
|
7
|
+
border: 1px solid #e0e0e0;
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
background: #fafafa;
|
|
10
|
+
|
|
11
|
+
h3 {
|
|
12
|
+
margin: 0 0 8px 0;
|
|
13
|
+
font-size: 16px;
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
color: #333;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.override-description {
|
|
19
|
+
margin: 0 0 16px 0;
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
color: #666;
|
|
22
|
+
line-height: 1.4;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.override-routes {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: 8px;
|
|
29
|
+
|
|
30
|
+
.override-route-item {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 12px;
|
|
34
|
+
padding: 8px 12px;
|
|
35
|
+
border-radius: 6px;
|
|
36
|
+
background: #fff;
|
|
37
|
+
border: 1px solid #e0e0e0;
|
|
38
|
+
|
|
39
|
+
.override-toggle {
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
font-size: 28px;
|
|
42
|
+
width: 28px;
|
|
43
|
+
height: 28px;
|
|
44
|
+
color: #999;
|
|
45
|
+
transition: color 0.2s ease;
|
|
46
|
+
|
|
47
|
+
&.active {
|
|
48
|
+
color: #f57c00;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.route-path {
|
|
53
|
+
font-family: monospace;
|
|
54
|
+
font-size: 13px;
|
|
55
|
+
color: #333;
|
|
56
|
+
min-width: 120px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.route-label {
|
|
60
|
+
font-size: 13px;
|
|
61
|
+
color: #888;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, inject } from '@angular/core';
|
|
2
|
+
import { AuthStore } from '../../../core/store/auth/auth.store';
|
|
3
|
+
import { UserStore } from '../../../core/store/user/user.store';
|
|
4
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
5
|
+
import { MatIcon } from '@angular/material/icon';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Admin settings panel for managing route override permissions.
|
|
9
|
+
* Allows the current admin to toggle which routes bypass auth guards,
|
|
10
|
+
* enabling them to view pages as if they were at a different access state.
|
|
11
|
+
*/
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'app-admin-settings',
|
|
14
|
+
templateUrl: './admin-settings.component.html',
|
|
15
|
+
styleUrls: ['./admin-settings.component.scss'],
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
+
imports: [MatIcon],
|
|
18
|
+
})
|
|
19
|
+
export class AdminSettingsComponent {
|
|
20
|
+
readonly authStore = inject(AuthStore);
|
|
21
|
+
private readonly userStore = inject(UserStore);
|
|
22
|
+
|
|
23
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Routes available for admin override. These are the guarded routes
|
|
27
|
+
* that an admin might want to view regardless of their access state.
|
|
28
|
+
*/
|
|
29
|
+
readonly availableOverrideRoutes = [
|
|
30
|
+
{ path: '/early-access', label: 'Waitlist / Early Access' },
|
|
31
|
+
{ path: '/consent', label: 'Consent Form' },
|
|
32
|
+
{ path: '/onboarding', label: 'Onboarding' },
|
|
33
|
+
{ path: '/home', label: 'Home' },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
// --------------- ROUTE OVERRIDE MANAGEMENT -----------
|
|
37
|
+
|
|
38
|
+
/** Returns whether the given route path is in the current admin's override list. */
|
|
39
|
+
isRouteOverridden(path: string): boolean {
|
|
40
|
+
const user = this.authStore.user();
|
|
41
|
+
return user?.adminOverridePaths?.includes(path) ?? false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Toggles a route path in the current admin's `adminOverridePaths`.
|
|
46
|
+
* Adds it if not present, removes it if already present.
|
|
47
|
+
* Updates both the AuthStore and Firestore.
|
|
48
|
+
*/
|
|
49
|
+
async toggleOverridePath(path: string) {
|
|
50
|
+
const user = this.authStore.user();
|
|
51
|
+
if (!user) return;
|
|
52
|
+
|
|
53
|
+
const current = user.adminOverridePaths ?? [];
|
|
54
|
+
const updated = current.includes(path) ?
|
|
55
|
+
current.filter((p) => p !== path) :
|
|
56
|
+
[...current, path];
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
await this.userStore.update(user.__id, { adminOverridePaths: updated });
|
|
60
|
+
const action = updated.includes(path) ? 'Enabled' : 'Disabled';
|
|
61
|
+
this.snackBar.open(`${action} override for ${path}`, '', { duration: 3000 });
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.error(e);
|
|
64
|
+
this.snackBar.open('Failed to update route override', '', { duration: 3000 });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// --------------- OTHER -------------------------------
|
|
69
|
+
|
|
70
|
+
constructor(
|
|
71
|
+
private snackBar: MatSnackBar,
|
|
72
|
+
) {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.count-item {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 6px;
|
|
9
|
+
background: #f5f5f5;
|
|
10
|
+
padding: 6px 12px;
|
|
11
|
+
border-radius: 6px;
|
|
12
|
+
font-size: 13px;
|
|
13
|
+
|
|
14
|
+
.label {
|
|
15
|
+
color: #666;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.value {
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
color: #1976d2;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { render } from '@testing-library/angular';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
|
|
4
|
+
import { AdminCountPillComponent } from './admin-count-pill.component';
|
|
5
|
+
import { DATABASE_SERVICE } from 'src/app/core/firebase/database.service';
|
|
6
|
+
import { FirebaseMockService } from 'src/app/core/firebase/firebase.mock.service';
|
|
7
|
+
import { BatchWriteMockService } from 'src/app/core/store/batch-write.mock.service';
|
|
8
|
+
import { BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
9
|
+
|
|
10
|
+
/** Sets up the testing environment for AdminCountPillComponent using render.*/
|
|
11
|
+
async function setup() {
|
|
12
|
+
const user = userEvent.setup();
|
|
13
|
+
const checkedSpy = jest.fn();
|
|
14
|
+
|
|
15
|
+
const view = await render(AdminCountPillComponent, {
|
|
16
|
+
imports: [],
|
|
17
|
+
providers: [
|
|
18
|
+
{ provide: DATABASE_SERVICE, useClass: FirebaseMockService },
|
|
19
|
+
{ provide: BATCH_WRITE_SERVICE, useClass: BatchWriteMockService },
|
|
20
|
+
],
|
|
21
|
+
componentInputs: {},
|
|
22
|
+
on: {},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
user,
|
|
27
|
+
fixture: view.fixture,
|
|
28
|
+
rerender: () => view.rerender(), // add component inputs if needed
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe('AdminCountPillComponent', () => {
|
|
33
|
+
it('should create', async () => {
|
|
34
|
+
const { fixture } = await setup();
|
|
35
|
+
expect(fixture.componentInstance).toBeTruthy();
|
|
36
|
+
});
|
|
37
|
+
});
|