@tech4good/angular-schematics 20.2.0 → 20.3.1

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.
Files changed (86) hide show
  1. package/.agents/skills/publish-npm/SKILL.md +2 -0
  2. package/.agents/skills/publish-npm/eval.yaml +1 -1
  3. package/.husky/commit-msg +1 -0
  4. package/.husky/pre-commit +1 -0
  5. package/.t4g/agent-memory.db +0 -0
  6. package/CHANGELOG.md +56 -0
  7. package/README.md +16 -7
  8. package/commitlint.config.js +15 -0
  9. package/package.json +6 -2
  10. package/src/component/files/__name@dasherize__/__name@dasherize__.component.scss.template +1 -0
  11. package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +1 -1
  12. package/src/ng-add/files/.gitignore.template +3 -0
  13. package/src/ng-add/files/package.json.template +3 -2
  14. package/src/ng-add/files/public/images/abstract.png +0 -0
  15. package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.html.template +27 -22
  16. package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.scss.template +35 -4
  17. package/src/ng-add/files/src/app/admin/admin-panel/admin-panel.component.ts.template +31 -75
  18. package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.html.template +25 -0
  19. package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.scss.template +67 -0
  20. package/src/ng-add/files/src/app/admin/admin-panel/admin-settings/admin-settings.component.ts.template +74 -0
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.animations.ts.template +4 -0
  27. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.html.template +11 -0
  28. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.scss.template +22 -0
  29. 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
  30. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-counts/admin-user-counts.component.ts.template +47 -0
  31. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.html.template +52 -0
  32. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.scss.template +66 -0
  33. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-list.component.ts.template +220 -0
  34. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.animations.ts.template +4 -0
  35. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.html.template +81 -0
  36. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.scss.template +136 -0
  37. 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
  38. package/src/ng-add/files/src/app/admin/admin-panel/admin-user-list/admin-user-table/admin-user-table.component.ts.template +118 -0
  39. package/src/ng-add/files/src/app/app.component.html.template +2 -0
  40. package/src/ng-add/files/src/app/app.component.ts.template +2 -0
  41. package/src/ng-add/files/src/app/app.routes.ts.template +14 -18
  42. package/src/ng-add/files/src/app/core/auth/auth.service.ts.template +58 -0
  43. package/src/ng-add/files/src/app/core/auth/guards/admin-override.ts.template +9 -0
  44. package/src/ng-add/files/src/app/core/auth/guards/index.ts.template +11 -0
  45. package/src/ng-add/files/src/app/core/auth/guards/redirect-if-authenticated.guard.ts.template +42 -0
  46. package/src/ng-add/files/src/app/core/auth/guards/require-admin.guard.ts.template +39 -0
  47. package/src/ng-add/files/src/app/core/auth/guards/require-auth-and-consent.guard.ts.template +69 -0
  48. package/src/ng-add/files/src/app/core/auth/guards/require-auth.guard.ts.template +35 -0
  49. package/src/ng-add/files/src/app/core/firebase/firebase.mock.service.ts.template +1 -1
  50. package/src/ng-add/files/src/app/core/firebase/firebase.service.ts.template +7 -1
  51. package/src/ng-add/files/src/app/core/store/app.model.ts.template +1 -1
  52. package/src/ng-add/files/src/app/core/store/app.store.ts.template +71 -6
  53. package/src/ng-add/files/src/app/core/store/auth/auth.store.ts.template +94 -53
  54. package/src/ng-add/files/src/app/core/store/user/user.mock.ts.template +5 -5
  55. package/src/ng-add/files/src/app/core/store/user/user.model.ts.template +5 -7
  56. package/src/ng-add/files/src/app/core/store/user-context/user-context.mock.ts.template +3 -5
  57. package/src/ng-add/files/src/app/core/store/user-context/user-context.model.ts.template +2 -5
  58. package/src/ng-add/files/src/app/first-time/consent/consent.component.ts.template +4 -3
  59. package/src/ng-add/files/src/app/first-time/consent/consent.guard.ts.template +54 -0
  60. package/src/ng-add/files/src/app/first-time/early-access/early-access.animations.ts.template +6 -0
  61. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.html.template +70 -52
  62. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.scss.template +73 -6
  63. package/src/ng-add/files/src/app/first-time/early-access/early-access.component.ts.template +59 -111
  64. package/src/ng-add/files/src/app/first-time/early-access/early-access.guard.ts.template +44 -0
  65. package/src/ng-add/files/src/app/first-time/landing/hero/hero.animations.ts.template +15 -0
  66. package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.html.template +12 -0
  67. package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.scss.template +79 -0
  68. package/src/ng-add/files/src/app/first-time/landing/hero/hero.component.ts.template +20 -0
  69. package/src/ng-add/files/src/app/first-time/landing/landing.component.html.template +1 -1
  70. package/src/ng-add/files/src/app/first-time/landing/landing.component.scss.template +11 -8
  71. package/src/ng-add/files/src/app/first-time/landing/landing.component.ts.template +2 -0
  72. package/src/ng-add/files/src/app/first-time/landing/rotating-quotes/rotating-quotes.component.html.template +3 -0
  73. package/src/ng-add/files/src/app/first-time/landing/rotating-quotes/rotating-quotes.component.scss.template +26 -0
  74. package/src/ng-add/files/src/app/first-time/landing/rotating-quotes/rotating-quotes.component.ts.template +52 -0
  75. package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.html.template +21 -0
  76. package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.scss.template +71 -0
  77. package/src/ng-add/files/src/app/shared/dev-status-bar/dev-status-bar.component.ts.template +70 -0
  78. package/src/ng-add/files/src/app/shared/hint-visibility/hint-visibility.directive.ts.template +131 -0
  79. package/src/ng-add/files/src/app/shared/navbar/navbar.component.html.template +1 -1
  80. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.component.ts.template +1 -1
  81. package/src/ng-add/files/src/app/shared/redeployment-warning/redeployment-warning.service.ts.template +2 -2
  82. package/src/ng-add/files/src/environments/environment.ts.template +1 -1
  83. package/src/ng-add/files/src/index.html.template +3 -2
  84. package/src/ng-add/files/src/styles/_variables.scss.template +1 -0
  85. package/src/ng-add/files/src/styles.scss.template +4 -2
  86. 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
@@ -0,0 +1 @@
1
+ npx --no-install commitlint --edit "$1"
@@ -0,0 +1 @@
1
+
Binary file
package/CHANGELOG.md CHANGED
@@ -1,3 +1,59 @@
1
+ ## [20.3.1](https://github.com/tech4good-lab/angular-schematics/compare/v20.1.0...v20.3.1) (2026-05-26)
2
+
3
+ ### Features
4
+
5
+ * add default true to interactive prompts ([22303ae](https://github.com/tech4good-lab/angular-schematics/commit/22303ae31d7f581c34da05307a3b0dd9913ff726))
6
+ * automate conventional commits and npm release workflow ([fb5af22](https://github.com/tech4good-lab/angular-schematics/commit/fb5af2264610e70e917968d0818c6381ee5114d2))
7
+ * clarify npm publish and login commands in workflow ([b1a1704](https://github.com/tech4good-lab/angular-schematics/commit/b1a1704aee53d361153d00bdd87c0d68e07c87e8))
8
+ * **ng-add, entity:** add local storage persistence for mockdb ([4284578](https://github.com/tech4good-lab/angular-schematics/commit/42845787c520dbb208f9e9dfbffda0064d05cab3))
9
+ * **ng-add:** add admin override notification bar and split admin panel into tabs ([fb9f844](https://github.com/tech4good-lab/angular-schematics/commit/fb9f844d41d87f62fb8a94ea43fe54fe564b4813))
10
+ * **ng-add:** add code-check script to package.json template ([19054e8](https://github.com/tech4good-lab/angular-schematics/commit/19054e826a45dbdaa0b3d6910c23692fa2ccd114))
11
+ * **ng-add:** apply base typography and theme variables ([77569f7](https://github.com/tech4good-lab/angular-schematics/commit/77569f74d8154c8b0754b94e9bb5e339a4d343f0))
12
+ * **ng-add:** implement hero and rotating quotes components ([c18c823](https://github.com/tech4good-lab/angular-schematics/commit/c18c823fda3d253be3773735ab7fd3f28f96cedd))
13
+ * **ng-add:** restructure early-access survey and update models ([e08edc6](https://github.com/tech4good-lab/angular-schematics/commit/e08edc6ef51746af49b4b5e44824e59f2bb536c3))
14
+ * **ng-add:** split waitlist and active users into separate responsive tables ([4727baa](https://github.com/tech4good-lab/angular-schematics/commit/4727baa367c6d7cb7db7bcbc99257ffef46447d9))
15
+ * **ng-add:** support multiple orderBy conditions in firestore queries ([a4d085c](https://github.com/tech4good-lab/angular-schematics/commit/a4d085cff632253e9bf43145593c741fd7e101a5))
16
+ * **ng-add:** unify dev status bar and admin deep-linking ([9044a35](https://github.com/tech4good-lab/angular-schematics/commit/9044a35a6004a56b6a4157b68e1c384a741e3126))
17
+
18
+ ### Bug Fixes
19
+
20
+ * **ng-add:** add reactive redirect and lower survey threshold in early-access ([5efbe91](https://github.com/tech4good-lab/angular-schematics/commit/5efbe912e69c413e6f09227163b6fe4633fed6d2))
21
+ * **ng-add:** ensure deterministic mock photo URLs to prevent caching issues ([1409261](https://github.com/tech4good-lab/angular-schematics/commit/1409261e2c42fe7f41be7c9c8f7dd561d01d9d60))
22
+ * **ng-add:** fix profile image rendering and reorder signup flow ([bda0eac](https://github.com/tech4good-lab/angular-schematics/commit/bda0eacdfcd643b11201854bfb5eeae5b124ee32))
23
+ * **ng-add:** remove undefined entitiesToModify2 and entitiesToRemove2 ([d1a8e0c](https://github.com/tech4good-lab/angular-schematics/commit/d1a8e0cff843829ce1227c29602f7f0720c548a5))
24
+ * **ng-add:** resolve async race condition in route guards ([0206bb9](https://github.com/tech4good-lab/angular-schematics/commit/0206bb9234739d4f60734a00f26cfe846ee1f0b8))
25
+ * require git-commit skill for template updates in publish-npm ([235802e](https://github.com/tech4good-lab/angular-schematics/commit/235802e71ba9b7c531cf430c5b5dff1d7c23463f))
26
+ * resolve missing user document creation in AuthStore template ([a4c5436](https://github.com/tech4good-lab/angular-schematics/commit/a4c5436e2964ecfae65ef18d01e9489b16af6646))
27
+
28
+ ### Documentation
29
+
30
+ * add repository-specific commit message guidelines ([62f14cf](https://github.com/tech4good-lab/angular-schematics/commit/62f14cf39c3d29a2f1956cb7e516fb3c6a4e74b0))
31
+ * update README ([5931736](https://github.com/tech4good-lab/angular-schematics/commit/5931736caad5698adbea4b9c36b5fa1aaffa3fc2))
32
+
33
+ ### Code Refactoring
34
+
35
+ * **ng-add:** extract route guards logic and fix admin overrides ([6e6410f](https://github.com/tech4good-lab/angular-schematics/commit/6e6410faa178c72150e3a0af6e8277612fa83e08))
36
+ * **ng-add:** extract user table and counts into separate components ([71f297e](https://github.com/tech4good-lab/angular-schematics/commit/71f297e49e8dfc29650799bdecbacb7ed97aaa32))
37
+ * **ng-add:** remove insecure client-side token storage from schematics ([1bb8c63](https://github.com/tech4good-lab/angular-schematics/commit/1bb8c63fa1d6c21bc2d05953c09f411620f55dc5))
38
+ * **ng-add:** remove unused imports in redeployment warning component and service ([8714205](https://github.com/tech4good-lab/angular-schematics/commit/871420508a55b36957471bf844610c4c5e28f8f5))
39
+ * **ng-add:** replace class-based AuthGuard with functional guards ([321b2a7](https://github.com/tech4good-lab/angular-schematics/commit/321b2a7981ccc8c64ce1a4574fc5f4dfd9e7fd99))
40
+
41
+ ### Tests
42
+
43
+ * update mock user data and component template styling ([dc6e0bd](https://github.com/tech4good-lab/angular-schematics/commit/dc6e0bd3f66403e11b26be46a7ff6dd431eec433))
44
+
45
+ ### Build System
46
+
47
+ * configure npm version lifecycle hooks and update docs ([a84b0e6](https://github.com/tech4good-lab/angular-schematics/commit/a84b0e6a1f482418e987a12b64552498e2febc2d))
48
+ * **ng-add:** add .t4g/ to gitignore ([e46e56b](https://github.com/tech4good-lab/angular-schematics/commit/e46e56b0cf35df932a9f4e2b15fb52adad07499f))
49
+ * **ng-add:** bump template dependency for release ([b844a80](https://github.com/tech4good-lab/angular-schematics/commit/b844a80668394dbb71cb550a5492220a189e7900))
50
+ * **ng-add:** bump template dependency for release ([2e6a46a](https://github.com/tech4good-lab/angular-schematics/commit/2e6a46adae121043fb01fd5ef9792c5d1dff05a9))
51
+ * **shared:** set up commitlint and husky for scope enforcement ([c804f74](https://github.com/tech4good-lab/angular-schematics/commit/c804f74bb91ac9bd36f3241986d3e6bc713e55fa))
52
+
53
+ ### Chores
54
+
55
+ * **ng-add:** add .t4g to gitignore ([0f0e2be](https://github.com/tech4good-lab/angular-schematics/commit/0f0e2bedf19ff0257333975c8ef58ffef94aecfa))
56
+ * **ng-add:** enable mockdb by default in dev environment ([50e828c](https://github.com/tech4good-lab/angular-schematics/commit/50e828cf8e2d7a5ba41f673ea5497202c61685bc))
1
57
  ## [20.2.0](https://github.com/tech4good-lab/angular-schematics/compare/v20.1.0...v20.2.0) (2026-05-08)
2
58
 
3
59
  ### Features
package/README.md CHANGED
@@ -36,14 +36,23 @@ ng generate @tech4good/angular-schematics:<schematic>
36
36
 
37
37
  ### Publishing
38
38
 
39
- To publish, simply do:
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
+ ```
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ 'scope-enum': [
5
+ 2,
6
+ 'always',
7
+ [
8
+ 'ng-add',
9
+ 'component',
10
+ 'entity',
11
+ 'shared'
12
+ ]
13
+ ]
14
+ }
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tech4good/angular-schematics",
3
- "version": "20.2.0",
3
+ "version": "20.3.1",
4
4
  "description": "A set of schematics for generating modules, containers, components, and entities",
5
5
  "scripts": {
6
6
  "build": "tsc -p tsconfig.json",
@@ -10,7 +10,8 @@
10
10
  "version": "npm run changelog && git add CHANGELOG.md",
11
11
  "release:patch": "npm version patch",
12
12
  "release:minor": "npm version minor",
13
- "release:major": "npm version major"
13
+ "release:major": "npm version major",
14
+ "prepare": "husky"
14
15
  },
15
16
  "keywords": [
16
17
  "schematics"
@@ -27,10 +28,13 @@
27
28
  "typescript": "~5.8.3"
28
29
  },
29
30
  "devDependencies": {
31
+ "@commitlint/cli": "^21.0.1",
32
+ "@commitlint/config-conventional": "^21.0.1",
30
33
  "@types/jasmine": "~5.1.0",
31
34
  "@types/node": "^18.19.47",
32
35
  "conventional-changelog-cli": "^5.0.0",
33
36
  "conventional-changelog-conventionalcommits": "^8.0.0",
37
+ "husky": "^9.1.7",
34
38
  "jasmine": "^5.1.0"
35
39
  }
36
40
  }
@@ -3,5 +3,6 @@
3
3
  .<%= dasherize(name) %>-container {
4
4
  // REMOVE WHEN FINISHING LAYOUT STYLES
5
5
  border: 1px solid black;
6
+ padding: 5px;
6
7
  }
7
8
  }
@@ -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 = [
@@ -55,3 +55,6 @@ Thumbs.db
55
55
 
56
56
  # .env
57
57
  .env
58
+
59
+ # t4g skills data
60
+ .t4g
@@ -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.2.0",
52
+ "@tech4good/angular-schematics": "^20.3.1",
52
53
  "@types/estree": "^1.0.0",
53
54
  "@types/jest": "^29.5.14",
54
55
  "@types/node": "^18.19.47",
@@ -1,24 +1,29 @@
1
1
  <div class="admin-panel-container">
2
- <table id="waitlist-table" mat-table [dataSource]="waitingUsers()" class="mat-elevation-z8">
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
- <!-- Author Column -->
5
- <ng-container matColumnDef="userName">
6
- <th mat-header-cell *matHeaderCellDef> Name </th>
7
- <td mat-cell *matCellDef="let user">{{user.name}}</td>
8
- </ng-container>
9
-
10
- <!-- Access Status Column -->
11
- <ng-container matColumnDef="accessState">
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
- #waitlist-table {
7
- width: 100%;
8
+ .tab-bar {
9
+ display: flex;
10
+ gap: 4px;
11
+ margin-bottom: 24px;
12
+ border-bottom: 1px solid #e0e0e0;
8
13
 
9
- .update-btn {
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, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
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 { User, AccessState } from '../../core/store/user/user.model';
4
- import { AuthStore } from '../../core/store/auth/auth.store';
5
- import { UserStore } from '../../core/store/user/user.store';
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
- // If you add other columns, update this, e.g. AccessState | string | boolean;
14
- type UpdateValueTypes = AccessState;
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
- MatTable,
24
- MatColumnDef,
25
- MatHeaderCellDef,
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 implements OnInit {
40
- readonly authStore = inject(AuthStore);
41
- readonly userStore = inject(UserStore);
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
- // --------------- LOCAL UI STATE ----------------------
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
- /** Get array of all waiting users. */
66
- waitingUsers: Signal<User[]> = computed(() => this.userStore.selectEntities([], { orderBy: 'accessState' }));
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
- /** Event stream for updating user accessState. */
71
- async updateState(user: User, key: string, value: UpdateValueTypes) {
72
- const data = {};
73
- data[key] = value;
74
-
75
- try {
76
- await this.userStore.update(user.__id, { ...data });
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,4 @@
1
+ import { trigger, group, query, animateChild, state, style, animate, transition } from '@angular/animations';
2
+
3
+ export const AdminCountPillAnimations = [
4
+ ];
@@ -0,0 +1,4 @@
1
+ <div class="count-item">
2
+ <span class="label">{{ label() }}:</span>
3
+ <span class="value">{{ value() }}</span>
4
+ </div>
@@ -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
+ }