@tech4good/angular-schematics 20.1.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 +37 -0
- package/.agents/skills/publish-npm/eval.yaml +17 -0
- package/.t4g/agent-memory.db +0 -0
- package/CHANGELOG.md +66 -0
- package/README.md +16 -7
- package/changelog.config.json +19 -0
- package/contributing-docs/branches-and-releases.md +57 -0
- package/contributing-docs/commit-message.md +117 -0
- package/package.json +10 -2
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.scss.template +1 -0
- package/src/component/schema.json +1 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +1 -1
- package/src/entity/schema.json +1 -0
- 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/cached-listeners.service.ts.template +2 -17
- 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/schema.json +1 -0
- package/src/ng-add/files/src/app/core/auth/auth.guard.ts.template +0 -96
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, computed, Inject, input, output, inject, signal, WritableSignal, Signal, Injector } from '@angular/core';
|
|
2
|
-
import { toObservable
|
|
1
|
+
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, computed, Inject, input, output, inject, signal, WritableSignal, Signal, Injector, effect } from '@angular/core';
|
|
2
|
+
import { toObservable } from '@angular/core/rxjs-interop';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
5
|
+
import { Router, ActivatedRoute } from '@angular/router';
|
|
5
6
|
import { EarlyAccessAnimations } from './early-access.animations';
|
|
6
7
|
import { WaitlistData } from './early-access.model';
|
|
7
8
|
import { User, AccessState } from 'src/app/core/store/user/user.model';
|
|
9
|
+
import { handleAccess } from './early-access.guard';
|
|
8
10
|
import { UserContext } from 'src/app/core/store/user-context/user-context.model';
|
|
9
11
|
import { Timestamp, serverTimestamp } from 'firebase/firestore';
|
|
10
12
|
import { FormBuilder, Validators, ValidatorFn, ValidationErrors, AbstractControl, FormGroup, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -12,13 +14,13 @@ import { MatSnackBar } from '@angular/material/snack-bar';
|
|
|
12
14
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
13
15
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
14
16
|
import { UserContextStore } from 'src/app/core/store/user-context/user-context.store';
|
|
15
|
-
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
|
16
17
|
import { MatInput } from '@angular/material/input';
|
|
17
|
-
import { MatCheckbox } from '@angular/material/checkbox';
|
|
18
18
|
import { AsyncPipe } from '@angular/common';
|
|
19
|
-
import {
|
|
19
|
+
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
|
20
|
+
import { MatLabel, MatFormField, MatHint } from '@angular/material/form-field';
|
|
20
21
|
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
21
22
|
import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
23
|
+
import { HintVisibilityDirective } from 'src/app/shared/hint-visibility/hint-visibility.directive';
|
|
22
24
|
|
|
23
25
|
@Component({
|
|
24
26
|
selector: 'app-early-access',
|
|
@@ -31,13 +33,12 @@ import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
|
31
33
|
FormsModule,
|
|
32
34
|
MatLabel,
|
|
33
35
|
ReactiveFormsModule,
|
|
34
|
-
MatCheckbox,
|
|
35
36
|
MatFormField,
|
|
36
37
|
MatInput,
|
|
37
38
|
MatHint,
|
|
38
|
-
MatError,
|
|
39
|
-
MatProgressSpinner,
|
|
40
39
|
AsyncPipe,
|
|
40
|
+
CdkTextareaAutosize,
|
|
41
|
+
HintVisibilityDirective,
|
|
41
42
|
],
|
|
42
43
|
})
|
|
43
44
|
export class EarlyAccessComponent implements OnInit {
|
|
@@ -61,73 +62,25 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
61
62
|
// Template constants
|
|
62
63
|
appName = 'APP_NAME [Causeway]';
|
|
63
64
|
appArea = 'APP_AREA [learning web development]';
|
|
64
|
-
outreachLeadName = 'OUTREACH_LEAD_NAME [FirstName
|
|
65
|
+
outreachLeadName = 'OUTREACH_LEAD_NAME [FirstName]';
|
|
65
66
|
outreachLeadEmail = 'OUTREACH_LEAD_EMAIL [email@ucsc.edu]';
|
|
66
67
|
|
|
67
|
-
/** One checkbox must be selected. If other is selected, the text needs to be filled out */
|
|
68
|
-
oneCheckedValidator: ValidatorFn = (
|
|
69
|
-
form: FormGroup,
|
|
70
|
-
): ValidationErrors | null => {
|
|
71
|
-
const otherText = form.get('backgroundOther').value;
|
|
72
|
-
const selectionsArray = form.get('backgroundSelections') as FormArray;
|
|
73
|
-
const selected = selectionsArray.controls
|
|
74
|
-
.filter((item) => item.value.checked);
|
|
75
|
-
|
|
76
|
-
const needsOtherText = selectionsArray.controls.filter((item) => item.value.fieldName === 'other' && item.value.checked).length > 0 && otherText.trim().length === 0;
|
|
77
|
-
|
|
78
|
-
return selected.length === 0 || needsOtherText ? {
|
|
79
|
-
...(selected.length === 0 ? { noneChecked: true } : {}),
|
|
80
|
-
...(needsOtherText ? { needsOtherText } : {}),
|
|
81
|
-
}: null;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
68
|
/** Form controls for early access survey. */
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.form.group({
|
|
90
|
-
fieldName: 'option1',
|
|
91
|
-
label: 'OPTION_1 [Student trying to get hands-on experience]',
|
|
92
|
-
ariaLabel: 'OPTION_1_AREA',
|
|
93
|
-
checked: false,
|
|
94
|
-
}),
|
|
95
|
-
this.form.group({
|
|
96
|
-
fieldName: 'option2',
|
|
97
|
-
label: 'OPTION_2 [Educator exploring new ways to teach]',
|
|
98
|
-
ariaLabel: 'OPTION_2_ARIA',
|
|
99
|
-
checked: false,
|
|
100
|
-
}),
|
|
101
|
-
this.form.group({
|
|
102
|
-
fieldName: 'option3',
|
|
103
|
-
label: 'OPTION_3 [Professional wanting to contribute to a cause]',
|
|
104
|
-
ariaLabel: 'OPTION_3_ARIA',
|
|
105
|
-
checked: false,
|
|
106
|
-
}),
|
|
107
|
-
this.form.group({
|
|
108
|
-
fieldName: 'other',
|
|
109
|
-
label: 'Other (none are a perfect fit)',
|
|
110
|
-
ariaLabel: 'Other',
|
|
111
|
-
checked: false,
|
|
112
|
-
})
|
|
113
|
-
])
|
|
114
|
-
}, { validators: this.oneCheckedValidator });
|
|
115
|
-
|
|
116
|
-
/** Convenience getter for desiredValue. */
|
|
117
|
-
get desiredValue() {
|
|
118
|
-
return this.backgroundForm.get('desiredValue');
|
|
119
|
-
}
|
|
69
|
+
surveyForm = this.form.group({
|
|
70
|
+
questionOne: ['', Validators.minLength(25)],
|
|
71
|
+
questionTwo: ['', Validators.minLength(50)],
|
|
72
|
+
});
|
|
120
73
|
|
|
121
|
-
/** Convenience getter for
|
|
122
|
-
get
|
|
123
|
-
return this.
|
|
74
|
+
/** Convenience getter for questionOne. */
|
|
75
|
+
get questionOne() {
|
|
76
|
+
return this.surveyForm.get('questionOne');
|
|
124
77
|
}
|
|
125
78
|
|
|
126
|
-
/**
|
|
127
|
-
get
|
|
128
|
-
return this.
|
|
79
|
+
/** Convenience getter for questionTwo. */
|
|
80
|
+
get questionTwo() {
|
|
81
|
+
return this.surveyForm.get('questionTwo');
|
|
129
82
|
}
|
|
130
|
-
|
|
83
|
+
|
|
131
84
|
// --------------- COMPUTED DATA -----------------------
|
|
132
85
|
|
|
133
86
|
/** Waitlist data from app-state, user, and user-context. */
|
|
@@ -138,24 +91,37 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
138
91
|
|
|
139
92
|
/** Waiting position number. */
|
|
140
93
|
positionText$: Observable<string> = toObservable(this.currentUser).pipe(
|
|
141
|
-
filter((user: User) => !!user
|
|
94
|
+
filter((user: User) => !!user),
|
|
142
95
|
mergeMap(async (user) => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
96
|
+
try {
|
|
97
|
+
const compareDate = user.joinedWaitlistAt || user._createdAt;
|
|
98
|
+
if (!compareDate) return '';
|
|
99
|
+
|
|
100
|
+
const posNum = await this.userStore.count([
|
|
101
|
+
['joinedWaitlistAt', '<=', compareDate],
|
|
102
|
+
['accessState', '==', AccessState.WAITING],
|
|
103
|
+
], {});
|
|
104
|
+
return this.nth(posNum === 0 ? 1 : posNum);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
console.error('Error calculating position:', e);
|
|
107
|
+
return '';
|
|
108
|
+
}
|
|
148
109
|
}),
|
|
149
110
|
);
|
|
150
111
|
|
|
151
112
|
/** Waiting position number. */
|
|
152
113
|
totalWaiting$: Observable<string> = toObservable(this.currentUser).pipe(
|
|
153
|
-
filter((user: User) => !!user
|
|
114
|
+
filter((user: User) => !!user),
|
|
154
115
|
mergeMap(async (user) => {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
116
|
+
try {
|
|
117
|
+
const total = await this.userStore.count([
|
|
118
|
+
['accessState', '==', AccessState.WAITING],
|
|
119
|
+
], {});
|
|
120
|
+
return `${total}`;
|
|
121
|
+
} catch (e) {
|
|
122
|
+
console.error('Error calculating total:', e);
|
|
123
|
+
return '';
|
|
124
|
+
}
|
|
159
125
|
}),
|
|
160
126
|
);
|
|
161
127
|
|
|
@@ -169,55 +135,27 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
169
135
|
}
|
|
170
136
|
}
|
|
171
137
|
|
|
172
|
-
/** Get all options that were selected. */
|
|
173
|
-
getSelections(): string[] {
|
|
174
|
-
return this.backgroundSelections.controls
|
|
175
|
-
.filter((item) => item.value.checked)
|
|
176
|
-
.map((item) => item.value.fieldName);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
138
|
// --------------- EVENT HANDLING ----------------------
|
|
180
139
|
|
|
181
|
-
/**
|
|
182
|
-
* Enable and disable the backgroundOther text input depending on if other is checked.
|
|
183
|
-
* It is important that the form model is the source of truth not the template, so if we want
|
|
184
|
-
* the validation to go away when the input is no longer needed, it needs to be disabled on the model
|
|
185
|
-
* rather than just hidden from the view.
|
|
186
|
-
*/
|
|
187
|
-
check(item) {
|
|
188
|
-
if (item.value.fieldName === 'other' && item.value.checked) {
|
|
189
|
-
this.backgroundForm.controls.backgroundOther.enable();
|
|
190
|
-
} else if (item.value.fieldName === 'other' && !item.value.checked) {
|
|
191
|
-
this.backgroundForm.controls.backgroundOther.disable();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
140
|
/** Submit background and interests. */
|
|
196
141
|
async submitInterest() {
|
|
197
142
|
try {
|
|
198
143
|
await this.batch.batchWrite(async (batchConfig) => {
|
|
199
144
|
await this.userStore.update(this.waitlistData().currentUser.__id, {
|
|
200
145
|
accessState: AccessState.WAITING,
|
|
201
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
146
|
joinedWaitlistAt: Timestamp.now(),
|
|
203
147
|
}, { batchConfig });
|
|
204
148
|
|
|
205
149
|
if (this.waitlistData().userContext) {
|
|
206
150
|
this.userContextStore.update(this.waitlistData().userContext.__id, {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
...(this.backgroundOther.value ? { other: this.backgroundOther.value } : { }),
|
|
210
|
-
},
|
|
211
|
-
desiredValue: this.desiredValue.value,
|
|
151
|
+
questionOne: this.questionOne?.value ?? '',
|
|
152
|
+
questionTwo: this.questionTwo?.value ?? '',
|
|
212
153
|
}, { batchConfig });
|
|
213
154
|
} else {
|
|
214
155
|
this.userContextStore.add({
|
|
215
156
|
__userId: this.waitlistData().currentUser.__id,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
...(this.backgroundOther.value ? { other: this.backgroundOther.value } : { }),
|
|
219
|
-
},
|
|
220
|
-
desiredValue: this.desiredValue.value,
|
|
157
|
+
questionOne: this.questionOne?.value ?? '',
|
|
158
|
+
questionTwo: this.questionTwo?.value ?? '',
|
|
221
159
|
}, { batchConfig });
|
|
222
160
|
}
|
|
223
161
|
}, {
|
|
@@ -237,11 +175,21 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
237
175
|
// --------------- OTHER -------------------------------
|
|
238
176
|
|
|
239
177
|
constructor(
|
|
178
|
+
private router: Router,
|
|
179
|
+
private route: ActivatedRoute,
|
|
240
180
|
private snackBar: MatSnackBar,
|
|
241
181
|
private form: FormBuilder,
|
|
242
182
|
@Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
|
|
243
183
|
private injector: Injector,
|
|
244
184
|
) {
|
|
185
|
+
// Redirect users who have progressed past the early-access stage (i.e. neither
|
|
186
|
+
// submitting interest nor waiting) to the consent page. The consent page's own
|
|
187
|
+
// auth guard handles whether the user has already consented and should be
|
|
188
|
+
// redirected further downstream.
|
|
189
|
+
effect(() => {
|
|
190
|
+
const user = this.currentUser();
|
|
191
|
+
handleAccess(user, this.router, this.route.snapshot, this.router.routerState.snapshot);
|
|
192
|
+
});
|
|
245
193
|
}
|
|
246
194
|
|
|
247
195
|
// --------------- LOAD AND CLEANUP --------------------
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { inject } from '@angular/core';
|
|
2
|
+
import { CanActivateFn, Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
3
|
+
import { map } from 'rxjs/operators';
|
|
4
|
+
import { AuthService } from '../../core/auth/auth.service';
|
|
5
|
+
import { User, AccessState } from '../../core/store/user/user.model';
|
|
6
|
+
import { hasAdminOverride } from '../../core/auth/guards/admin-override';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Ensures the user is currently on the waitlist. Users who have already
|
|
10
|
+
* cleared the waitlist will be redirected to the consent page.
|
|
11
|
+
*
|
|
12
|
+
* This function is shared between the auth guard and the component's
|
|
13
|
+
* reactive effect so they stay synchronized.
|
|
14
|
+
*/
|
|
15
|
+
export function handleAccess(
|
|
16
|
+
user: User | null | undefined,
|
|
17
|
+
router: Router,
|
|
18
|
+
route: ActivatedRouteSnapshot,
|
|
19
|
+
state: RouterStateSnapshot
|
|
20
|
+
): boolean {
|
|
21
|
+
if (hasAdminOverride(user, state.url)) return true;
|
|
22
|
+
|
|
23
|
+
const waitingStates = [AccessState.SUBMIT_INTEREST, AccessState.WAITING];
|
|
24
|
+
if (user && !waitingStates.includes(user.accessState)) {
|
|
25
|
+
router.navigate(['/consent'], { queryParams: route.queryParams });
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Route guard that delegates to `handleAccess`.
|
|
34
|
+
*/
|
|
35
|
+
export const earlyAccessGuard: CanActivateFn = (route, state) => {
|
|
36
|
+
const auth = inject(AuthService);
|
|
37
|
+
const router = inject(Router);
|
|
38
|
+
|
|
39
|
+
return auth.resolveUser().pipe(
|
|
40
|
+
map((user) => {
|
|
41
|
+
return handleAccess(user, router, route, state);
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { trigger, query, animateChild, style, animate, transition, stagger } from '@angular/animations';
|
|
2
|
+
|
|
3
|
+
export const HeroAnimations = [
|
|
4
|
+
trigger('fadeInUp', [
|
|
5
|
+
transition(':enter', [
|
|
6
|
+
style({ opacity: 0, transform: 'translateY(30px)' }),
|
|
7
|
+
animate('0.8s cubic-bezier(0.16, 1, 0.3, 1)', style({ opacity: 1, transform: 'translateY(0)' })),
|
|
8
|
+
]),
|
|
9
|
+
]),
|
|
10
|
+
trigger('staggerContainer', [
|
|
11
|
+
transition(':enter', [
|
|
12
|
+
query('@fadeInUp', stagger(150, animateChild()), { optional: true }),
|
|
13
|
+
]),
|
|
14
|
+
]),
|
|
15
|
+
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<section class="hero-section" [@staggerContainer]>
|
|
2
|
+
<div class="hero-content" [@fadeInUp]>
|
|
3
|
+
<h1 class="hero-title">Your Value Proposition Here</h1>
|
|
4
|
+
<div class="hero-subtitle">
|
|
5
|
+
<app-rotating-quotes [sentences]="sentences"></app-rotating-quotes>
|
|
6
|
+
</div>
|
|
7
|
+
<button class="cta-button" (click)="login.emit()">Sign Up / Call to Action</button>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="hero-visual" [@fadeInUp]>
|
|
10
|
+
<img src="/images/abstract.png" alt="Abstract illustration placeholder" />
|
|
11
|
+
</div>
|
|
12
|
+
</section>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.hero-section {
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding: 120px 20px;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
gap: 60px;
|
|
12
|
+
align-items: center;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
text-align: center;
|
|
15
|
+
@media (min-width: 900px) {
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
text-align: left;
|
|
18
|
+
padding: 120px 60px;
|
|
19
|
+
max-width: 1200px;
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.hero-content {
|
|
24
|
+
flex: 1;
|
|
25
|
+
max-width: 500px;
|
|
26
|
+
|
|
27
|
+
.hero-title {
|
|
28
|
+
font-size: 3.5rem;
|
|
29
|
+
line-height: 1.1;
|
|
30
|
+
margin-bottom: 24px;
|
|
31
|
+
font-family: 'Source Serif 4', serif;
|
|
32
|
+
margin-top: 0;
|
|
33
|
+
color: #111827;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.hero-subtitle {
|
|
37
|
+
margin-bottom: 40px;
|
|
38
|
+
font-size: 1.125rem;
|
|
39
|
+
color: #4b5563;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.cta-button {
|
|
43
|
+
background-color: #0E7490;
|
|
44
|
+
color: #FFFFFF;
|
|
45
|
+
border: none;
|
|
46
|
+
border-radius: 8px;
|
|
47
|
+
padding: 16px 32px;
|
|
48
|
+
font-size: 1.125rem;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
transition: background-color 0.2s, transform 0.1s;
|
|
52
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
53
|
+
|
|
54
|
+
&:hover {
|
|
55
|
+
background-color: #155E75;
|
|
56
|
+
transform: translateY(-1px);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:active {
|
|
60
|
+
transform: translateY(1px);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.hero-visual {
|
|
66
|
+
flex: 1;
|
|
67
|
+
width: 100%;
|
|
68
|
+
max-width: 300px;
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
|
|
72
|
+
img {
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: auto;
|
|
75
|
+
border-radius: 12px;
|
|
76
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, output } from '@angular/core';
|
|
2
|
+
import { RotatingQuotesComponent } from '../rotating-quotes/rotating-quotes.component';
|
|
3
|
+
import { HeroAnimations } from './hero.animations';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-hero',
|
|
7
|
+
templateUrl: './hero.component.html',
|
|
8
|
+
styleUrls: ['./hero.component.scss'],
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
imports: [RotatingQuotesComponent],
|
|
11
|
+
animations: HeroAnimations,
|
|
12
|
+
})
|
|
13
|
+
export class HeroComponent {
|
|
14
|
+
readonly sentences = [
|
|
15
|
+
"First generic placeholder quote.",
|
|
16
|
+
"Second generic placeholder quote.",
|
|
17
|
+
"Third generic placeholder quote.",
|
|
18
|
+
];
|
|
19
|
+
login = output<void>();
|
|
20
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
|
+
font-family: 'Inter', sans-serif;
|
|
4
|
+
color: #303030;
|
|
5
|
+
line-height: 1.6;
|
|
6
|
+
|
|
3
7
|
.landing-container {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
border-radius: 4px;
|
|
11
|
-
}
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
min-height: 100vh;
|
|
13
|
+
width: 100%;
|
|
12
14
|
}
|
|
13
15
|
}
|
|
16
|
+
|
|
@@ -2,6 +2,7 @@ import { Component, OnInit, ChangeDetectionStrategy, inject, Signal, Injector }
|
|
|
2
2
|
import { LandingAnimations } from './landing.animations';
|
|
3
3
|
import { User } from 'src/app/core/store/user/user.model';
|
|
4
4
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
5
|
+
import { HeroComponent } from './hero/hero.component';
|
|
5
6
|
|
|
6
7
|
@Component({
|
|
7
8
|
selector: 'app-landing',
|
|
@@ -9,6 +10,7 @@ import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
|
9
10
|
styleUrls: ['./landing.component.scss'],
|
|
10
11
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
12
|
animations: LandingAnimations,
|
|
13
|
+
imports: [HeroComponent],
|
|
12
14
|
})
|
|
13
15
|
export class LandingComponent implements OnInit {
|
|
14
16
|
readonly authStore = inject(AuthStore);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
min-height: 60px;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
|
|
6
|
+
p {
|
|
7
|
+
font-size: 1.25rem;
|
|
8
|
+
color: #4B5563;
|
|
9
|
+
line-height: 1.5;
|
|
10
|
+
margin: 0;
|
|
11
|
+
opacity: 1;
|
|
12
|
+
transform: translateY(0);
|
|
13
|
+
transition: opacity 0.3s ease-out, transform 0.3s ease-out;
|
|
14
|
+
|
|
15
|
+
&.leaving {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
transform: translateY(-16px);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.entering {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
transform: translateY(12px);
|
|
23
|
+
transition: none;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, input, signal, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'app-rotating-quotes',
|
|
5
|
+
templateUrl: './rotating-quotes.component.html',
|
|
6
|
+
styleUrls: ['./rotating-quotes.component.scss'],
|
|
7
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
+
})
|
|
9
|
+
export class RotatingQuotesComponent implements OnInit, OnDestroy {
|
|
10
|
+
sentences = input.required<string[]>();
|
|
11
|
+
|
|
12
|
+
activeSentenceIndex = signal(0);
|
|
13
|
+
animState = signal<'visible' | 'leaving' | 'entering'>('visible');
|
|
14
|
+
private rotationInterval: ReturnType<typeof setInterval> | null = null;
|
|
15
|
+
|
|
16
|
+
ngOnInit() {
|
|
17
|
+
this.startSentenceRotation();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ngOnDestroy() {
|
|
21
|
+
this.stopSentenceRotation();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private startSentenceRotation() {
|
|
25
|
+
this.rotationInterval = setInterval(() => this.advanceSentence(), 4000);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private stopSentenceRotation() {
|
|
29
|
+
if (this.rotationInterval) {
|
|
30
|
+
clearInterval(this.rotationInterval);
|
|
31
|
+
this.rotationInterval = null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private advanceSentence() {
|
|
36
|
+
this.animState.set('leaving');
|
|
37
|
+
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
this.activeSentenceIndex.update((i) => (i + 1) % this.sentences().length);
|
|
40
|
+
this.animState.set('entering');
|
|
41
|
+
|
|
42
|
+
// Double requestAnimationFrame forces the browser to paint the 'entering' state
|
|
43
|
+
// before applying the 'visible' state, ensuring the CSS transition triggers properly
|
|
44
|
+
// instead of being batched and skipped.
|
|
45
|
+
requestAnimationFrame(() => {
|
|
46
|
+
requestAnimationFrame(() => {
|
|
47
|
+
this.animState.set('visible');
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}, 300);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@if (showAdminOverride() || showMockDbWarning()) {
|
|
2
|
+
<div class="dev-status-bar">
|
|
3
|
+
<div class="chips-container">
|
|
4
|
+
@if (showMockDbWarning()) {
|
|
5
|
+
<div class="status-chip">
|
|
6
|
+
<mat-icon>storage</mat-icon>
|
|
7
|
+
<span>Mock DB Cached</span>
|
|
8
|
+
<button class="action-btn" (click)="clearMockData()">Clear</button>
|
|
9
|
+
</div>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@if (showAdminOverride()) {
|
|
13
|
+
<div class="status-chip">
|
|
14
|
+
<mat-icon>admin_panel_settings</mat-icon>
|
|
15
|
+
<span>Auth Bypassed</span>
|
|
16
|
+
<a class="action-link" routerLink="/admin" [queryParams]="{tab: 'settings'}">Manage</a>
|
|
17
|
+
</div>
|
|
18
|
+
}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dev-status-bar {
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: center;
|
|
9
|
+
background-color: #f39c12; /* Orange background */
|
|
10
|
+
color: white;
|
|
11
|
+
padding: 6px 16px;
|
|
12
|
+
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
|
|
13
|
+
z-index: 1000;
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.chips-container {
|
|
18
|
+
display: flex;
|
|
19
|
+
gap: 12px;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.status-chip {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 6px;
|
|
29
|
+
padding: 4px 10px;
|
|
30
|
+
border-radius: 16px;
|
|
31
|
+
background-color: rgba(0, 0, 0, 0.15); /* Translucent dark background for the chips */
|
|
32
|
+
font-size: 13px;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
letter-spacing: 0.02em;
|
|
35
|
+
|
|
36
|
+
mat-icon {
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
width: 16px;
|
|
39
|
+
height: 16px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.action-btn {
|
|
43
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
44
|
+
border: none;
|
|
45
|
+
border-radius: 10px;
|
|
46
|
+
padding: 2px 8px;
|
|
47
|
+
font-size: 11px;
|
|
48
|
+
font-weight: 700;
|
|
49
|
+
color: #d35400; /* Dark orange text for the button */
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
margin-left: 4px;
|
|
52
|
+
transition: background-color 0.2s, color 0.2s;
|
|
53
|
+
|
|
54
|
+
&:hover {
|
|
55
|
+
background-color: white;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.action-link {
|
|
60
|
+
color: white;
|
|
61
|
+
font-weight: 700;
|
|
62
|
+
text-decoration: underline;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
margin-left: 4px;
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
|
|
67
|
+
&:hover {
|
|
68
|
+
color: #ffe0b2;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|