@tech4good/angular-schematics 17.0.4 → 18.0.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/README.md +8 -0
- package/package.json +4 -4
- package/src/collection.json +0 -16
- package/src/component/files/__name@dasherize__/__name@dasherize__.component.ts.template +22 -8
- package/src/component/index.js +2 -45
- package/src/component/index.js.map +1 -1
- package/src/component/schema.json +0 -5
- package/src/entity/files/__name@dasherize__/__name@dasherize__.mock.ts.template +12 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.model.ts.template +1 -0
- package/src/entity/files/__name@dasherize__/__name@dasherize__.store.ts.template +41 -0
- package/src/entity/index.js +29 -50
- package/src/entity/index.js.map +1 -1
- package/src/init/files/.firebaserc.template +8 -0
- package/src/init/files/README.md.template +6 -6
- package/src/init/files/angular.json.template +18 -11
- package/src/init/files/package.json.template +29 -30
- package/src/init/files/src/app/admin/{waitlist/waitlist.animations.ts.template → admin-panel/admin-panel.animations.ts.template} +1 -1
- package/src/init/files/src/app/admin/{waitlist/waitlist.component.html.template → admin-panel/admin-panel.component.html.template} +3 -3
- package/src/init/files/src/app/admin/{waitlist/waitlist.component.scss.template → admin-panel/admin-panel.component.scss.template} +1 -1
- package/src/init/files/src/app/admin/admin-panel/admin-panel.component.spec.ts.template +25 -0
- package/src/init/files/src/app/admin/admin-panel/admin-panel.component.ts.template +99 -0
- package/src/init/files/src/app/app.component.html.template +1 -0
- package/src/init/files/src/app/app.component.ts.template +14 -8
- package/src/init/files/src/app/app.config.ts.template +63 -0
- package/src/init/files/src/app/app.routes.ts.template +32 -0
- package/src/init/files/src/app/core/analytics/log.service.ts.template +122 -89
- package/src/init/files/src/app/core/analytics/time-analytics.service.ts.template +9 -17
- package/src/init/files/src/app/core/auth/auth.guard.ts.template +25 -22
- package/src/init/files/src/app/core/firebase/cached-listeners.service.ts.template +291 -0
- package/src/init/files/src/app/core/firebase/database.service.ts.template +56 -0
- package/src/init/files/src/app/core/firebase/firebase.mock.service.ts.template +276 -0
- package/src/init/files/src/app/core/firebase/firebase.service.ts.template +265 -215
- package/src/init/files/src/app/core/local-storage/session.service.ts.template +3 -4
- package/src/init/files/src/app/core/store/app.model.ts.template +19 -0
- package/src/init/files/src/app/core/store/app.store.ts.template +1074 -0
- package/src/init/files/src/app/core/store/auth/auth.mock.ts.template +20 -0
- package/src/init/files/src/app/core/store/auth/auth.store.ts.template +136 -0
- package/src/init/files/src/app/core/store/batch-write.firebase.service.ts.template +58 -0
- package/src/init/files/src/app/core/store/batch-write.mock.service.ts.template +105 -0
- package/src/init/files/src/app/core/store/batch-write.service.ts.template +126 -0
- package/src/init/files/src/app/core/store/user/user.mock.ts.template +24 -0
- package/src/init/files/src/app/core/store/user/user.model.ts.template +1 -1
- package/src/init/files/src/app/core/store/user/user.store.ts.template +41 -0
- package/src/init/files/src/app/core/store/user-context/user-context.mock.ts.template +24 -0
- package/src/init/files/src/app/core/store/user-context/user-context.model.ts.template +1 -0
- package/src/init/files/src/app/core/store/user-context/user-context.store.ts.template +41 -0
- package/src/init/files/src/app/core/utils/rand.utils.ts.template +13 -0
- package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.html.template +8 -13
- package/src/init/files/src/app/first-time/consent/consent.component.ts.template +90 -0
- package/src/init/files/src/app/first-time/early-access/early-access.animations.ts.template +4 -0
- package/src/init/files/src/app/first-time/early-access/early-access.component.html.template +69 -0
- package/src/init/files/src/app/{onboarding/waiting/waiting.component.scss.template → first-time/early-access/early-access.component.scss.template} +1 -1
- package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template +25 -0
- package/src/init/files/src/app/first-time/early-access/early-access.component.ts.template +194 -0
- package/src/init/files/src/app/first-time/early-access/early-access.model.ts.template +7 -0
- package/src/init/files/src/app/{general → first-time}/landing/landing.component.html.template +1 -1
- package/src/init/files/src/app/first-time/landing/landing.component.ts.template +44 -0
- package/src/init/files/src/app/first-time/login/login.component.html.template +10 -0
- package/src/init/files/src/app/first-time/login/login.component.ts.template +45 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.animations.ts.template +4 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.html.template +2 -0
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.scss.template +5 -0
- package/src/init/files/src/app/{admin/waitlist/waitlist.component.spec.ts.template → first-time/onboarding/onboarding.component.spec.ts.template} +6 -6
- package/src/init/files/src/app/first-time/onboarding/onboarding.component.ts.template +41 -0
- package/src/init/files/src/app/main/home/home.component.html.template +5 -0
- package/src/init/files/src/app/main/home/home.component.ts.template +51 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.html.template +15 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.scss.template +43 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.spec.ts.template +25 -0
- package/src/init/files/src/app/shared/navbar/navbar.component.ts.template +40 -0
- package/src/init/files/src/app/shared/redeployment-warning/redeployment-warning.component.html.template +9 -0
- package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.ts.template +17 -6
- package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.service.ts.template +2 -2
- package/src/init/files/src/assets/images/close-x.svg +3 -0
- package/src/init/files/src/environments/environment.ts.template +1 -0
- package/src/init/files/src/index.html.template +1 -1
- package/src/init/files/tsconfig.json.template +0 -1
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.actions.ts.template +0 -26
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.effects.ts.template +0 -48
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.model.ts.template +0 -0
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.selectors.ts.template +0 -20
- package/src/container/files/__name@dasherize__/+state/__name@dasherize__.state.ts.template +0 -13
- package/src/container/files/__name@dasherize__/__name@dasherize__.animations.ts.template +0 -4
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.html.template +0 -3
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.scss.template +0 -5
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.spec.ts.template +0 -25
- package/src/container/files/__name@dasherize__/__name@dasherize__.component.ts.template +0 -90
- package/src/container/index.d.ts +0 -2
- package/src/container/index.js +0 -127
- package/src/container/index.js.map +0 -1
- package/src/container/index_spec.d.ts +0 -1
- package/src/container/index_spec.js +0 -23
- package/src/container/index_spec.js.map +0 -1
- package/src/container/schema.json +0 -50
- package/src/entity/files/__name@dasherize__/__name@dasherize__.actions.ts.template +0 -249
- package/src/entity/files/__name@dasherize__/__name@dasherize__.effects.ts.template +0 -131
- package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +0 -13
- package/src/entity/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +0 -51
- package/src/entity/files/__name@dasherize__/__name@dasherize__.service.ts.template +0 -50
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.actions.ts.template +0 -270
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.effects.ts.template +0 -131
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.model.ts.template +0 -3
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.spec.ts.template +0 -13
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.reducer.ts.template +0 -51
- package/src/entity-in-example/files/__name@dasherize__/__name@dasherize__.service.ts.template +0 -50
- package/src/entity-in-example/index.d.ts +0 -2
- package/src/entity-in-example/index.js +0 -141
- package/src/entity-in-example/index.js.map +0 -1
- package/src/entity-in-example/index_spec.d.ts +0 -1
- package/src/entity-in-example/index_spec.js +0 -23
- package/src/entity-in-example/index_spec.js.map +0 -1
- package/src/entity-in-example/schema.json +0 -45
- package/src/init/files/CHANGELOG.md.template +0 -10
- package/src/init/files/src/app/admin/admin-routing.module.ts.template +0 -17
- package/src/init/files/src/app/admin/admin.module.spec.ts.template +0 -13
- package/src/init/files/src/app/admin/admin.module.ts.template +0 -28
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.actions.ts.template +0 -23
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.effects.ts.template +0 -50
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.model.ts.template +0 -0
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.selectors.ts.template +0 -39
- package/src/init/files/src/app/admin/waitlist/+state/waitlist.state.ts.template +0 -13
- package/src/init/files/src/app/admin/waitlist/waitlist.component.ts.template +0 -141
- package/src/init/files/src/app/app-routing.module.ts.template +0 -26
- package/src/init/files/src/app/app.module.ts.template +0 -34
- package/src/init/files/src/app/core/core.module.ts.template +0 -75
- package/src/init/files/src/app/core/setup/firebase-setup.ts.template +0 -25
- package/src/init/files/src/app/core/setup/module-import-guard.ts.template +0 -5
- package/src/init/files/src/app/core/snackbar/snackbar.actions.ts.template +0 -24
- package/src/init/files/src/app/core/snackbar/snackbar.effects.ts.template +0 -41
- package/src/init/files/src/app/core/store/app-state/app-state.actions.ts.template +0 -249
- package/src/init/files/src/app/core/store/app-state/app-state.effects.ts.template +0 -131
- package/src/init/files/src/app/core/store/app-state/app-state.model.ts.template +0 -8
- package/src/init/files/src/app/core/store/app-state/app-state.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/app-state/app-state.reducer.ts.template +0 -51
- package/src/init/files/src/app/core/store/app-state/app-state.service.ts.template +0 -50
- package/src/init/files/src/app/core/store/app.actions.ts.template +0 -92
- package/src/init/files/src/app/core/store/app.effects.ts.template +0 -175
- package/src/init/files/src/app/core/store/app.reducer.ts.template +0 -36
- package/src/init/files/src/app/core/store/app.selectors.ts.template +0 -42
- package/src/init/files/src/app/core/store/auth/auth.actions.ts.template +0 -77
- package/src/init/files/src/app/core/store/auth/auth.effects.ts.template +0 -163
- package/src/init/files/src/app/core/store/auth/auth.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/auth/auth.reducer.ts.template +0 -26
- package/src/init/files/src/app/core/store/auth/auth.selectors.ts.template +0 -25
- package/src/init/files/src/app/core/store/cached-load-connections.service.ts.template +0 -405
- package/src/init/files/src/app/core/store/cached-selectors.service.ts.template +0 -376
- package/src/init/files/src/app/core/store/effects.helpers.ts.template +0 -66
- package/src/init/files/src/app/core/store/user/user.actions.ts.template +0 -248
- package/src/init/files/src/app/core/store/user/user.effects.ts.template +0 -148
- package/src/init/files/src/app/core/store/user/user.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/user/user.reducer.ts.template +0 -50
- package/src/init/files/src/app/core/store/user/user.service.ts.template +0 -50
- package/src/init/files/src/app/core/store/user-context/user-context.actions.ts.template +0 -248
- package/src/init/files/src/app/core/store/user-context/user-context.effects.ts.template +0 -131
- package/src/init/files/src/app/core/store/user-context/user-context.reducer.spec.ts.template +0 -13
- package/src/init/files/src/app/core/store/user-context/user-context.reducer.ts.template +0 -51
- package/src/init/files/src/app/core/store/user-context/user-context.service.ts.template +0 -50
- package/src/init/files/src/app/core/utils/string-case.utils.ts.template +0 -96
- package/src/init/files/src/app/general/general-routing.module.ts.template +0 -25
- package/src/init/files/src/app/general/general.module.spec.ts.template +0 -13
- package/src/init/files/src/app/general/general.module.ts.template +0 -36
- package/src/init/files/src/app/general/home/+state/home.actions.ts.template +0 -26
- package/src/init/files/src/app/general/home/+state/home.effects.ts.template +0 -48
- package/src/init/files/src/app/general/home/+state/home.model.ts.template +0 -0
- package/src/init/files/src/app/general/home/+state/home.selectors.ts.template +0 -20
- package/src/init/files/src/app/general/home/+state/home.state.ts.template +0 -13
- package/src/init/files/src/app/general/home/home.component.html.template +0 -5
- package/src/init/files/src/app/general/home/home.component.ts.template +0 -88
- package/src/init/files/src/app/general/landing/+state/landing.actions.ts.template +0 -26
- package/src/init/files/src/app/general/landing/+state/landing.effects.ts.template +0 -48
- package/src/init/files/src/app/general/landing/+state/landing.model.ts.template +0 -0
- package/src/init/files/src/app/general/landing/+state/landing.selectors.ts.template +0 -20
- package/src/init/files/src/app/general/landing/+state/landing.state.ts.template +0 -13
- package/src/init/files/src/app/general/landing/landing.component.ts.template +0 -98
- package/src/init/files/src/app/general/login/login.component.html.template +0 -11
- package/src/init/files/src/app/general/login/login.component.ts.template +0 -80
- package/src/init/files/src/app/onboarding/consent/+state/consent.actions.ts.template +0 -23
- package/src/init/files/src/app/onboarding/consent/+state/consent.effects.ts.template +0 -47
- package/src/init/files/src/app/onboarding/consent/+state/consent.model.ts.template +0 -0
- package/src/init/files/src/app/onboarding/consent/+state/consent.selectors.ts.template +0 -20
- package/src/init/files/src/app/onboarding/consent/+state/consent.state.ts.template +0 -13
- package/src/init/files/src/app/onboarding/consent/consent.component.ts.template +0 -151
- package/src/init/files/src/app/onboarding/onboarding-routing.module.ts.template +0 -19
- package/src/init/files/src/app/onboarding/onboarding.module.spec.ts.template +0 -13
- package/src/init/files/src/app/onboarding/onboarding.module.ts.template +0 -32
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.actions.ts.template +0 -26
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.effects.ts.template +0 -52
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.model.ts.template +0 -9
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.selectors.ts.template +0 -42
- package/src/init/files/src/app/onboarding/waiting/+state/waiting.state.ts.template +0 -13
- package/src/init/files/src/app/onboarding/waiting/waiting.animations.ts.template +0 -4
- package/src/init/files/src/app/onboarding/waiting/waiting.component.html.template +0 -57
- package/src/init/files/src/app/onboarding/waiting/waiting.component.spec.ts.template +0 -25
- package/src/init/files/src/app/onboarding/waiting/waiting.component.ts.template +0 -281
- package/src/init/files/src/app/shared/components/redeployment-warning/redeployment-warning.component.html.template +0 -10
- package/src/init/files/src/app/shared/shared.module.ts.template +0 -87
- package/src/init/files/src/main.ts.template +0 -12
- package/src/module/files/__name@dasherize__/__name@dasherize__-routing.module.ts.template +0 -15
- package/src/module/files/__name@dasherize__/__name@dasherize__.module.spec.ts.template +0 -13
- package/src/module/files/__name@dasherize__/__name@dasherize__.module.ts.template +0 -24
- package/src/module/index.d.ts +0 -2
- package/src/module/index.js +0 -97
- package/src/module/index.js.map +0 -1
- package/src/module/index_spec.d.ts +0 -1
- package/src/module/index_spec.js +0 -23
- package/src/module/index_spec.js.map +0 -1
- package/src/module/schema.json +0 -38
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.animations.ts.template +0 -0
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.scss.template +0 -0
- /package/src/init/files/src/app/{onboarding → first-time}/consent/consent.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.animations.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/landing/landing.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/login/login.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → first-time}/login/login.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.animations.ts.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.component.scss.template +0 -0
- /package/src/init/files/src/app/{general → main}/home/home.component.spec.ts.template +0 -0
- /package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.scss.template +0 -0
- /package/src/init/files/src/app/shared/{components/redeployment-warning → redeployment-warning}/redeployment-warning.component.spec.ts.template +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
|
|
2
|
+
import { ConsentAnimations } from './consent.animations';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
import { User, AccessState } from 'src/app/core/store/user/user.model';
|
|
5
|
+
import { Location } from '@angular/common';
|
|
6
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
7
|
+
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
8
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
9
|
+
import { MatCheckbox } from '@angular/material/checkbox';
|
|
10
|
+
import { FormsModule } from '@angular/forms';
|
|
11
|
+
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'app-consent',
|
|
15
|
+
templateUrl: './consent.component.html',
|
|
16
|
+
styleUrls: ['./consent.component.scss'],
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
+
animations: ConsentAnimations,
|
|
19
|
+
standalone: true,
|
|
20
|
+
imports: [
|
|
21
|
+
FormsModule,
|
|
22
|
+
MatCheckbox,
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
export class ConsentComponent implements OnInit {
|
|
26
|
+
readonly authStore = inject(AuthStore);
|
|
27
|
+
readonly userStore = inject(UserStore);
|
|
28
|
+
|
|
29
|
+
// --------------- INPUTS AND OUTPUTS ------------------
|
|
30
|
+
|
|
31
|
+
/** The current signed in user. */
|
|
32
|
+
currentUser: Signal<User> = this.authStore.user;
|
|
33
|
+
|
|
34
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
35
|
+
|
|
36
|
+
/** Constants for onboarding templates. */
|
|
37
|
+
appName = 'Compass';
|
|
38
|
+
shortProdDesc = 'provides users with support for setting goals, reflecting on how short-term goals connect to long-term ones, and in the future, for obtaining career mentorship';
|
|
39
|
+
shortResearchDesc = 'how to support goal setting and career mentorship';
|
|
40
|
+
authAppName = 'Google';
|
|
41
|
+
protocolNumber = 'PROTOCOL_NO';
|
|
42
|
+
protocolTitle = 'PROTOCOL_TITLE';
|
|
43
|
+
usageDataProductDesc = 'help users set and reflect on goals. When you participate in mentorship cohorts, the goals you specify will be shared with the mentor';
|
|
44
|
+
usageDataResearchDesc = 'how to better support goal setting and career mentorship';
|
|
45
|
+
studyDoingDesc = 'When you participate in our study, you will use our platform to set and reflect on goals, and participate in mentorship cohorts. You will also fill out a survey on your experience, and optionally, participate in a follow-up interview';
|
|
46
|
+
benefitsDesc = 'to engage in intentional goal setting';
|
|
47
|
+
investigatorInfo = '[FirstName LastName, co-Principal Investigator, email@ucsc.edu]';
|
|
48
|
+
facultyInfo = 'David T. Lee, dlee105@ucsc.edu';
|
|
49
|
+
|
|
50
|
+
/** Checkbox state used in form. */
|
|
51
|
+
checked: boolean;
|
|
52
|
+
|
|
53
|
+
/** Consent url. */
|
|
54
|
+
consentUrl;
|
|
55
|
+
|
|
56
|
+
// --------------- COMPUTED DATA -----------------------
|
|
57
|
+
|
|
58
|
+
// --------------- EVENT HANDLING ----------------------
|
|
59
|
+
|
|
60
|
+
/** Submit the consent form. */
|
|
61
|
+
async submit() {
|
|
62
|
+
try {
|
|
63
|
+
await this.userStore.update(this.currentUser().__id, {
|
|
64
|
+
accessState: AccessState.SUBMIT_INTEREST,
|
|
65
|
+
consented: true,
|
|
66
|
+
});
|
|
67
|
+
this.router.navigate(['/early-access']);
|
|
68
|
+
} catch (e) {
|
|
69
|
+
console.error(e);
|
|
70
|
+
this.snackBar.open('Failed to update consent status', '', { duration: 3000 });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// --------------- OTHER -------------------------------
|
|
75
|
+
|
|
76
|
+
constructor(
|
|
77
|
+
private router: Router,
|
|
78
|
+
private snackBar: MatSnackBar,
|
|
79
|
+
private location: Location,
|
|
80
|
+
@Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
|
|
81
|
+
private injector: Injector,
|
|
82
|
+
) {
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// --------------- LOAD AND CLEANUP --------------------
|
|
86
|
+
|
|
87
|
+
ngOnInit() {
|
|
88
|
+
this.consentUrl = location.origin + '/' + this.location.prepareExternalUrl('consent');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
@if (waitlistData(); as data) {
|
|
2
|
+
<div class="early-access-container">
|
|
3
|
+
@if ({ loading: loading() }; as state) {
|
|
4
|
+
<!-- Core questions on motivation and desired value -->
|
|
5
|
+
@if (data.currentUser.accessState === AccessState.SUBMIT_INTEREST && !state.loading) {
|
|
6
|
+
<h1>Hello and Welcome!</h1>
|
|
7
|
+
<form #checkForm="ngForm" (ngSubmit)="submitInterest()">
|
|
8
|
+
<div class="form-field-group">
|
|
9
|
+
<mat-label class="question">Which of the following best describe your background and interest in {{ appName }}?</mat-label>
|
|
10
|
+
<div class="checkbox-group" [formGroup]="backgroundSelections">
|
|
11
|
+
<mat-checkbox [formControlName]="option.fieldName" [aria-label]="option.ariaLabel" *ngFor="let option of backgroundAndInterestsOptions">{{ option.label }}</mat-checkbox>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
@if (backgroundSelections.value.other) {
|
|
15
|
+
<div class="form-field-group" [formGroup]="backgroundSelections">
|
|
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
|
+
}
|
|
23
|
+
<div class="form-field-group">
|
|
24
|
+
<mat-label class="question">What do you hope to experience or get out of an application for {{ appArea }}?</mat-label>
|
|
25
|
+
<mat-form-field class="desired-value" appearance="fill">
|
|
26
|
+
<mat-label>Your ideal experience or outcomes</mat-label>
|
|
27
|
+
<textarea #text matInput [(ngModel)]="desiredValue" name="desiredValue" required></textarea>
|
|
28
|
+
@if (text.value?.length < 100) {
|
|
29
|
+
<mat-hint>You've shared {{text.value?.length || 0}} characters. If you could say a little more and explain why, that'd be helpful! 🙏</mat-hint>
|
|
30
|
+
}
|
|
31
|
+
</mat-form-field>
|
|
32
|
+
</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
|
+
}
|
|
61
|
+
}
|
|
62
|
+
@if (state.loading) {
|
|
63
|
+
<div class="loading-container">
|
|
64
|
+
Submitting... <mat-spinner [diameter]="20" [strokeWidth]="2"></mat-spinner>
|
|
65
|
+
</div>
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</div>
|
|
69
|
+
}
|
package/src/init/files/src/app/first-time/early-access/early-access.component.spec.ts.template
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { EarlyAccessComponent } from './early-access.component';
|
|
4
|
+
|
|
5
|
+
describe('EarlyAccessComponent', () => {
|
|
6
|
+
let component: EarlyAccessComponent;
|
|
7
|
+
let fixture: ComponentFixture<EarlyAccessComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(waitForAsync(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [EarlyAccessComponent],
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(EarlyAccessComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, computed, Inject, input, output, inject, signal, WritableSignal, Signal, Injector } from '@angular/core';
|
|
2
|
+
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { filter, mergeMap } from 'rxjs/operators';
|
|
5
|
+
import { EarlyAccessAnimations } from './early-access.animations';
|
|
6
|
+
import { WaitlistData } from './early-access.model';
|
|
7
|
+
import { User, AccessState } from 'src/app/core/store/user/user.model';
|
|
8
|
+
import { UserContext } from 'src/app/core/store/user-context/user-context.model';
|
|
9
|
+
import { Timestamp, serverTimestamp } from 'firebase/firestore';
|
|
10
|
+
import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
11
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
12
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
13
|
+
import { UserStore } from 'src/app/core/store/user/user.store';
|
|
14
|
+
import { UserContextStore } from 'src/app/core/store/user-context/user-context.store';
|
|
15
|
+
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
|
16
|
+
import { MatInput } from '@angular/material/input';
|
|
17
|
+
import { MatCheckbox } from '@angular/material/checkbox';
|
|
18
|
+
import { NgFor, AsyncPipe } from '@angular/common';
|
|
19
|
+
import { MatLabel, MatFormField, MatHint } from '@angular/material/form-field';
|
|
20
|
+
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'app-early-access',
|
|
24
|
+
templateUrl: './early-access.component.html',
|
|
25
|
+
styleUrls: ['./early-access.component.scss'],
|
|
26
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
27
|
+
animations: EarlyAccessAnimations,
|
|
28
|
+
standalone: true,
|
|
29
|
+
imports: [
|
|
30
|
+
FormsModule,
|
|
31
|
+
MatLabel,
|
|
32
|
+
ReactiveFormsModule,
|
|
33
|
+
NgFor,
|
|
34
|
+
MatCheckbox,
|
|
35
|
+
MatFormField,
|
|
36
|
+
MatInput,
|
|
37
|
+
MatHint,
|
|
38
|
+
MatProgressSpinner,
|
|
39
|
+
AsyncPipe,
|
|
40
|
+
],
|
|
41
|
+
})
|
|
42
|
+
export class EarlyAccessComponent implements OnInit {
|
|
43
|
+
readonly authStore = inject(AuthStore);
|
|
44
|
+
readonly userStore = inject(UserStore);
|
|
45
|
+
readonly userContextStore = inject(UserContextStore);
|
|
46
|
+
|
|
47
|
+
// --------------- INPUTS AND OUTPUTS ------------------
|
|
48
|
+
|
|
49
|
+
/** The current signed in user. */
|
|
50
|
+
currentUser: Signal<User> = this.authStore.user;
|
|
51
|
+
|
|
52
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
53
|
+
|
|
54
|
+
/** Loading indicator. */
|
|
55
|
+
loading: WritableSignal<boolean> = signal(false);
|
|
56
|
+
|
|
57
|
+
// this allows the template to use the enum
|
|
58
|
+
AccessState = AccessState;
|
|
59
|
+
|
|
60
|
+
// Template constants
|
|
61
|
+
appName = 'Compass';
|
|
62
|
+
appArea = 'goal setting';
|
|
63
|
+
backgroundAndInterestsOptions = [
|
|
64
|
+
{ fieldName: 'option1', label: 'Student', ariaLabel: 'OPTION_1_ARIA' },
|
|
65
|
+
{ fieldName: 'option2', label: 'Professional', ariaLabel: 'OPTION_2_ARIA' },
|
|
66
|
+
{ fieldName: 'option3', label: 'Homemaker', ariaLabel: 'OPTION_3_ARIA' },
|
|
67
|
+
{ fieldName: 'other', label: 'Other (none are a perfect fit)', ariaLabel: 'Other' },
|
|
68
|
+
];
|
|
69
|
+
outreachLeadName = 'David Lee';
|
|
70
|
+
outreachLeadEmail = 'dlee105@ucsc.edu';
|
|
71
|
+
|
|
72
|
+
// Form variables
|
|
73
|
+
desiredValue = '';
|
|
74
|
+
backgroundOther = '';
|
|
75
|
+
backgroundSelections = this.form.group({
|
|
76
|
+
option1: false,
|
|
77
|
+
option2: false,
|
|
78
|
+
option3: false,
|
|
79
|
+
other: false,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// --------------- COMPUTED DATA -----------------------
|
|
83
|
+
|
|
84
|
+
/** Waitlist data from app-state, user, and user-context. */
|
|
85
|
+
waitlistData: Signal<WaitlistData> = computed(() => {
|
|
86
|
+
const userContext = this.userContextStore.selectFirst([['__userId', '==', this.currentUser().__id]], {});
|
|
87
|
+
return { currentUser: this.currentUser(), userContext };
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
/** Waiting position number. */
|
|
91
|
+
positionText$: Observable<string> = toObservable(this.currentUser).pipe(
|
|
92
|
+
filter((user: User) => !!user.joinedWaitlistAt),
|
|
93
|
+
mergeMap(async (user) => {
|
|
94
|
+
const posNum = await this.userStore.count([
|
|
95
|
+
['joinedWaitlistAt', '<=', user.joinedWaitlistAt],
|
|
96
|
+
['accessState', '<', AccessState.DONE],
|
|
97
|
+
], {});
|
|
98
|
+
return this.nth(posNum);
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
/** Waiting position number. */
|
|
103
|
+
totalWaiting$: Observable<string> = toObservable(this.currentUser).pipe(
|
|
104
|
+
filter((user: User) => !!user.joinedWaitlistAt),
|
|
105
|
+
mergeMap(async (user) => {
|
|
106
|
+
const total = await this.userStore.count([
|
|
107
|
+
['accessState', '<', AccessState.DONE],
|
|
108
|
+
], {});
|
|
109
|
+
return `${total}`;
|
|
110
|
+
}),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
/** Function for adding the appropriate suffix. */
|
|
114
|
+
nth(n: number): string {
|
|
115
|
+
switch (n % 10) {
|
|
116
|
+
case 1: return `${n}st`;
|
|
117
|
+
case 2: return `${n}nd`;
|
|
118
|
+
case 3: return `${n}rd`;
|
|
119
|
+
default: return `${n}th`;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Get all options that were selected. */
|
|
124
|
+
getSelections(): string[] {
|
|
125
|
+
return Object.keys(this.backgroundSelections.value).filter((key) => this.backgroundSelections.value[key]);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// --------------- EVENT HANDLING ----------------------
|
|
129
|
+
|
|
130
|
+
/** Submit background and interests. */
|
|
131
|
+
async submitInterest() {
|
|
132
|
+
try {
|
|
133
|
+
await this.userStore.update(this.waitlistData().currentUser.__id, {
|
|
134
|
+
accessState: AccessState.SUBMIT_DETAILED,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
if (this.waitlistData().userContext) {
|
|
138
|
+
this.userContextStore.update(this.waitlistData().userContext.__id, {
|
|
139
|
+
background: {
|
|
140
|
+
selections: this.getSelections(),
|
|
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 });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Submit detailed information. */
|
|
162
|
+
async submitDetailed() {
|
|
163
|
+
try {
|
|
164
|
+
await this.userStore.update(this.waitlistData().currentUser.__id, {
|
|
165
|
+
accessState: AccessState.WAITING,
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
|
+
joinedWaitlistAt: serverTimestamp() as any,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
this.userContextStore.update(this.waitlistData().userContext.__id, {
|
|
171
|
+
// Add relevant fields from detailed responses
|
|
172
|
+
});
|
|
173
|
+
} catch (e) {
|
|
174
|
+
console.error(e);
|
|
175
|
+
this.snackBar.open('Failed to submit response', '', { duration: 3000 });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// --------------- OTHER -------------------------------
|
|
180
|
+
|
|
181
|
+
constructor(
|
|
182
|
+
private snackBar: MatSnackBar,
|
|
183
|
+
private form: FormBuilder,
|
|
184
|
+
@Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
|
|
185
|
+
private injector: Injector,
|
|
186
|
+
) {
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// --------------- LOAD AND CLEANUP --------------------
|
|
190
|
+
|
|
191
|
+
ngOnInit() {
|
|
192
|
+
this.userContextStore.load([['__userId', '==', this.currentUser().__id]], {});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component, OnInit, ChangeDetectionStrategy, inject, Signal, Injector } from '@angular/core';
|
|
2
|
+
import { LandingAnimations } from './landing.animations';
|
|
3
|
+
import { User } from 'src/app/core/store/user/user.model';
|
|
4
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-landing',
|
|
8
|
+
templateUrl: './landing.component.html',
|
|
9
|
+
styleUrls: ['./landing.component.scss'],
|
|
10
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
11
|
+
animations: LandingAnimations,
|
|
12
|
+
standalone: true,
|
|
13
|
+
})
|
|
14
|
+
export class LandingComponent implements OnInit {
|
|
15
|
+
readonly authStore = inject(AuthStore);
|
|
16
|
+
|
|
17
|
+
// --------------- INPUTS AND OUTPUTS ------------------
|
|
18
|
+
|
|
19
|
+
/** The current signed in user. */
|
|
20
|
+
currentUser: Signal<User> = this.authStore.user;
|
|
21
|
+
|
|
22
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
23
|
+
|
|
24
|
+
// --------------- COMPUTED DATA -----------------------
|
|
25
|
+
|
|
26
|
+
// --------------- EVENT HANDLING ----------------------
|
|
27
|
+
|
|
28
|
+
/** Login the user. */
|
|
29
|
+
login() {
|
|
30
|
+
this.authStore.login('google.com');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// --------------- OTHER -------------------------------
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
private injector: Injector,
|
|
37
|
+
) {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// --------------- LOAD AND CLEANUP --------------------
|
|
41
|
+
|
|
42
|
+
ngOnInit() {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="login-container">
|
|
2
|
+
@if (currentUser()) {
|
|
3
|
+
<img class="profile" [src]="currentUser().photoURL" referrerpolicy="no-referrer"/>
|
|
4
|
+
<h2>Hello {{currentUser().name}}!</h2>
|
|
5
|
+
<input type="submit" value="Logout" (click)="logout()">
|
|
6
|
+
} @else {
|
|
7
|
+
<h2>Hello!</h2>
|
|
8
|
+
<input type="submit" value="Login" (click)="login()">
|
|
9
|
+
}
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { inject, effect, Component, OnInit, ChangeDetectionStrategy, Signal } from '@angular/core';
|
|
2
|
+
import { User } from 'src/app/core/store/user/user.model';
|
|
3
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-login',
|
|
7
|
+
templateUrl: './login.component.html',
|
|
8
|
+
styleUrls: ['./login.component.scss'],
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
standalone: true,
|
|
11
|
+
})
|
|
12
|
+
export class LoginComponent implements OnInit {
|
|
13
|
+
authStore = inject(AuthStore);
|
|
14
|
+
|
|
15
|
+
// --------------- INPUTS AND OUTPUTS ------------------
|
|
16
|
+
|
|
17
|
+
/** The current signed in user. */
|
|
18
|
+
currentUser: Signal<User> = this.authStore.user;
|
|
19
|
+
|
|
20
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
21
|
+
|
|
22
|
+
// --------------- COMPUTED DATA -----------------------
|
|
23
|
+
|
|
24
|
+
// --------------- EVENT HANDLING ----------------------
|
|
25
|
+
|
|
26
|
+
/** Login the user. */
|
|
27
|
+
login() {
|
|
28
|
+
this.authStore.login('google.com', { doNotRoute: true });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Logout the user. */
|
|
32
|
+
logout() {
|
|
33
|
+
this.authStore.logout({ doNotRoute: true });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// --------------- OTHER -------------------------------
|
|
37
|
+
|
|
38
|
+
constructor() {
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// --------------- LOAD AND CLEANUP --------------------
|
|
42
|
+
|
|
43
|
+
ngOnInit() {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { OnboardingComponent } from './onboarding.component';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
6
|
-
let component:
|
|
7
|
-
let fixture: ComponentFixture<
|
|
5
|
+
describe('OnboardingComponent', () => {
|
|
6
|
+
let component: OnboardingComponent;
|
|
7
|
+
let fixture: ComponentFixture<OnboardingComponent>;
|
|
8
8
|
|
|
9
9
|
beforeEach(waitForAsync(() => {
|
|
10
10
|
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [
|
|
11
|
+
declarations: [OnboardingComponent],
|
|
12
12
|
})
|
|
13
13
|
.compileComponents();
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
16
|
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(
|
|
17
|
+
fixture = TestBed.createComponent(OnboardingComponent);
|
|
18
18
|
component = fixture.componentInstance;
|
|
19
19
|
fixture.detectChanges();
|
|
20
20
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
|
|
2
|
+
import { OnboardingAnimations } from './onboarding.animations';
|
|
3
|
+
import { User } from 'src/app/core/store/user/user.model';
|
|
4
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
5
|
+
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-onboarding',
|
|
9
|
+
templateUrl: './onboarding.component.html',
|
|
10
|
+
styleUrls: ['./onboarding.component.scss'],
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
standalone: true,
|
|
13
|
+
animations: OnboardingAnimations,
|
|
14
|
+
})
|
|
15
|
+
export class OnboardingComponent implements OnInit {
|
|
16
|
+
authStore = inject(AuthStore);
|
|
17
|
+
|
|
18
|
+
// --------------- INPUTS AND OUTPUTS ------------------
|
|
19
|
+
|
|
20
|
+
/** The currently signed in user. */
|
|
21
|
+
currentUser: Signal<User> = this.authStore.user;
|
|
22
|
+
|
|
23
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
24
|
+
|
|
25
|
+
// --------------- COMPUTED DATA -----------------------
|
|
26
|
+
|
|
27
|
+
// --------------- EVENT HANDLING ----------------------
|
|
28
|
+
|
|
29
|
+
// --------------- OTHER -------------------------------
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
private injector: Injector,
|
|
33
|
+
@Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
|
|
34
|
+
) {
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// --------------- LOAD AND CLEANUP --------------------
|
|
38
|
+
|
|
39
|
+
ngOnInit() {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Component, OnInit, ChangeDetectionStrategy, input, output, inject, WritableSignal, Signal, signal, computed, Inject, Injector } from '@angular/core';
|
|
2
|
+
import { HomeAnimations } from './home.animations';
|
|
3
|
+
import { User } from 'src/app/core/store/user/user.model';
|
|
4
|
+
import { AuthStore } from 'src/app/core/store/auth/auth.store';
|
|
5
|
+
import { BatchWriteService, BATCH_WRITE_SERVICE } from 'src/app/core/store/batch-write.service';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-home',
|
|
9
|
+
templateUrl: './home.component.html',
|
|
10
|
+
styleUrls: ['./home.component.scss'],
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
standalone: true,
|
|
13
|
+
animations: HomeAnimations,
|
|
14
|
+
})
|
|
15
|
+
export class HomeComponent implements OnInit {
|
|
16
|
+
authStore = inject(AuthStore);
|
|
17
|
+
|
|
18
|
+
// --------------- INPUTS AND OUTPUTS ------------------
|
|
19
|
+
|
|
20
|
+
/** The currently signed in user. */
|
|
21
|
+
currentUser: Signal<User> = this.authStore.user;
|
|
22
|
+
|
|
23
|
+
// --------------- LOCAL UI STATE ----------------------
|
|
24
|
+
|
|
25
|
+
// --------------- COMPUTED DATA -----------------------
|
|
26
|
+
|
|
27
|
+
// --------------- EVENT HANDLING ----------------------
|
|
28
|
+
|
|
29
|
+
/** Login the user. */
|
|
30
|
+
login() {
|
|
31
|
+
this.authStore.login('google.com', { doNotRoute: true });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Logout the user. */
|
|
35
|
+
logout() {
|
|
36
|
+
this.authStore.logout({ doNotRoute: true });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// --------------- OTHER -------------------------------
|
|
40
|
+
|
|
41
|
+
constructor(
|
|
42
|
+
private injector: Injector,
|
|
43
|
+
@Inject(BATCH_WRITE_SERVICE) private batch: BatchWriteService,
|
|
44
|
+
) {
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// --------------- LOAD AND CLEANUP --------------------
|
|
48
|
+
|
|
49
|
+
ngOnInit() {
|
|
50
|
+
}
|
|
51
|
+
}
|