@tech4good/angular-schematics 18.0.0 → 18.0.2
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/package.json +1 -1
- package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +1 -1
- package/src/entity/index.js +7 -3
- package/src/entity/index.js.map +1 -1
- package/src/init/files/.eslintrc.json.template +1 -1
- package/src/init/files/.github/workflows/angular-github-ci.yml.template +1 -1
- package/src/init/files/README.md.template +8 -5
- package/src/init/files/angular.json.template +0 -2
- package/src/init/files/package.json.template +1 -1
- package/src/init/files/src/app/app.component.html.template +0 -1
- package/src/init/files/src/app/app.component.ts.template +0 -2
- package/src/init/files/src/app/app.config.ts.template +9 -7
- package/src/init/files/src/app/core/auth/auth.guard.ts.template +1 -1
- package/src/init/files/src/app/core/store/user/user.model.ts.template +2 -5
- package/src/init/files/src/app/first-time/consent/consent.component.html.template +5 -4
- package/src/init/files/src/app/first-time/consent/consent.component.scss.template +2 -2
- package/src/init/files/src/app/first-time/consent/consent.component.ts.template +21 -16
- package/src/init/files/src/app/first-time/early-access/early-access.component.html.template +53 -57
- package/src/init/files/src/app/first-time/early-access/early-access.component.scss.template +9 -2
- package/src/init/files/src/app/first-time/early-access/early-access.component.ts.template +122 -62
- package/src/init/files/src/app/main/home/home.component.html.template +1 -0
- package/src/init/files/src/app/main/home/home.component.scss.template +1 -0
- package/src/init/files/src/app/main/home/home.component.ts.template +4 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.scss.template +3 -5
- package/src/init/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +1 -1
- package/src/init/files/src/environments/environment.prod.ts.template +6 -2
- package/src/init/files/src/environments/environment.ts.template +3 -2
- package/src/init/files/src/styles.scss.template +4 -0
- /package/src/init/files/{src/assets → public}/images/close-x.svg +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Timestamp } from '@angular/fire/firestore';
|
|
2
2
|
import { <%= classify(name) %> } from './<%= dasherize(name) %>.model';
|
|
3
|
-
import { withEntitiesForMockDB } from '
|
|
3
|
+
import { withEntitiesForMockDB } from 'src/app/core/store/app.store';
|
|
4
4
|
import { signalStore } from '@ngrx/signals';
|
|
5
5
|
|
|
6
6
|
export const <%= classify(name) %>MockDB = signalStore(
|
package/src/entity/index.js
CHANGED
|
@@ -29,8 +29,8 @@ function addInserts(options) {
|
|
|
29
29
|
const appModelText = (0, statements_adder_1.getSourceText)(host, appModelPath);
|
|
30
30
|
context.logger.info(`appModelPath: ${appModelPath}`);
|
|
31
31
|
const entityModelPath = `/${options.path}/` +
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
dasherizedName + '/' +
|
|
33
|
+
dasherizedName + '.model';
|
|
34
34
|
context.logger.info(`entityModelPath: ${entityModelPath}`);
|
|
35
35
|
const appToEntityModelPath = (0, find_module_1.buildRelativePath)(appModelPath, entityModelPath);
|
|
36
36
|
context.logger.info(`appToEntityPath: ${appToEntityModelPath}`);
|
|
@@ -44,13 +44,17 @@ function addInserts(options) {
|
|
|
44
44
|
// firebase.mock.service.ts changes
|
|
45
45
|
const fbMockPath = '//src/app/core/firebase/firebase.mock.service.ts';
|
|
46
46
|
const fbMockText = (0, statements_adder_1.getSourceText)(host, fbMockPath);
|
|
47
|
+
const entityMockPath = `/${options.path}/` +
|
|
48
|
+
dasherizedName + '/' +
|
|
49
|
+
dasherizedName + '.mock';
|
|
50
|
+
const fbToEntityMockPath = (0, find_module_1.buildRelativePath)(fbMockPath, entityMockPath);
|
|
47
51
|
context.logger.info(`fbMockPath: ${fbMockPath}`);
|
|
48
52
|
let insertChangesInFbMock = (0, statements_adder_1.simpleInsert)(fbMockText, fbMockPath, [
|
|
49
53
|
'// Entity Model DB Data',
|
|
50
54
|
'readonly DB = {',
|
|
51
55
|
'// Init Entity Models',
|
|
52
56
|
], [
|
|
53
|
-
`import { ${classifiedName}MockDB, ${allcapsName}_DB } from '
|
|
57
|
+
`import { ${classifiedName}MockDB, ${allcapsName}_DB } from '${fbToEntityMockPath}';`,
|
|
54
58
|
` '${camelizedName}s': inject(${classifiedName}MockDB),`,
|
|
55
59
|
` patchState(this.DB['${camelizedName}s'], setAllEntities(${allcapsName}_DB, { selectId }));`
|
|
56
60
|
]);
|
package/src/entity/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAIoC;AAEpC,+DAA0E;AAC1E,yEAA4E;AAC5E,uEAAmE;AACnE,qEAAuF;AACvF,+CAA+C;AAE/C,iEAAyE;AAEzE,SAAS,UAAU,CAAC,OAAY;IAC9B,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAE/C,MAAM,cAAc,GAAG,cAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,aAAa,GAAG,cAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,cAAc,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,cAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QACjE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,cAAc,KAAK,aAAa,EAAE,CAAC,CAAC;QAElE,uBAAuB;QACvB,MAAM,YAAY,GAAG,mCAAmC,CAAC;QACzD,MAAM,YAAY,GAAG,IAAA,gCAAa,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACvD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;QAErD,MAAM,eAAe,GACnB,IAAI,OAAO,CAAC,IAAI,GAAG;YACnB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings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C;YACX,UAAU,CAAC,OAAO,CAAC;YACnB,IAAA,sBAAS,EAAC,cAAc,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC;AArCD,wBAqCC"}
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"*.spec.ts",
|
|
100
100
|
"*.effects.ts",
|
|
101
101
|
"src/app/core/store/**/*.service.ts",
|
|
102
|
-
"src/app/core/firebase
|
|
102
|
+
"src/app/core/firebase/*.service.ts",
|
|
103
103
|
"src/app/core/analytics/time-analytics.service.ts",
|
|
104
104
|
"src/app/core/setup/module-import-guard.ts"
|
|
105
105
|
],
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
# <%= classify(project) %>
|
|
2
2
|
|
|
3
|
-
This project was initialized by using [Tech4Good's Angular Schematics](https://github.com/tech4good-lab/angular-schematics) after a base project repository was generated with [Angular CLI](https://github.com/angular/angular-cli).
|
|
3
|
+
This project was initialized by using [Tech4Good's Angular Schematics](https://github.com/tech4good-lab/angular-schematics) after a base project repository was generated with [Angular CLI](https://github.com/angular/angular-cli).
|
|
4
4
|
|
|
5
5
|
## Development server
|
|
6
6
|
|
|
7
7
|
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
|
8
8
|
Run `ng serve --configuration production` to run a prod server locally. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
|
9
9
|
|
|
10
|
-
## Code scaffolding
|
|
11
|
-
|
|
12
|
-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate container|entity`.
|
|
13
|
-
|
|
14
10
|
## Build
|
|
15
11
|
|
|
16
12
|
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
17
13
|
Run `firebase deploy` to deploy to production and `firebase deploy -P dev` to deploy to dev
|
|
18
14
|
|
|
15
|
+
## Code generation
|
|
16
|
+
|
|
17
|
+
* Run `ng g component component-name` inside the folder where you want a new component to generate it.
|
|
18
|
+
* Run `ng g entity entity-name` inside `src/app/core/store` to generate a new entity and add appropriate lines in app.model.ts and firebase.mock.service.ts.
|
|
19
|
+
* We ran `ng g init` on a newly generated Angular V18 repo to set up the core infrastructure. This should not be run again as it will rewrite several app-wide files like package.json, app.routes.ts, app.model.ts, firebase.mock.service.ts, etc. where you will have likely added new code since creation of the repository.
|
|
20
|
+
|
|
21
|
+
|
|
19
22
|
## Version number
|
|
20
23
|
|
|
21
24
|
We use the syntax `MAJOR.MINOR.PATCH` for versioning, where
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"glob": "**/*",
|
|
45
45
|
"input": "public"
|
|
46
46
|
},
|
|
47
|
-
"src/assets"
|
|
48
47
|
],
|
|
49
48
|
"styles": [
|
|
50
49
|
"@angular/material/prebuilt-themes/azure-blue.css",
|
|
@@ -116,7 +115,6 @@
|
|
|
116
115
|
"glob": "**/*",
|
|
117
116
|
"input": "public"
|
|
118
117
|
},
|
|
119
|
-
"src/assets"
|
|
120
118
|
],
|
|
121
119
|
"styles": [
|
|
122
120
|
"@angular/material/prebuilt-themes/azure-blue.css",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@angular-eslint/template-parser": "^18.1.0",
|
|
43
43
|
"@angular/cli": "^18.0.7",
|
|
44
44
|
"@angular/compiler-cli": "^18.0.0",
|
|
45
|
-
"@tech4good/angular-schematics": "^18.0.
|
|
45
|
+
"@tech4good/angular-schematics": "^18.0.2",
|
|
46
46
|
"@types/estree": "^1.0.0",
|
|
47
47
|
"@types/jasmine": "~5.1.0",
|
|
48
48
|
"@types/node": "^18.18.0",
|
|
@@ -5,7 +5,6 @@ import { TimeAnalyticsService } from './core/analytics/time-analytics.service';
|
|
|
5
5
|
import { AuthStore } from './core/store/auth/auth.store';
|
|
6
6
|
import { DetectRedeploymentService } from './shared/redeployment-warning/redeployment-warning.service';
|
|
7
7
|
import { RedeploymentWarningComponent } from './shared/redeployment-warning/redeployment-warning.component';
|
|
8
|
-
import { NavbarComponent } from './shared/navbar/navbar.component';
|
|
9
8
|
|
|
10
9
|
@Component({
|
|
11
10
|
selector: 'app-root',
|
|
@@ -13,7 +12,6 @@ import { NavbarComponent } from './shared/navbar/navbar.component';
|
|
|
13
12
|
styleUrls: ['./app.component.scss'],
|
|
14
13
|
standalone: true,
|
|
15
14
|
imports: [
|
|
16
|
-
NavbarComponent,
|
|
17
15
|
RedeploymentWarningComponent,
|
|
18
16
|
RouterOutlet,
|
|
19
17
|
],
|
|
@@ -19,18 +19,20 @@ import { getPerformance, providePerformance } from '@angular/fire/performance';
|
|
|
19
19
|
|
|
20
20
|
const firebaseProviders = !environment.production && environment['mockDB'] ? [] : [
|
|
21
21
|
provideFirebaseApp(() => initializeApp(environment.firebase)),
|
|
22
|
-
provideFirebaseApp(() => initializeApp(environment.firebaseLogs, 'logs')),
|
|
23
22
|
provideFirestore(() => {
|
|
24
23
|
const firestore = getFirestore();
|
|
25
24
|
enableIndexedDbPersistence(firestore);
|
|
26
25
|
return firestore;
|
|
27
26
|
}),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
...(environment.production ? [
|
|
28
|
+
provideFirebaseApp(() => initializeApp(environment['firebaseLogs'], 'logs')),
|
|
29
|
+
provideFirestore(() => {
|
|
30
|
+
const firestore = getFirestore(getApp('logs'));
|
|
31
|
+
// connectFirestoreEmulator(firestore, 'localhost', 8080);
|
|
32
|
+
enableIndexedDbPersistence(firestore);
|
|
33
|
+
return firestore;
|
|
34
|
+
}),
|
|
35
|
+
] : []),
|
|
34
36
|
provideAuth(() => getAuth()),
|
|
35
37
|
provideFunctions(() => getFunctions()),
|
|
36
38
|
providePerformance(() => getPerformance())
|
|
@@ -67,7 +67,7 @@ export class AuthGuard {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// Then handle whether users are past waitlist. If not, go to waiting, otherwise skip past waiting.
|
|
70
|
-
const waitingStates = [AccessState.SUBMIT_INTEREST, AccessState.
|
|
70
|
+
const waitingStates = [AccessState.SUBMIT_INTEREST, AccessState.WAITING];
|
|
71
71
|
if (waitingStates.includes(dbUser.accessState) && state.url !== '/early-access') {
|
|
72
72
|
this.router.navigate(['/early-access'], { queryParams: next.queryParams });
|
|
73
73
|
return of(false);
|
|
@@ -21,10 +21,7 @@ export interface User {
|
|
|
21
21
|
|
|
22
22
|
export enum AccessState {
|
|
23
23
|
CONSENT = '01 - consent', // on consent form
|
|
24
|
-
SUBMIT_INTEREST = '02 - submit interest', //
|
|
25
|
-
|
|
26
|
-
WAITING = '04 - waiting', // on waitlist for early access
|
|
27
|
-
// PLACEHOLDER: uncomment below for app-specific walkthrough page
|
|
28
|
-
// WALKTHROUGH = '05 - walkthrough', // on app specific walkthrough page
|
|
24
|
+
SUBMIT_INTEREST = '02 - submit interest', // on basic interest form
|
|
25
|
+
WAITING = '03 - waiting', // on waitlist for early access
|
|
29
26
|
DONE = 'done', // finished with the entire flow
|
|
30
27
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<
|
|
1
|
+
<app-navbar></app-navbar>
|
|
2
|
+
<main class="consent-container">
|
|
2
3
|
<h1>Research Consent and Privacy Policy</h1>
|
|
3
4
|
<div class="separator"></div>
|
|
4
5
|
|
|
@@ -44,11 +45,11 @@
|
|
|
44
45
|
|
|
45
46
|
<p>We may revise this Privacy Policy from time to time. The most current version of the policy will govern our use of your information and will be at <a routerLink="/consent">{{ consentUrl }}</a>. If we make a change to this policy that, in our sole discretion, is material, we will notify you via an email to the email address associated with your account. By continuing to access or use the Services after those changes become effective, you agree to be bound by the revised Privacy Policy.</p>
|
|
46
47
|
|
|
47
|
-
<form
|
|
48
|
+
<form [formGroup]="checkForm" (ngSubmit)="submit()">
|
|
48
49
|
<div class="agree-container">
|
|
49
|
-
<mat-checkbox [color]="'primary'"
|
|
50
|
+
<mat-checkbox [color]="'primary'" formControlName="checked" name="checked" required><span style="white-space:normal;" class="permission-text">I have read and understood the above, agree to the terms of use, and consent to participate in the research study.</span></mat-checkbox>
|
|
50
51
|
</div>
|
|
51
|
-
<button type="submit" class="btn continue-btn" [disabled]="
|
|
52
|
+
<button type="submit" class="btn continue-btn" [disabled]="checkForm.invalid">
|
|
52
53
|
Accept and Continue
|
|
53
54
|
<img src="https://icongr.am/feather/arrow-right.svg?size=20&color=B2B6C7">
|
|
54
55
|
</button>
|
|
@@ -7,8 +7,9 @@ import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
|
7
7
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
8
8
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
9
9
|
import { MatCheckbox } from '@angular/material/checkbox';
|
|
10
|
-
import {
|
|
10
|
+
import { FormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
11
11
|
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
12
|
+
import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
12
13
|
|
|
13
14
|
@Component({
|
|
14
15
|
selector: 'app-consent',
|
|
@@ -18,7 +19,8 @@ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch
|
|
|
18
19
|
animations: ConsentAnimations,
|
|
19
20
|
standalone: true,
|
|
20
21
|
imports: [
|
|
21
|
-
|
|
22
|
+
ReactiveFormsModule,
|
|
23
|
+
NavbarComponent,
|
|
22
24
|
MatCheckbox,
|
|
23
25
|
],
|
|
24
26
|
})
|
|
@@ -34,24 +36,26 @@ export class ConsentComponent implements OnInit {
|
|
|
34
36
|
// --------------- LOCAL UI STATE ----------------------
|
|
35
37
|
|
|
36
38
|
/** Constants for onboarding templates. */
|
|
37
|
-
appName = '
|
|
38
|
-
shortProdDesc = 'provides users with
|
|
39
|
-
shortResearchDesc = 'how to
|
|
40
|
-
authAppName = 'Google';
|
|
41
|
-
protocolNumber = 'PROTOCOL_NO';
|
|
42
|
-
protocolTitle = 'PROTOCOL_TITLE';
|
|
43
|
-
usageDataProductDesc = 'help users
|
|
44
|
-
usageDataResearchDesc = 'how to better support
|
|
45
|
-
studyDoingDesc = 'When you participate in our study, you will use our platform to
|
|
46
|
-
benefitsDesc = 'to
|
|
47
|
-
investigatorInfo = '[FirstName LastName, co-Principal Investigator, email@ucsc.edu]';
|
|
48
|
-
facultyInfo = 'David T. Lee, dlee105@ucsc.edu';
|
|
39
|
+
appName = 'APP_NAME [Causeway]';
|
|
40
|
+
shortProdDesc = 'PROD_DESC [provides users with opportunities to learn coding in real-world settings while contributing to non-profit causes]';
|
|
41
|
+
shortResearchDesc = 'RESEARCH_DESC [how to scale opportunities for experiential learning and support collaboration around social causes]';
|
|
42
|
+
authAppName = 'AUTH_APP_NAME [Google]';
|
|
43
|
+
protocolNumber = 'PROTOCOL_NO [HS-FY2022-254]';
|
|
44
|
+
protocolTitle = 'PROTOCOL_TITLE [Scaling Experiential Learning of Web Development]';
|
|
45
|
+
usageDataProductDesc = 'USAGE_DATA_PROD [help users learn and contribute to projects they are participating in. When you participate in a project, your task information, status, and code will be shared with the project team]';
|
|
46
|
+
usageDataResearchDesc = 'USAGE_DATA_RESEARCH [how to better support experiential learning online]';
|
|
47
|
+
studyDoingDesc = 'STUDY_DOING [When you participate in our study, you will use our platform to learn web development and contribute code to a platform. You will also fill out a survey on your experience, and optionally, participate in a follow-up interview]';
|
|
48
|
+
benefitsDesc = 'STUDY_BENEFITS [to learn web development and contribute to a project you care about]';
|
|
49
|
+
investigatorInfo = 'INVESTIGATOR_INFO [FirstName LastName, co-Principal Investigator, email@ucsc.edu]';
|
|
50
|
+
facultyInfo = 'FACULTY_INFO [David T. Lee, dlee105@ucsc.edu]';
|
|
49
51
|
|
|
50
52
|
/** Checkbox state used in form. */
|
|
51
|
-
|
|
53
|
+
checkForm = this.form.group({
|
|
54
|
+
checked: [false, Validators.requiredTrue],
|
|
55
|
+
});
|
|
52
56
|
|
|
53
57
|
/** Consent url. */
|
|
54
|
-
consentUrl;
|
|
58
|
+
consentUrl: string;
|
|
55
59
|
|
|
56
60
|
// --------------- COMPUTED DATA -----------------------
|
|
57
61
|
|
|
@@ -75,6 +79,7 @@ export class ConsentComponent implements OnInit {
|
|
|
75
79
|
|
|
76
80
|
constructor(
|
|
77
81
|
private router: Router,
|
|
82
|
+
private form: FormBuilder,
|
|
78
83
|
private snackBar: MatSnackBar,
|
|
79
84
|
private location: Location,
|
|
80
85
|
@Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
|
|
@@ -1,69 +1,65 @@
|
|
|
1
|
+
<app-navbar></app-navbar>
|
|
1
2
|
@if (waitlistData(); as data) {
|
|
2
3
|
<div class="early-access-container">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<mat-
|
|
12
|
-
|
|
4
|
+
<!-- Core questions on motivation and desired value -->
|
|
5
|
+
@if (data.currentUser.accessState === AccessState.SUBMIT_INTEREST && !loading()) {
|
|
6
|
+
<h1>Hello and Welcome!</h1>
|
|
7
|
+
<form [formGroup]="backgroundForm" (ngSubmit)="submitInterest()">
|
|
8
|
+
<div class="form-field-group">
|
|
9
|
+
<mat-label class="question">
|
|
10
|
+
Which of the following best describe your background and interest in {{ appName }}?
|
|
11
|
+
@if (backgroundForm.hasError('noneChecked') && (backgroundForm.touched || backgroundForm.dirty)) {
|
|
12
|
+
<mat-error class="checkbox-error">Please select one to help us understand your background</mat-error>
|
|
13
|
+
}
|
|
14
|
+
</mat-label>
|
|
15
|
+
<div class="checkbox-group" formArrayName="backgroundSelections">
|
|
16
|
+
@for (item of backgroundSelections.controls; track item.value.fieldName; let i = $index) {
|
|
17
|
+
<ng-container [formGroupName]="i">
|
|
18
|
+
<mat-checkbox formControlName="checked" [aria-label]="item.value.ariaLabel" (click)="check(item)">{{ item.value.label }}</mat-checkbox>
|
|
19
|
+
</ng-container>
|
|
20
|
+
}
|
|
13
21
|
</div>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<mat-label class="question">How would you describe your background and interest in {{ appName }}?</mat-label>
|
|
17
|
-
<mat-form-field class="background-other" appearance="fill">
|
|
18
|
-
<mat-label>Your background and interest</mat-label>
|
|
19
|
-
<input matInput [(ngModel)]="backgroundOther" name="backgroundOther" required [ngModelOptions]="{standalone: true}">
|
|
20
|
-
</mat-form-field>
|
|
21
|
-
</div>
|
|
22
|
-
}
|
|
22
|
+
</div>
|
|
23
|
+
@if (backgroundForm.contains('backgroundOther')) {
|
|
23
24
|
<div class="form-field-group">
|
|
24
|
-
<mat-label class="question">
|
|
25
|
-
<mat-form-field class="
|
|
26
|
-
<mat-label>Your
|
|
27
|
-
<
|
|
28
|
-
@if (
|
|
29
|
-
<mat-
|
|
25
|
+
<mat-label class="question">How would you describe your background and interest in {{ appName }}?</mat-label>
|
|
26
|
+
<mat-form-field class="background-other" appearance="fill">
|
|
27
|
+
<mat-label>Your background and interest</mat-label>
|
|
28
|
+
<input matInput name="backgroundOther" formControlName="backgroundOther" required>
|
|
29
|
+
@if (backgroundForm.hasError('needsOtherText') && (backgroundForm.touched || backgroundForm.dirty)) {
|
|
30
|
+
<mat-error>Can you elaborate on your selection of 'Other'?</mat-error>
|
|
30
31
|
}
|
|
31
32
|
</mat-form-field>
|
|
32
33
|
</div>
|
|
33
|
-
<button type="submit" class="btn continue-btn" [disabled]="!checkForm.form.valid">
|
|
34
|
-
Submit and Continue
|
|
35
|
-
<img src="https://icongr.am/feather/arrow-right.svg?size=20&color=B2B6C7">
|
|
36
|
-
</button>
|
|
37
|
-
</form>
|
|
38
|
-
}
|
|
39
|
-
<!-- Questions to develop a richer understanding of context: goals and needs, barriers, partial solutions, motivators, influencers, environmental context -->
|
|
40
|
-
@if (data.currentUser.accessState === AccessState.SUBMIT_DETAILED && !state.loading) {
|
|
41
|
-
<h1>Help us understand your unique context and needs</h1>
|
|
42
|
-
<form #checkForm2="ngForm" (ngSubmit)="submitDetailed()">
|
|
43
|
-
<div class="form-field-group">
|
|
44
|
-
<mat-label class="question">[Insert some questions that can help develop a richer understanding of context, e.g. around goals and needs, barriers, partial solutions, motivators, influencers, environmental context, etc.]</mat-label>
|
|
45
|
-
</div>
|
|
46
|
-
<button type="submit" class="btn continue-btn" [disabled]="!checkForm2.form.valid">
|
|
47
|
-
Submit and Continue
|
|
48
|
-
<img src="https://icongr.am/feather/arrow-right.svg?size=20&color=B2B6C7">
|
|
49
|
-
</button>
|
|
50
|
-
</form>
|
|
51
|
-
}
|
|
52
|
-
<!-- Waiting list position and path for going getting access early -->
|
|
53
|
-
@if (data.currentUser.accessState === AccessState.WAITING && !state.loading) {
|
|
54
|
-
@if (positionText$ | async; as position) {
|
|
55
|
-
@if (totalWaiting$ | async; as total) {
|
|
56
|
-
<h1>You are <span class="your-position">{{ position }}</span> of {{ total }} on the waitlist</h1>
|
|
57
|
-
<p>Thanks for signing up! We're hand-reviewing your response and personally onboarding our first 100 users to ensure that we can give you a delightful experience. We'll be in touch soon 😊</p>
|
|
58
|
-
<p>Also, we haven't had the chance to implement a formal referral system yet, but if you would love to get off the waitlist faster and can help us reach others, email {{ outreachLeadName }} at <a [href]="'mailto:' + outreachLeadEmail">{{ outreachLeadEmail }}</a> and let's talk about getting you early access!</p>
|
|
59
|
-
}
|
|
60
34
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
35
|
+
<div class="form-field-group">
|
|
36
|
+
<mat-label class="question">What do you hope to experience or get out of an application for {{ appArea }}?</mat-label>
|
|
37
|
+
<mat-form-field class="desired-value" appearance="fill">
|
|
38
|
+
<mat-label>Your ideal experience or outcomes</mat-label>
|
|
39
|
+
<textarea #text matInput formControlName="desiredValue" name="desiredValue" required></textarea>
|
|
40
|
+
@if (text.value?.length < 50) {
|
|
41
|
+
<mat-hint>You've shared {{text.value?.length || 0}} of 50 characters. If you could say a little more about your goals or why you decided to try it out, that'd help us! 🙏</mat-hint>
|
|
42
|
+
} @else {
|
|
43
|
+
<mat-hint>You're at {{text.value?.length}} characters! Telling us about your goals or why you decided to try it out helps us design the experience to better support you! 🙏</mat-hint>
|
|
44
|
+
}
|
|
45
|
+
</mat-form-field>
|
|
65
46
|
</div>
|
|
66
|
-
|
|
47
|
+
<button type="submit" class="btn continue-btn" [disabled]="backgroundForm.invalid">
|
|
48
|
+
Submit and Continue
|
|
49
|
+
<img src="https://icongr.am/feather/arrow-right.svg?size=20&color=B2B6C7">
|
|
50
|
+
</button>
|
|
51
|
+
</form>
|
|
52
|
+
} @else if (data.currentUser.accessState === AccessState.WAITING && !loading()) {
|
|
53
|
+
<!-- Waiting list position and path for going getting access early -->
|
|
54
|
+
@let position = positionText$ | async;
|
|
55
|
+
@let total = totalWaiting$ | async;
|
|
56
|
+
<h1>You are <span class="your-position">{{ position }}</span> of {{ total }} on the waitlist</h1>
|
|
57
|
+
<p>Thanks for signing up! We're hand-reviewing your response and personally onboarding our first 100 users to ensure that we can give you a delightful experience. We'll be in touch soon 😊</p>
|
|
58
|
+
<p>Also, we haven't had the chance to implement a formal referral system yet, but if you would love to get off the waitlist faster and can help us reach others, email {{ outreachLeadName }} at <a [href]="'mailto:' + outreachLeadEmail">{{ outreachLeadEmail }}</a> and let's talk about getting you early access!</p>
|
|
59
|
+
} @else if (loading()) {
|
|
60
|
+
<div class="loading-container">
|
|
61
|
+
Submitting... <mat-spinner [diameter]="20" [strokeWidth]="2"></mat-spinner>
|
|
62
|
+
</div>
|
|
67
63
|
}
|
|
68
64
|
</div>
|
|
69
65
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.early-access-container {
|
|
2
2
|
align-items: stretch;
|
|
3
3
|
width: 100%;
|
|
4
|
-
height: 100
|
|
4
|
+
height: calc(100% - 70px);
|
|
5
5
|
padding: 50px 100px;
|
|
6
6
|
overflow-y: auto;
|
|
7
7
|
color: #303030;
|
|
@@ -73,13 +73,19 @@
|
|
|
73
73
|
flex-direction: column;
|
|
74
74
|
align-items: flex-start;
|
|
75
75
|
|
|
76
|
+
.checkbox-error {
|
|
77
|
+
font-size: 0.75rem;
|
|
78
|
+
font-weight: 400;
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
.form-field-group {
|
|
77
82
|
display: flex;
|
|
78
83
|
flex-direction: column;
|
|
84
|
+
width: 100%;
|
|
85
|
+
margin-bottom: 20px;
|
|
79
86
|
.checkbox-group {
|
|
80
87
|
display: flex;
|
|
81
88
|
flex-direction: column;
|
|
82
|
-
margin-bottom: 20px;
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
.question {
|
|
@@ -90,6 +96,7 @@
|
|
|
90
96
|
|
|
91
97
|
button {
|
|
92
98
|
cursor: pointer;
|
|
99
|
+
margin-top: 30px;
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
|
|
@@ -7,7 +7,7 @@ import { WaitlistData } from './early-access.model';
|
|
|
7
7
|
import { User, AccessState } from 'src/app/core/store/user/user.model';
|
|
8
8
|
import { UserContext } from 'src/app/core/store/user-context/user-context.model';
|
|
9
9
|
import { Timestamp, serverTimestamp } from 'firebase/firestore';
|
|
10
|
-
import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
10
|
+
import { FormBuilder, Validators, ValidatorFn, ValidationErrors, AbstractControl, FormGroup, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
11
11
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
12
12
|
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
13
13
|
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
@@ -16,8 +16,9 @@ import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
|
|
16
16
|
import { MatInput } from '@angular/material/input';
|
|
17
17
|
import { MatCheckbox } from '@angular/material/checkbox';
|
|
18
18
|
import { NgFor, AsyncPipe } from '@angular/common';
|
|
19
|
-
import { MatLabel, MatFormField, MatHint } from '@angular/material/form-field';
|
|
19
|
+
import { MatLabel, MatFormField, MatError, MatHint } from '@angular/material/form-field';
|
|
20
20
|
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
21
|
+
import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
21
22
|
|
|
22
23
|
@Component({
|
|
23
24
|
selector: 'app-early-access',
|
|
@@ -27,6 +28,7 @@ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch
|
|
|
27
28
|
animations: EarlyAccessAnimations,
|
|
28
29
|
standalone: true,
|
|
29
30
|
imports: [
|
|
31
|
+
NavbarComponent,
|
|
30
32
|
FormsModule,
|
|
31
33
|
MatLabel,
|
|
32
34
|
ReactiveFormsModule,
|
|
@@ -35,6 +37,7 @@ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch
|
|
|
35
37
|
MatFormField,
|
|
36
38
|
MatInput,
|
|
37
39
|
MatHint,
|
|
40
|
+
MatError,
|
|
38
41
|
MatProgressSpinner,
|
|
39
42
|
AsyncPipe,
|
|
40
43
|
],
|
|
@@ -58,27 +61,75 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
58
61
|
AccessState = AccessState;
|
|
59
62
|
|
|
60
63
|
// Template constants
|
|
61
|
-
appName = '
|
|
62
|
-
appArea = '
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
64
|
+
appName = 'APP_NAME [Causeway]';
|
|
65
|
+
appArea = 'APP_AREA [learning web development]';
|
|
66
|
+
outreachLeadName = 'OUTREACH_LEAD_NAME [FirstName LastName]';
|
|
67
|
+
outreachLeadEmail = 'OUTREACH_LEAD_EMAIL [email@ucsc.edu]';
|
|
68
|
+
|
|
69
|
+
/** One checkbox must be selected. If other is selected, the text needs to be filled out */
|
|
70
|
+
oneCheckedValidator: ValidatorFn = (
|
|
71
|
+
form: FormGroup,
|
|
72
|
+
): ValidationErrors | null => {
|
|
73
|
+
const otherText = form.get('backgroundOther').value;
|
|
74
|
+
const selectionsArray = form.get('backgroundSelections') as FormArray;
|
|
75
|
+
const selected = selectionsArray.controls
|
|
76
|
+
.filter((item) => item.value.checked);
|
|
77
|
+
|
|
78
|
+
const needsOtherText = selectionsArray.controls.filter((item) => item.value.fieldName === 'other' && item.value.checked).length > 0 && otherText.trim().length === 0;
|
|
79
|
+
|
|
80
|
+
return selected.length === 0 || needsOtherText ? {
|
|
81
|
+
...(selected.length === 0 ? { noneChecked: true } : {}),
|
|
82
|
+
...(needsOtherText ? { needsOtherText } : {}),
|
|
83
|
+
}: null;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** Form controls for early access survey. */
|
|
87
|
+
backgroundForm = this.form.group({
|
|
88
|
+
desiredValue: ['', Validators.minLength(50)],
|
|
89
|
+
backgroundOther: [{ value: '', disabled: true }, Validators.required],
|
|
90
|
+
backgroundSelections: this.form.array([
|
|
91
|
+
this.form.group({
|
|
92
|
+
fieldName: 'option1',
|
|
93
|
+
label: 'OPTION_1 [Student trying to get hands-on experience]',
|
|
94
|
+
ariaLabel: 'OPTION_1_AREA',
|
|
95
|
+
checked: false,
|
|
96
|
+
}),
|
|
97
|
+
this.form.group({
|
|
98
|
+
fieldName: 'option2',
|
|
99
|
+
label: 'OPTION_2 [Educator exploring new ways to teach]',
|
|
100
|
+
ariaLabel: 'OPTION_2_ARIA',
|
|
101
|
+
checked: false,
|
|
102
|
+
}),
|
|
103
|
+
this.form.group({
|
|
104
|
+
fieldName: 'option3',
|
|
105
|
+
label: 'OPTION_3 [Professional wanting to contribute to a cause]',
|
|
106
|
+
ariaLabel: 'OPTION_3_ARIA',
|
|
107
|
+
checked: false,
|
|
108
|
+
}),
|
|
109
|
+
this.form.group({
|
|
110
|
+
fieldName: 'other',
|
|
111
|
+
label: 'Other (none are a perfect fit)',
|
|
112
|
+
ariaLabel: 'Other',
|
|
113
|
+
checked: false,
|
|
114
|
+
})
|
|
115
|
+
])
|
|
116
|
+
}, { validators: this.oneCheckedValidator });
|
|
117
|
+
|
|
118
|
+
/** Convenience getter for desiredValue. */
|
|
119
|
+
get desiredValue() {
|
|
120
|
+
return this.backgroundForm.get('desiredValue');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Convenience getter for backgroundOther. */
|
|
124
|
+
get backgroundOther() {
|
|
125
|
+
return this.backgroundForm.get('backgroundOther');
|
|
126
|
+
}
|
|
81
127
|
|
|
128
|
+
/** Getter for backgroundSelections form array with a type for use of controls. */
|
|
129
|
+
get backgroundSelections() {
|
|
130
|
+
return this.backgroundForm.get('backgroundSelections') as FormArray;
|
|
131
|
+
}
|
|
132
|
+
|
|
82
133
|
// --------------- COMPUTED DATA -----------------------
|
|
83
134
|
|
|
84
135
|
/** Waitlist data from app-state, user, and user-context. */
|
|
@@ -122,57 +173,66 @@ export class EarlyAccessComponent implements OnInit {
|
|
|
122
173
|
|
|
123
174
|
/** Get all options that were selected. */
|
|
124
175
|
getSelections(): string[] {
|
|
125
|
-
return
|
|
176
|
+
return this.backgroundSelections.controls
|
|
177
|
+
.filter((item) => item.value.checked)
|
|
178
|
+
.map((item) => item.value.fieldName);
|
|
126
179
|
}
|
|
127
180
|
|
|
128
181
|
// --------------- EVENT HANDLING ----------------------
|
|
129
182
|
|
|
130
|
-
/**
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
...(this.backgroundOther ? { other: this.backgroundOther } : { }),
|
|
142
|
-
},
|
|
143
|
-
desiredValue: this.desiredValue,
|
|
144
|
-
});
|
|
145
|
-
} else {
|
|
146
|
-
this.userContextStore.add({
|
|
147
|
-
__userId: this.waitlistData().currentUser.__id,
|
|
148
|
-
background: {
|
|
149
|
-
selections: this.getSelections(),
|
|
150
|
-
...(this.backgroundOther ? { other: this.backgroundOther } : { }),
|
|
151
|
-
},
|
|
152
|
-
desiredValue: this.desiredValue,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
} catch (e) {
|
|
156
|
-
console.error(e);
|
|
157
|
-
this.snackBar.open('Failed to submit response', '', { duration: 3000 });
|
|
183
|
+
/**
|
|
184
|
+
* Enable and disable the backgroundOther text input depending on if other is checked.
|
|
185
|
+
* It is important that the form model is the source of truth not the template, so if we want
|
|
186
|
+
* the validation to go away when the input is no longer needed, it needs to be disabled on the model
|
|
187
|
+
* rather than just hidden from the view.
|
|
188
|
+
*/
|
|
189
|
+
check(item) {
|
|
190
|
+
if (item.value.fieldName === 'other' && item.value.checked) {
|
|
191
|
+
this.backgroundForm.controls.backgroundOther.enable();
|
|
192
|
+
} else if (item.value.fieldName === 'other' && !item.value.checked) {
|
|
193
|
+
this.backgroundForm.controls.backgroundOther.disable();
|
|
158
194
|
}
|
|
159
195
|
}
|
|
160
196
|
|
|
161
|
-
/** Submit
|
|
162
|
-
async
|
|
197
|
+
/** Submit background and interests. */
|
|
198
|
+
async submitInterest() {
|
|
163
199
|
try {
|
|
164
|
-
await this.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
200
|
+
await this.batch.batchWrite(async (batchConfig) => {
|
|
201
|
+
await this.userStore.update(this.waitlistData().currentUser.__id, {
|
|
202
|
+
accessState: AccessState.WAITING,
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
204
|
+
joinedWaitlistAt: Timestamp.now(),
|
|
205
|
+
}, { batchConfig });
|
|
206
|
+
|
|
207
|
+
if (this.waitlistData().userContext) {
|
|
208
|
+
this.userContextStore.update(this.waitlistData().userContext.__id, {
|
|
209
|
+
background: {
|
|
210
|
+
selections: this.getSelections(),
|
|
211
|
+
...(this.backgroundOther.value ? { other: this.backgroundOther.value } : { }),
|
|
212
|
+
},
|
|
213
|
+
desiredValue: this.desiredValue.value,
|
|
214
|
+
}, { batchConfig });
|
|
215
|
+
} else {
|
|
216
|
+
this.userContextStore.add({
|
|
217
|
+
__userId: this.waitlistData().currentUser.__id,
|
|
218
|
+
background: {
|
|
219
|
+
selections: this.getSelections(),
|
|
220
|
+
...(this.backgroundOther.value ? { other: this.backgroundOther.value } : { }),
|
|
221
|
+
},
|
|
222
|
+
desiredValue: this.desiredValue.value,
|
|
223
|
+
}, { batchConfig });
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
loading: this.loading,
|
|
227
|
+
snackBarConfig: {
|
|
228
|
+
successMessage: 'Submitted interest form!',
|
|
229
|
+
failureMessage: 'Failed to submit response',
|
|
230
|
+
undoOnAction: true,
|
|
231
|
+
config: { duration: 3000 },
|
|
232
|
+
},
|
|
172
233
|
});
|
|
173
234
|
} catch (e) {
|
|
174
235
|
console.error(e);
|
|
175
|
-
this.snackBar.open('Failed to submit response', '', { duration: 3000 });
|
|
176
236
|
}
|
|
177
237
|
}
|
|
178
238
|
|
|
@@ -3,6 +3,7 @@ import { HomeAnimations } from './home.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
5
|
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
6
|
+
import { NavbarComponent } from 'src/app/shared/navbar/navbar.component';
|
|
6
7
|
|
|
7
8
|
@Component({
|
|
8
9
|
selector: 'app-home',
|
|
@@ -11,6 +12,9 @@ import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch
|
|
|
11
12
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
13
|
standalone: true,
|
|
13
14
|
animations: HomeAnimations,
|
|
15
|
+
imports: [
|
|
16
|
+
NavbarComponent,
|
|
17
|
+
]
|
|
14
18
|
})
|
|
15
19
|
export class HomeComponent implements OnInit {
|
|
16
20
|
authStore = inject(AuthStore);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
height: 70px;
|
|
3
3
|
width: 100%;
|
|
4
4
|
background: #FFFFFF;
|
|
5
|
-
box-shadow: -4px
|
|
5
|
+
box-shadow: -4px 3px 10px rgba(200, 224, 212, 0.25);
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: row;
|
|
8
8
|
align-items: center; // Center items vertically
|
|
@@ -33,10 +33,8 @@
|
|
|
33
33
|
.logout {
|
|
34
34
|
display: flex;
|
|
35
35
|
align-items: center;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
font-size: 20px;
|
|
39
|
-
font-weight: 300;
|
|
36
|
+
font-size: 16px;
|
|
37
|
+
font-weight: 400;
|
|
40
38
|
cursor: pointer;
|
|
41
39
|
padding: 10px;
|
|
42
40
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="warning-container">
|
|
3
3
|
<div class="header">
|
|
4
4
|
<div class="title">This version is out of date!</div>
|
|
5
|
-
<img (click)="close()" src="/
|
|
5
|
+
<img (click)="close()" src="images/close-x.svg" />
|
|
6
6
|
</div>
|
|
7
7
|
<button (click)="update()" class="update">Update Now</button>
|
|
8
8
|
</div>
|
|
File without changes
|