From 2095073db94b904f1b3a2d04a06aabf408da5d05 Mon Sep 17 00:00:00 2001 From: Valentin Date: Mon, 27 Sep 2021 23:55:28 +0300 Subject: [PATCH 01/13] WIP on adding Notifications Preferences --- apps/red-ui/src/app/app-routing.module.ts | 14 +- apps/red-ui/src/app/app.module.ts | 3 +- .../base-screen/base-screen.component.ts | 7 +- .../user-profile-screen.component.html | 94 +++---- .../user-profile-screen.component.scss | 54 ++-- .../user-profile-screen.component.ts | 232 +++++++++--------- .../modules/account/account-routing.module.ts | 35 +++ .../account-side-nav.component.html | 7 + .../account-side-nav.component.scss | 0 .../account-side-nav.component.ts | 27 ++ .../src/app/modules/account/account.module.ts | 18 ++ .../notifications.component.html | 34 +++ .../notifications.component.scss | 0 .../notifications/notifications.component.ts | 8 + .../user-profile/user-profile.component.html | 14 ++ .../user-profile/user-profile.component.scss | 0 .../user-profile/user-profile.component.ts | 8 + apps/red-ui/src/assets/i18n/en.json | 33 +-- .../src/assets/styles/red-page-layout.scss | 1 + 19 files changed, 359 insertions(+), 230 deletions(-) create mode 100644 apps/red-ui/src/app/modules/account/account-routing.module.ts create mode 100644 apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.html create mode 100644 apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.scss create mode 100644 apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.ts create mode 100644 apps/red-ui/src/app/modules/account/account.module.ts create mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.html create mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.scss create mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.ts create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.html create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.scss create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.ts diff --git a/apps/red-ui/src/app/app-routing.module.ts b/apps/red-ui/src/app/app-routing.module.ts index 016bece60..5989691a8 100644 --- a/apps/red-ui/src/app/app-routing.module.ts +++ b/apps/red-ui/src/app/app-routing.module.ts @@ -7,7 +7,6 @@ import { RouteReuseStrategy, RouterModule } from '@angular/router'; import { NgModule } from '@angular/core'; import { DownloadsListScreenComponent } from '@components/downloads-list-screen/downloads-list-screen.component'; import { AppStateGuard } from '@state/app-state.guard'; -import { UserProfileScreenComponent } from '@components/user-profile/user-profile-screen.component'; import { CustomRouteReuseStrategy } from '@utils/custom-route-reuse.strategy'; const routes = [ @@ -22,18 +21,9 @@ const routes = [ canActivate: [AuthGuard] }, { - path: 'main/my-profile', + path: 'main/account', component: BaseScreenComponent, - children: [ - { - path: '', - component: UserProfileScreenComponent - } - ], - canActivate: [CompositeRouteGuard], - data: { - routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] - } + loadChildren: () => import('./modules/account/account.module').then(m => m.AccountModule) }, { path: 'main/admin', diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index c55cb1263..c5e8f9cd6 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -23,7 +23,6 @@ import { DownloadsListScreenComponent } from '@components/downloads-list-screen/ import { AppRoutingModule } from './app-routing.module'; import { SharedModule } from '@shared/shared.module'; import { FileUploadDownloadModule } from '@upload-download/file-upload-download.module'; -import { UserProfileScreenComponent } from '@components/user-profile/user-profile-screen.component'; import { PlatformLocation } from '@angular/common'; import { BASE_HREF } from './tokens'; import { MONACO_PATH, MonacoEditorModule } from '@materia-ui/ngx-monaco-editor'; @@ -53,7 +52,7 @@ function cleanupBaseUrl(baseUrl: string) { } } -const screens = [BaseScreenComponent, DownloadsListScreenComponent, UserProfileScreenComponent]; +const screens = [BaseScreenComponent, DownloadsListScreenComponent]; const components = [ AppComponent, diff --git a/apps/red-ui/src/app/components/base-screen/base-screen.component.ts b/apps/red-ui/src/app/components/base-screen/base-screen.component.ts index aa8b2cd4b..e834bc426 100644 --- a/apps/red-ui/src/app/components/base-screen/base-screen.component.ts +++ b/apps/red-ui/src/app/components/base-screen/base-screen.component.ts @@ -37,9 +37,10 @@ export class BaseScreenComponent { readonly isSearchScreen$ = this._navigationStart$.pipe(map(isSearchScreen)); readonly userMenuItems: readonly MenuItem[] = [ { - name: _('top-bar.navigation-items.my-account.children.my-profile'), - routerLink: '/main/my-profile', - show: true + name: _('top-bar.navigation-items.my-account.children.account'), + routerLink: '/main/account', + show: true, + action: this.appStateService.reset }, { name: _('top-bar.navigation-items.my-account.children.admin'), diff --git a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.html b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.html index a2b00defe..322dd97b4 100644 --- a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.html +++ b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.html @@ -1,50 +1,50 @@ -
-
-
-
-
-
-
-
-
-
-
- - -
+ + + + + + + + + + + + + + -
- - -
+ + + + -
- - -
-
- - - - {{ translations[language] | translate }} - - -
-
-
+ + + + + + + + + + + + + + -
- - {{ 'user-profile.actions.change-password' | translate }} -
-
-
-
-
+ + + + + + + + + + + + + + + diff --git a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.scss b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.scss index 677b2c3d2..118317781 100644 --- a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.scss +++ b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.scss @@ -1,27 +1,27 @@ -@use 'variables'; -@use 'common-mixins'; - -.content-container { - background-color: variables.$grey-2; - justify-content: center; - @include common-mixins.scroll-bar; - overflow: auto; -} - -.full-height { - display: flex; - flex-direction: row; - position: absolute; - bottom: 0; - width: 100%; - height: calc(100% + 50px); - z-index: 1; -} - -iframe { - background: white; - width: 500px; - height: 500px; - position: absolute; - z-index: 100; -} +//@use 'variables'; +//@use 'common-mixins'; +// +//.content-container { +// background-color: variables.$grey-2; +// justify-content: center; +// @include common-mixins.scroll-bar; +// overflow: auto; +//} +// +//.full-height { +// display: flex; +// flex-direction: row; +// position: absolute; +// bottom: 0; +// width: 100%; +// height: calc(100% + 50px); +// z-index: 1; +//} +// +//iframe { +// background: white; +// width: 500px; +// height: 500px; +// position: absolute; +// z-index: 100; +//} diff --git a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts index ef48662d2..47714ed5f 100644 --- a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts +++ b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts @@ -1,116 +1,116 @@ -import { Component, OnInit } from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { ProfileModel, UserService } from '@services/user.service'; -import { PermissionsService } from '@services/permissions.service'; -import { LanguageService } from '@i18n/language.service'; -import { TranslateService } from '@ngx-translate/core'; -import { UserControllerService } from '@redaction/red-ui-http'; -import { ConfigService } from '@services/config.service'; -import { DomSanitizer } from '@angular/platform-browser'; -import { languagesTranslations } from '../../translations/languages-translations'; -import { LoadingService } from '@iqser/common-ui'; - -@Component({ - selector: 'redaction-user-profile-screen', - templateUrl: './user-profile-screen.component.html', - styleUrls: ['./user-profile-screen.component.scss'] -}) -export class UserProfileScreenComponent implements OnInit { - formGroup: FormGroup; - changePasswordUrl: any; - translations = languagesTranslations; - - private _profileModel: ProfileModel; - - constructor( - readonly permissionsService: PermissionsService, - private readonly _formBuilder: FormBuilder, - private readonly _userService: UserService, - private readonly _configService: ConfigService, - private readonly _userControllerService: UserControllerService, - private readonly _languageService: LanguageService, - private readonly _domSanitizer: DomSanitizer, - private readonly _translateService: TranslateService, - private readonly _loadingService: LoadingService - ) { - this._loadingService.start(); - this.formGroup = this._formBuilder.group({ - email: [undefined, [Validators.required, Validators.email]], - firstName: [undefined], - lastName: [undefined], - language: [undefined] - }); - - this.changePasswordUrl = this._domSanitizer.bypassSecurityTrustResourceUrl( - this._configService.values.OAUTH_URL + '/account/password' - ); - } - - get languageChanged(): boolean { - return this._profileModel['language'] !== this.formGroup.get('language').value; - } - - get profileChanged(): boolean { - const keys = Object.keys(this.formGroup.getRawValue()); - keys.splice(keys.indexOf('language'), 1); - - for (const key of keys) { - if (this._profileModel[key] !== this.formGroup.get(key).value) { - return true; - } - } - - return false; - } - - get languages(): string[] { - return this._translateService.langs; - } - - ngOnInit() { - this._initializeForm(); - } - - async save(): Promise { - this._loadingService.start(); - - if (this.languageChanged) { - await this._languageService.changeLanguage(this.formGroup.get('language').value); - } - - if (this.profileChanged) { - const value = this.formGroup.value as ProfileModel; - delete value.language; - - await this._userControllerService - .updateMyProfile({ - ...value - }) - .toPromise(); - - await this._userService.loadCurrentUser(); - await this._userService.loadAllUsers(); - } - - this._initializeForm(); - } - - private _initializeForm(): void { - try { - this._profileModel = { - email: this._userService.currentUser.email, - firstName: this._userService.currentUser.firstName, - lastName: this._userService.currentUser.lastName, - language: this._languageService.currentLanguage - }; - if (this._userService.currentUser.email) { - // disable email if it's already set - this.formGroup.get('email').disable(); - } - this.formGroup.patchValue(this._profileModel, { emitEvent: false }); - } catch (e) { - } finally { - this._loadingService.stop(); - } - } -} +// import { Component, OnInit } from '@angular/core'; +// import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +// import { ProfileModel, UserService } from '@services/user.service'; +// import { PermissionsService } from '@services/permissions.service'; +// import { LanguageService } from '@i18n/language.service'; +// import { TranslateService } from '@ngx-translate/core'; +// import { UserControllerService } from '@redaction/red-ui-http'; +// import { ConfigService } from '@services/config.service'; +// import { DomSanitizer } from '@angular/platform-browser'; +// import { languagesTranslations } from '../../translations/languages-translations'; +// import { LoadingService } from '@iqser/common-ui'; +// +// @Component({ +// selector: 'redaction-user-profile-screen', +// templateUrl: './user-profile-screen.component.html', +// styleUrls: ['./user-profile-screen.component.scss'] +// }) +// export class UserProfileScreenComponent implements OnInit { +// formGroup: FormGroup; +// changePasswordUrl: any; +// translations = languagesTranslations; +// +// private _profileModel: ProfileModel; +// +// constructor( +// readonly permissionsService: PermissionsService, +// private readonly _formBuilder: FormBuilder, +// private readonly _userService: UserService, +// private readonly _configService: ConfigService, +// private readonly _userControllerService: UserControllerService, +// private readonly _languageService: LanguageService, +// private readonly _domSanitizer: DomSanitizer, +// private readonly _translateService: TranslateService, +// private readonly _loadingService: LoadingService +// ) { +// this._loadingService.start(); +// this.formGroup = this._formBuilder.group({ +// email: [undefined, [Validators.required, Validators.email]], +// firstName: [undefined], +// lastName: [undefined], +// language: [undefined] +// }); +// +// this.changePasswordUrl = this._domSanitizer.bypassSecurityTrustResourceUrl( +// this._configService.values.OAUTH_URL + '/account/password' +// ); +// } +// +// get languageChanged(): boolean { +// return this._profileModel['language'] !== this.formGroup.get('language').value; +// } +// +// get profileChanged(): boolean { +// const keys = Object.keys(this.formGroup.getRawValue()); +// keys.splice(keys.indexOf('language'), 1); +// +// for (const key of keys) { +// if (this._profileModel[key] !== this.formGroup.get(key).value) { +// return true; +// } +// } +// +// return false; +// } +// +// get languages(): string[] { +// return this._translateService.langs; +// } +// +// ngOnInit() { +// this._initializeForm(); +// } +// +// async save(): Promise { +// this._loadingService.start(); +// +// if (this.languageChanged) { +// await this._languageService.changeLanguage(this.formGroup.get('language').value); +// } +// +// if (this.profileChanged) { +// const value = this.formGroup.value as ProfileModel; +// delete value.language; +// +// await this._userControllerService +// .updateMyProfile({ +// ...value +// }) +// .toPromise(); +// +// await this._userService.loadCurrentUser(); +// await this._userService.loadAllUsers(); +// } +// +// this._initializeForm(); +// } +// +// private _initializeForm(): void { +// try { +// this._profileModel = { +// email: this._userService.currentUser.email, +// firstName: this._userService.currentUser.firstName, +// lastName: this._userService.currentUser.lastName, +// language: this._languageService.currentLanguage +// }; +// if (this._userService.currentUser.email) { +// // disable email if it's already set +// this.formGroup.get('email').disable(); +// } +// this.formGroup.patchValue(this._profileModel, { emitEvent: false }); +// } catch (e) { +// } finally { +// this._loadingService.stop(); +// } +// } +// } diff --git a/apps/red-ui/src/app/modules/account/account-routing.module.ts b/apps/red-ui/src/app/modules/account/account-routing.module.ts new file mode 100644 index 000000000..31d95beb4 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/account-routing.module.ts @@ -0,0 +1,35 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { CompositeRouteGuard } from '../../guards/composite-route.guard'; +import { AuthGuard } from '../auth/auth.guard'; +import { RedRoleGuard } from '../auth/red-role.guard'; +import { AppStateGuard } from '../../state/app-state.guard'; +import { NotificationsScreenComponent } from './screens/notifications/notifications.component'; +import { UserProfileScreenComponent } from './screens/user-profile/user-profile.component'; + +const routes = [ + { path: '', redirectTo: 'user-profile', pathMatch: 'full' }, + { + path: 'user-profile', + component: UserProfileScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard], + requiredRoles: ['RED_USER'] + } + }, + { + path: 'notifications', + component: NotificationsScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AccountRoutingModule {} diff --git a/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.html b/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.html new file mode 100644 index 000000000..791992dc9 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.html @@ -0,0 +1,7 @@ + + +
+ {{ item.label | translate }} +
+
+
diff --git a/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.scss b/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.ts b/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.ts new file mode 100644 index 000000000..8c3986e10 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.ts @@ -0,0 +1,27 @@ +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; +import { Component } from '@angular/core'; + +interface NavItem { + readonly label: string; + readonly screen: string; +} + +@Component({ + selector: 'redaction-account-side-nav', + templateUrl: './account-side-nav.component.html', + styleUrls: ['./account-side-nav.component.scss'] +}) +export class AccountSideNavComponent { + readonly items: NavItem[] = [ + { + screen: 'user-profile', + label: _('user-profile') + }, + { + screen: 'notifications', + label: _('notifications') + } + ]; + + constructor() {} +} diff --git a/apps/red-ui/src/app/modules/account/account.module.ts b/apps/red-ui/src/app/modules/account/account.module.ts new file mode 100644 index 000000000..ab03c0314 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/account.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from '../shared/shared.module'; +import { AccountRoutingModule } from './account-routing.module'; +import { AccountSideNavComponent } from './account-side-nav/account-side-nav.component'; +import { NotificationsScreenComponent } from './screens/notifications/notifications.component'; +import { UserProfileScreenComponent } from './screens/user-profile/user-profile.component'; + +const screens = [NotificationsScreenComponent, UserProfileScreenComponent]; + +const components = [AccountSideNavComponent, ...screens]; + +@NgModule({ + declarations: [components], + providers: [], + imports: [CommonModule, SharedModule, AccountRoutingModule] +}) +export class AccountModule {} diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.html new file mode 100644 index 000000000..1d07a02f3 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.html @@ -0,0 +1,34 @@ +
+
+ + + +
+ +
+
+ + + + + + + + +
+
+
+
diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.scss b/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.ts new file mode 100644 index 000000000..586e58537 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'redaction-notifications-screen', + templateUrl: './notifications.component.html', + styleUrls: ['./notifications.component.scss'] +}) +export class NotificationsScreenComponent {} diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.html b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.html new file mode 100644 index 000000000..8a19b4a78 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.html @@ -0,0 +1,14 @@ +
+
+ + + +
+ +
+
+
+
+
diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.scss b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.ts b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.ts new file mode 100644 index 000000000..97ebcd3f4 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'redaction-user-profile-screen', + templateUrl: './user-profile.component.html', + styleUrls: ['./user-profile.component.scss'] +}) +export class UserProfileScreenComponent {} diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index c5122764f..2efc511c4 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1,4 +1,5 @@ { + "account-settings": "Account Settings", "actions": { "all": "All", "none": "None" @@ -228,6 +229,11 @@ "show": "Show", "undo": "Undo" }, + "annotation-engines": { + "dictionary": "Redaction based on dictionary", + "ner": "Redaction based on AI", + "rule": "Redaction based on rule {rule}" + }, "annotation-type": { "add-dictionary": "Pending add to dictionary", "change-legal-basis": "Pending Change of Legal Basis", @@ -1226,10 +1232,7 @@ "user-promoted-to-approver": "{user} promoted to approver in dossier: {dossierName}!", "user-removed-as-dossier-member": "{user} removed as a member of: {dossierName} !" }, - "notifications": { - "mark-as": "Mark as {type, select, read{read} unread{unread} other{}}", - "no-data": "You have no notifications." - }, + "notifications": "Notifications", "overwrite-files-dialog": { "options": { "cancel": "Cancel all uploads", @@ -1402,6 +1405,7 @@ "dossiers": "Active Dossiers", "my-account": { "children": { + "account": "Account", "admin": "Settings", "downloads": "My Downloads", "language": { @@ -1410,7 +1414,6 @@ "label": "Language" }, "logout": "Logout", - "my-profile": "My Profile", "trash": "Trash" } } @@ -1482,18 +1485,7 @@ } }, "user-management": "User Management", - "user-profile": { - "actions": { - "change-password": "Change Password", - "save": "Save profile" - }, - "form": { - "email": "Email", - "first-name": "First name", - "last-name": "Last name" - }, - "title": "My profile" - }, + "user-profile": "My Profile", "user-stats": { "chart": { "users": "Users in Workspace" @@ -1521,10 +1513,5 @@ }, "title": "Watermark" }, - "yesterday": "Yesterday", - "annotation-engines": { - "dictionary": "Redaction based on dictionary", - "ner": "Redaction based on AI", - "rule": "Redaction based on rule {rule}" - } + "yesterday": "Yesterday" } diff --git a/apps/red-ui/src/assets/styles/red-page-layout.scss b/apps/red-ui/src/assets/styles/red-page-layout.scss index 0a485feeb..acf3e9d8e 100644 --- a/apps/red-ui/src/assets/styles/red-page-layout.scss +++ b/apps/red-ui/src/assets/styles/red-page-layout.scss @@ -20,6 +20,7 @@ section.settings { width: calc(100vw - 200px); } + redaction-account-side-nav, redaction-admin-side-nav { height: calc(100vh - 61px); } From 19249209bac3c25c615ae244c19b7e716f16cd61 Mon Sep 17 00:00:00 2001 From: Valentin Date: Tue, 28 Sep 2021 13:50:51 +0300 Subject: [PATCH 02/13] moved user profile screen into account settings --- .../user-profile-screen.component.html | 50 -------- .../user-profile-screen.component.scss | 27 ---- .../user-profile-screen.component.ts | 116 ------------------ .../modules/account/account-routing.module.ts | 4 +- .../src/app/modules/account/account.module.ts | 4 +- .../notifications-screen.component.html} | 3 - ...ss => notifications-screen.component.scss} | 0 ...t.ts => notifications-screen.component.ts} | 4 +- .../notifications.component.html | 34 ----- .../user-profile-screen.component.html | 60 +++++++++ .../user-profile-screen.component.scss | 23 ++++ .../user-profile-screen.component.ts | 116 ++++++++++++++++++ .../user-profile/user-profile.component.scss | 0 .../user-profile/user-profile.component.ts | 8 -- .../translations/languages-translations.ts | 0 apps/red-ui/src/assets/i18n/en.json | 18 ++- 16 files changed, 222 insertions(+), 245 deletions(-) delete mode 100644 apps/red-ui/src/app/components/user-profile/user-profile-screen.component.html delete mode 100644 apps/red-ui/src/app/components/user-profile/user-profile-screen.component.scss delete mode 100644 apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts rename apps/red-ui/src/app/modules/account/screens/{user-profile/user-profile.component.html => notifications/notifications-screen.component.html} (69%) rename apps/red-ui/src/app/modules/account/screens/notifications/{notifications.component.scss => notifications-screen.component.scss} (100%) rename apps/red-ui/src/app/modules/account/screens/notifications/{notifications.component.ts => notifications-screen.component.ts} (57%) delete mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.html create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts delete mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.scss delete mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.ts rename apps/red-ui/src/app/{ => modules/account}/translations/languages-translations.ts (100%) diff --git a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.html b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.html deleted file mode 100644 index 322dd97b4..000000000 --- a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.scss b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.scss deleted file mode 100644 index 118317781..000000000 --- a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.scss +++ /dev/null @@ -1,27 +0,0 @@ -//@use 'variables'; -//@use 'common-mixins'; -// -//.content-container { -// background-color: variables.$grey-2; -// justify-content: center; -// @include common-mixins.scroll-bar; -// overflow: auto; -//} -// -//.full-height { -// display: flex; -// flex-direction: row; -// position: absolute; -// bottom: 0; -// width: 100%; -// height: calc(100% + 50px); -// z-index: 1; -//} -// -//iframe { -// background: white; -// width: 500px; -// height: 500px; -// position: absolute; -// z-index: 100; -//} diff --git a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts b/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts deleted file mode 100644 index 47714ed5f..000000000 --- a/apps/red-ui/src/app/components/user-profile/user-profile-screen.component.ts +++ /dev/null @@ -1,116 +0,0 @@ -// import { Component, OnInit } from '@angular/core'; -// import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -// import { ProfileModel, UserService } from '@services/user.service'; -// import { PermissionsService } from '@services/permissions.service'; -// import { LanguageService } from '@i18n/language.service'; -// import { TranslateService } from '@ngx-translate/core'; -// import { UserControllerService } from '@redaction/red-ui-http'; -// import { ConfigService } from '@services/config.service'; -// import { DomSanitizer } from '@angular/platform-browser'; -// import { languagesTranslations } from '../../translations/languages-translations'; -// import { LoadingService } from '@iqser/common-ui'; -// -// @Component({ -// selector: 'redaction-user-profile-screen', -// templateUrl: './user-profile-screen.component.html', -// styleUrls: ['./user-profile-screen.component.scss'] -// }) -// export class UserProfileScreenComponent implements OnInit { -// formGroup: FormGroup; -// changePasswordUrl: any; -// translations = languagesTranslations; -// -// private _profileModel: ProfileModel; -// -// constructor( -// readonly permissionsService: PermissionsService, -// private readonly _formBuilder: FormBuilder, -// private readonly _userService: UserService, -// private readonly _configService: ConfigService, -// private readonly _userControllerService: UserControllerService, -// private readonly _languageService: LanguageService, -// private readonly _domSanitizer: DomSanitizer, -// private readonly _translateService: TranslateService, -// private readonly _loadingService: LoadingService -// ) { -// this._loadingService.start(); -// this.formGroup = this._formBuilder.group({ -// email: [undefined, [Validators.required, Validators.email]], -// firstName: [undefined], -// lastName: [undefined], -// language: [undefined] -// }); -// -// this.changePasswordUrl = this._domSanitizer.bypassSecurityTrustResourceUrl( -// this._configService.values.OAUTH_URL + '/account/password' -// ); -// } -// -// get languageChanged(): boolean { -// return this._profileModel['language'] !== this.formGroup.get('language').value; -// } -// -// get profileChanged(): boolean { -// const keys = Object.keys(this.formGroup.getRawValue()); -// keys.splice(keys.indexOf('language'), 1); -// -// for (const key of keys) { -// if (this._profileModel[key] !== this.formGroup.get(key).value) { -// return true; -// } -// } -// -// return false; -// } -// -// get languages(): string[] { -// return this._translateService.langs; -// } -// -// ngOnInit() { -// this._initializeForm(); -// } -// -// async save(): Promise { -// this._loadingService.start(); -// -// if (this.languageChanged) { -// await this._languageService.changeLanguage(this.formGroup.get('language').value); -// } -// -// if (this.profileChanged) { -// const value = this.formGroup.value as ProfileModel; -// delete value.language; -// -// await this._userControllerService -// .updateMyProfile({ -// ...value -// }) -// .toPromise(); -// -// await this._userService.loadCurrentUser(); -// await this._userService.loadAllUsers(); -// } -// -// this._initializeForm(); -// } -// -// private _initializeForm(): void { -// try { -// this._profileModel = { -// email: this._userService.currentUser.email, -// firstName: this._userService.currentUser.firstName, -// lastName: this._userService.currentUser.lastName, -// language: this._languageService.currentLanguage -// }; -// if (this._userService.currentUser.email) { -// // disable email if it's already set -// this.formGroup.get('email').disable(); -// } -// this.formGroup.patchValue(this._profileModel, { emitEvent: false }); -// } catch (e) { -// } finally { -// this._loadingService.stop(); -// } -// } -// } diff --git a/apps/red-ui/src/app/modules/account/account-routing.module.ts b/apps/red-ui/src/app/modules/account/account-routing.module.ts index 31d95beb4..b991d118d 100644 --- a/apps/red-ui/src/app/modules/account/account-routing.module.ts +++ b/apps/red-ui/src/app/modules/account/account-routing.module.ts @@ -4,8 +4,8 @@ import { CompositeRouteGuard } from '../../guards/composite-route.guard'; import { AuthGuard } from '../auth/auth.guard'; import { RedRoleGuard } from '../auth/red-role.guard'; import { AppStateGuard } from '../../state/app-state.guard'; -import { NotificationsScreenComponent } from './screens/notifications/notifications.component'; -import { UserProfileScreenComponent } from './screens/user-profile/user-profile.component'; +import { NotificationsScreenComponent } from './screens/notifications/notifications-screen.component'; +import { UserProfileScreenComponent } from './screens/user-profile/user-profile-screen.component'; const routes = [ { path: '', redirectTo: 'user-profile', pathMatch: 'full' }, diff --git a/apps/red-ui/src/app/modules/account/account.module.ts b/apps/red-ui/src/app/modules/account/account.module.ts index ab03c0314..b77ac676e 100644 --- a/apps/red-ui/src/app/modules/account/account.module.ts +++ b/apps/red-ui/src/app/modules/account/account.module.ts @@ -3,8 +3,8 @@ import { CommonModule } from '@angular/common'; import { SharedModule } from '../shared/shared.module'; import { AccountRoutingModule } from './account-routing.module'; import { AccountSideNavComponent } from './account-side-nav/account-side-nav.component'; -import { NotificationsScreenComponent } from './screens/notifications/notifications.component'; -import { UserProfileScreenComponent } from './screens/user-profile/user-profile.component'; +import { NotificationsScreenComponent } from './screens/notifications/notifications-screen.component'; +import { UserProfileScreenComponent } from './screens/user-profile/user-profile-screen.component'; const screens = [NotificationsScreenComponent, UserProfileScreenComponent]; diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html similarity index 69% rename from apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.html rename to apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html index 8a19b4a78..193232188 100644 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.html +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html @@ -4,9 +4,6 @@
-
diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.scss b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss similarity index 100% rename from apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.scss rename to apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts similarity index 57% rename from apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.ts rename to apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts index 586e58537..8f3846757 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'redaction-notifications-screen', - templateUrl: './notifications.component.html', - styleUrls: ['./notifications.component.scss'] + templateUrl: './notifications-screen.component.html', + styleUrls: ['./notifications-screen.component.scss'] }) export class NotificationsScreenComponent {} diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.html deleted file mode 100644 index 1d07a02f3..000000000 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.component.html +++ /dev/null @@ -1,34 +0,0 @@ -
-
- - - -
- -
-
- - - - - - - - -
-
-
-
diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html new file mode 100644 index 000000000..77c930363 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html @@ -0,0 +1,60 @@ +
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ + + + {{ translations[language] | translate }} + + +
+
+
+ +
+ + + {{ 'user-profile-screen.actions.change-password' | translate }} +
+
+
+
+
+
+
diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss new file mode 100644 index 000000000..a0f740599 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss @@ -0,0 +1,23 @@ +@use 'variables'; +@use 'common-mixins'; + +.dialog { + min-height: unset; +} + +.content-container { + background-color: variables.$grey-2; + justify-content: center; + @include common-mixins.scroll-bar; + overflow: auto; +} + +.full-height { + display: flex; + flex-direction: row; + position: absolute; + bottom: 0; + width: 100%; + height: calc(100% + 50px); + z-index: 1; +} diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts new file mode 100644 index 000000000..98f8866d7 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts @@ -0,0 +1,116 @@ +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { languagesTranslations } from '../../translations/languages-translations'; +import { ProfileModel, UserService } from '../../../../services/user.service'; +import { PermissionsService } from '../../../../services/permissions.service'; +import { ConfigService } from '../../../../services/config.service'; +import { UserControllerService } from '../../../../../../../../libs/red-ui-http/src'; +import { LanguageService } from '../../../../i18n/language.service'; +import { DomSanitizer } from '@angular/platform-browser'; +import { TranslateService } from '@ngx-translate/core'; +import { LoadingService } from '../../../../../../../../libs/common-ui/src'; + +@Component({ + selector: 'redaction-user-profile-screen', + templateUrl: './user-profile-screen.component.html', + styleUrls: ['./user-profile-screen.component.scss'] +}) +export class UserProfileScreenComponent implements OnInit { + formGroup: FormGroup; + changePasswordUrl: any; + translations = languagesTranslations; + + private _profileModel: ProfileModel; + + constructor( + readonly permissionsService: PermissionsService, + private readonly _formBuilder: FormBuilder, + private readonly _userService: UserService, + private readonly _configService: ConfigService, + private readonly _userControllerService: UserControllerService, + private readonly _languageService: LanguageService, + private readonly _domSanitizer: DomSanitizer, + private readonly _translateService: TranslateService, + private readonly _loadingService: LoadingService + ) { + this._loadingService.start(); + this.formGroup = this._formBuilder.group({ + email: [undefined, [Validators.required, Validators.email]], + firstName: [undefined], + lastName: [undefined], + language: [undefined] + }); + + this.changePasswordUrl = this._domSanitizer.bypassSecurityTrustResourceUrl( + this._configService.values.OAUTH_URL + '/account/password' + ); + } + + get languageChanged(): boolean { + return this._profileModel['language'] !== this.formGroup.get('language').value; + } + + get profileChanged(): boolean { + const keys = Object.keys(this.formGroup.getRawValue()); + keys.splice(keys.indexOf('language'), 1); + + for (const key of keys) { + if (this._profileModel[key] !== this.formGroup.get(key).value) { + return true; + } + } + + return false; + } + + get languages(): string[] { + return this._translateService.langs; + } + + ngOnInit() { + this._initializeForm(); + } + + async save(): Promise { + this._loadingService.start(); + + if (this.languageChanged) { + await this._languageService.changeLanguage(this.formGroup.get('language').value); + } + + if (this.profileChanged) { + const value = this.formGroup.value as ProfileModel; + delete value.language; + + await this._userControllerService + .updateMyProfile({ + ...value + }) + .toPromise(); + + await this._userService.loadCurrentUser(); + await this._userService.loadAllUsers(); + } + + this._initializeForm(); + } + + private _initializeForm(): void { + try { + this._profileModel = { + email: this._userService.currentUser.email, + firstName: this._userService.currentUser.firstName, + lastName: this._userService.currentUser.lastName, + language: this._languageService.currentLanguage + }; + if (this._userService.currentUser.email) { + // disable email if it's already set + this.formGroup.get('email').disable(); + } + this.formGroup.patchValue(this._profileModel, { emitEvent: false }); + } catch (e) { + } finally { + this._loadingService.stop(); + } + } +} diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.scss b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.ts b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.ts deleted file mode 100644 index 97ebcd3f4..000000000 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'redaction-user-profile-screen', - templateUrl: './user-profile.component.html', - styleUrls: ['./user-profile.component.scss'] -}) -export class UserProfileScreenComponent {} diff --git a/apps/red-ui/src/app/translations/languages-translations.ts b/apps/red-ui/src/app/modules/account/translations/languages-translations.ts similarity index 100% rename from apps/red-ui/src/app/translations/languages-translations.ts rename to apps/red-ui/src/app/modules/account/translations/languages-translations.ts diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 2efc511c4..7c0e555b4 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1232,7 +1232,6 @@ "user-promoted-to-approver": "{user} promoted to approver in dossier: {dossierName}!", "user-removed-as-dossier-member": "{user} removed as a member of: {dossierName} !" }, - "notifications": "Notifications", "overwrite-files-dialog": { "options": { "cancel": "Cancel all uploads", @@ -1485,7 +1484,24 @@ } }, "user-management": "User Management", + "notifications": "Notifications", + "notifications-screen": { + "mark-as": "Mark as {type, select, read{read} unread{unread} other{}}", + "no-data": "You have no notifications." + }, "user-profile": "My Profile", + "user-profile-screen": { + "actions": { + "change-password": "Change Password", + "save": "Save profile" + }, + "form": { + "email": "Email", + "first-name": "First name", + "last-name": "Last name" + }, + "title": "Edit Profile" + }, "user-stats": { "chart": { "users": "Users in Workspace" From 883ded00f85544f98616aca13baa9bd649dd1e4d Mon Sep 17 00:00:00 2001 From: Valentin Date: Tue, 28 Sep 2021 22:00:30 +0300 Subject: [PATCH 03/13] WIP on Notifications Preferences --- .../notifications-screen.component.html | 48 ++++++++++++++++++- .../notifications-screen.component.scss | 24 ++++++++++ .../notifications-screen.component.ts | 11 ++++- .../user-profile-screen.component.html | 8 ++-- .../user-profile-screen.component.scss | 4 ++ .../user-profile-screen.component.ts | 4 +- .../dossier-overview-screen.component.ts | 2 +- apps/red-ui/src/assets/i18n/en.json | 11 ++--- 8 files changed, 98 insertions(+), 14 deletions(-) diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html index 193232188..f132cc2cf 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html @@ -5,7 +5,53 @@
-
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss index e69de29bb..b4a5b79ac 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss @@ -0,0 +1,24 @@ +@use 'variables'; +@use 'common-mixins'; + +.dialog { + width: 100%; + min-height: unset; +} + +.content-container { + background-color: variables.$grey-2; + justify-content: center; + @include common-mixins.scroll-bar; + overflow: auto; +} + +.full-height { + display: flex; + flex-direction: row; + position: absolute; + bottom: 0; + width: 100%; + height: calc(100% + 50px); + z-index: 1; +} diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts index 8f3846757..37017e8b8 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts @@ -1,8 +1,17 @@ import { Component } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; @Component({ selector: 'redaction-notifications-screen', templateUrl: './notifications-screen.component.html', styleUrls: ['./notifications-screen.component.scss'] }) -export class NotificationsScreenComponent {} +export class NotificationsScreenComponent { + formGroup: FormGroup; + + constructor(private readonly _formBuilder: FormBuilder) { + this.formGroup = this._formBuilder.group({}); + } + + save() {} +} diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html index 77c930363..aa7f830f5 100644 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html @@ -36,6 +36,11 @@
+ @@ -48,9 +53,6 @@ > {{ 'user-profile-screen.actions.save' | translate }} - - {{ 'user-profile-screen.actions.change-password' | translate }} diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss index a0f740599..e145e5430 100644 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss @@ -21,3 +21,7 @@ height: calc(100% + 50px); z-index: 1; } + +a { + color: black; +} diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts index 98f8866d7..196555f2c 100644 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts @@ -4,11 +4,11 @@ import { languagesTranslations } from '../../translations/languages-translations import { ProfileModel, UserService } from '../../../../services/user.service'; import { PermissionsService } from '../../../../services/permissions.service'; import { ConfigService } from '../../../../services/config.service'; -import { UserControllerService } from '../../../../../../../../libs/red-ui-http/src'; +import { UserControllerService } from '@redaction/red-ui-http'; import { LanguageService } from '../../../../i18n/language.service'; import { DomSanitizer } from '@angular/platform-browser'; import { TranslateService } from '@ngx-translate/core'; -import { LoadingService } from '../../../../../../../../libs/common-ui/src'; +import { LoadingService } from '@iqser/common-ui'; @Component({ selector: 'redaction-user-profile-screen', diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts index 14e31d540..f54adcb99 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts @@ -127,7 +127,7 @@ export class DossierOverviewScreenComponent extends ListingComponent imple label: fileStatusTranslations[FileStatuses.UNASSIGNED], key: FileStatuses.UNASSIGNED, enterFn: this.unassignFn, - enterPredicate: (entity: File) => false, + enterPredicate: () => false, color: '#D3D5DA' }, { diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 5da5171d4..8e95d43ce 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1233,6 +1233,10 @@ "user-promoted-to-approver": "{user} promoted to approver in dossier: {dossierName}!", "user-removed-as-dossier-member": "{user} removed as a member of: {dossierName} !" }, + "notifications": "Notifications", + "notifications-screen": { + "title": "Notifications Preferences" + }, "overwrite-files-dialog": { "options": { "cancel": "Cancel all uploads", @@ -1485,16 +1489,11 @@ } }, "user-management": "User Management", - "notifications": "Notifications", - "notifications-screen": { - "mark-as": "Mark as {type, select, read{read} unread{unread} other{}}", - "no-data": "You have no notifications." - }, "user-profile": "My Profile", "user-profile-screen": { "actions": { "change-password": "Change Password", - "save": "Save profile" + "save": "Save Changes" }, "form": { "email": "Email", From 406b63acf7d28c183de9d233d20d6421285cfcf5 Mon Sep 17 00:00:00 2001 From: Valentin Date: Thu, 30 Sep 2021 19:06:34 +0300 Subject: [PATCH 04/13] added notifications preferences form --- .../app/models/notification-preferences.ts | 26 ++++ .../notifications-screen.component.html | 141 ++++++++++++++---- .../notifications-screen.component.scss | 59 +++++++- .../notifications-screen.component.ts | 30 +++- .../notifications-translations.ts | 9 ++ apps/red-ui/src/assets/i18n/en.json | 27 ++++ 6 files changed, 257 insertions(+), 35 deletions(-) create mode 100644 apps/red-ui/src/app/models/notification-preferences.ts create mode 100644 apps/red-ui/src/app/modules/account/translations/notifications-translations.ts diff --git a/apps/red-ui/src/app/models/notification-preferences.ts b/apps/red-ui/src/app/models/notification-preferences.ts new file mode 100644 index 000000000..f3aad2a88 --- /dev/null +++ b/apps/red-ui/src/app/models/notification-preferences.ts @@ -0,0 +1,26 @@ +import { FormControl } from '@angular/forms'; + +export class NotificationPreferences { + //TODO replace hardcoded values with the ones from backend when it will be done + readonly isActive: FormControl = new FormControl(true); + readonly sendSchedule?: FormControl; + + readonly dossierStatusChanges: FormControl = new FormControl(true); + readonly requestToJoinTheDossier: FormControl = new FormControl(true); + readonly documentStatusChanges: FormControl = new FormControl(true); + readonly documentIsSentForApproval: FormControl = new FormControl(true); + + readonly whenIAmAssignedOnADocument: FormControl = new FormControl(true); + readonly whenIAmUnassignedFromADocument: FormControl = new FormControl(true); + readonly whenADocumentIsApproved: FormControl = new FormControl(true); + + readonly whenADocumentIsSentForApproval: FormControl = new FormControl(true); + readonly whenADocumentIsAssignedToAReviewer: FormControl = new FormControl(true); + readonly whenAReviewerIsUnassignedFromADocument: FormControl = new FormControl(true); + + constructor(sendSchedule?: string) { + if (sendSchedule) { + this.sendSchedule = new FormControl(sendSchedule); + } + } +} diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html index f132cc2cf..e43fbbcec 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html @@ -12,37 +12,120 @@
- - - - - - +
+
+
+ {{ + translations[category] | translate + }} +
- - - - +
+
+
+ + + {{ translations[schedule] | translate }} +
+
- - - - - - - - - - - - - - - - - - - +
+ +
+
+
+ + {{ 'notifications-screen.options.dossier-status-changes' | translate }} + + + {{ 'notifications-screen.options.request-to-join-the-dossier' | translate }} + + + {{ 'notifications-screen.options.document-status-changes' | translate }} + + + {{ 'notifications-screen.options.document-is-sent-for-approval' | translate }} + +
+
+ +
+
+
+ + {{ 'notifications-screen.options.when-i-am-assigned-on-a-document' | translate }} + + + {{ 'notifications-screen.options.when-i-am-unassigned-from-a-document' | translate }} + + + {{ 'notifications-screen.options.when-a-document-is-approved' | translate }} + +
+
+ +
+
+
+ + {{ 'notifications-screen.options.when-a-document-is-sent-for-approval' | translate }} + + + {{ 'notifications-screen.options.when-a-document-is-assigned-to-a-reviewer' | translate }} + + + {{ + 'notifications-screen.options.when-a-reviewer-is-unassigned-from-a-document' | translate + }} + +
+
+
+
+
-
+
- {{ + {{ translations[category] | translate }}
-
-
-
+
+
+
- {{ translations[schedule] | translate }} + {{ translations[type.toLocaleLowerCase()] | translate }}
-
-
+
+
- {{ 'notifications-screen.options.dossier-status-changes' | translate }} - - - {{ 'notifications-screen.options.request-to-join-the-dossier' | translate }} - - - {{ 'notifications-screen.options.document-status-changes' | translate }} - - - {{ 'notifications-screen.options.document-is-sent-for-approval' | translate }} - -
-
- -
-
-
- - {{ 'notifications-screen.options.when-i-am-assigned-on-a-document' | translate }} - - - {{ 'notifications-screen.options.when-i-am-unassigned-from-a-document' | translate }} - - - {{ 'notifications-screen.options.when-a-document-is-approved' | translate }} - -
-
- -
-
-
- - {{ 'notifications-screen.options.when-a-document-is-sent-for-approval' | translate }} - - - {{ 'notifications-screen.options.when-a-document-is-assigned-to-a-reviewer' | translate }} - - - {{ - 'notifications-screen.options.when-a-reviewer-is-unassigned-from-a-document' | translate - }} + {{ translations[preference] | translate }}
diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts index 17d820d52..3a3c8de9d 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts @@ -1,24 +1,22 @@ import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { notificationsTranslations } from '../../translations/notifications-translations'; -import { NotificationPreferences } from '../../../../models/notification-preferences'; import { NotificationPreferencesService } from '../../../../services/notification-preferences.service'; -enum SendSchedule { - INSTANT = 'instant', - DAILY = 'daily', - WEEKLY = 'weekly', -} - @Component({ selector: 'redaction-notifications-screen', templateUrl: './notifications-screen.component.html', styleUrls: ['./notifications-screen.component.scss'], }) export class NotificationsScreenComponent implements OnInit { - readonly sendSchedules = ['instant', 'daily', 'weekly']; - readonly notificationCategories = ['inAppNotifications', 'emailNotifications']; - + readonly emailNotificationTypes: string[] = ['INSTANT', 'DAILY', 'WEEKLY']; + readonly notificationCategories: string[] = ['inAppNotifications', 'emailNotifications']; + readonly notificationGroupsKeys: string[] = ['own', 'reviewer', 'approver']; + readonly notificationGroupsValues: string[][] = [ + ['dossierStatusChanges', 'requestToJoinTheDossier', 'documentStatusChanges', 'documentIsSentForApproval'], + ['whenIAmAssignedOnADocument', 'whenIAmUnassignedFromADocument', 'whenADocumentIsApproved'], + ['whenADocumentIsSentForApproval', 'whenADocumentIsAssignedToAReviewer', 'whenAReviewerIsUnassignedFromADocument'], + ]; readonly translations = notificationsTranslations; formGroup: FormGroup; @@ -26,33 +24,63 @@ export class NotificationsScreenComponent implements OnInit { constructor( private readonly _formBuilder: FormBuilder, private readonly _notificationPreferencesService: NotificationPreferencesService, - ) { - this.formGroup = this._formBuilder.group({ - inAppNotifications: new FormGroup(new NotificationPreferences() as any), - emailNotifications: new FormGroup(new NotificationPreferences(SendSchedule.INSTANT) as any), - }); - } + ) {} async ngOnInit(): Promise { await this._initializeForm(); } - setSchedule(schedule: string) { - this.formGroup.get('emailNotifications').get('sendSchedule').setValue(schedule); + isCategoryActive(category: string) { + return this.formGroup.get(`${category}Enabled`).value; } - isFormActive(category: string) { - return this.formGroup.get(category).get('isActive').value; + setEmailNotificationType(type: string) { + this.formGroup.get('emailNotificationType').setValue(type); } - getSchedule(category: string) { - return this.formGroup.get(category).get('sendSchedule'); + getEmailNotificationType() { + return this.formGroup.get('emailNotificationType').value; } - save() {} + isPreferenceChecked(category: string, preference: string) { + return this.formGroup.get(category).value.includes(preference); + } + + addRemovePreference(checked: boolean, category: string, preference: string) { + const preferences = this.formGroup.get(category).value; + if (checked) { + preferences.push(preference); + } else { + const indexOfPreference = preferences.indexOf(preference); + preferences.splice(indexOfPreference, 1); + } + this.formGroup.get(category).setValue(preferences); + } + + async save() { + console.log('formGroup: ', this.formGroup.value); + return; + await this._notificationPreferencesService.updateNotificationPreferences(this.formGroup.value).toPromise(); + } private async _initializeForm() { - const notificationPreferences = await this._notificationPreferencesService.getNotificationPreferences().toPromise(); - console.log('notificationPreferences: ', notificationPreferences); + // const notificationPreferences = await this._notificationPreferencesService.getNotificationPreferences().toPromise(); + + const notificationPreferences = { + emailNotificationType: 'DAILY', + emailNotifications: ['documentStatusChanges', 'string'], + emailNotificationsEnabled: true, + inAppNotifications: ['whenADocumentIsAssignedToAReviewer', 'whenAReviewerIsUnassignedFromADocument'], + inAppNotificationsEnabled: true, + userId: 'string', + }; + + this.formGroup = this._formBuilder.group({ + inAppNotificationsEnabled: [notificationPreferences.inAppNotificationsEnabled], + emailNotificationsEnabled: [notificationPreferences.emailNotificationsEnabled], + emailNotificationType: [notificationPreferences.emailNotificationType], + emailNotifications: [notificationPreferences.emailNotifications], + inAppNotifications: [notificationPreferences.inAppNotifications], + }); } } diff --git a/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts b/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts index 0685f92a9..167111342 100644 --- a/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts +++ b/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts @@ -6,4 +6,14 @@ export const notificationsTranslations: { [key: string]: string } = { weekly: _('notifications-screen.schedule.weekly'), inAppNotifications: _('notifications-screen.category.in-app-notifications'), emailNotifications: _('notifications-screen.category.email-notifications'), + documentIsSentForApproval: _('notifications-screen.options.document-is-sent-for-approval'), + documentStatusChanges: _('notifications-screen.options.document-status-changes'), + dossierStatusChanges: _('notifications-screen.options.dossier-status-changes'), + requestToJoinTheDossier: _('notifications-screen.options.request-to-join-the-dossier'), + whenADocumentIsApproved: _('notifications-screen.options.when-a-document-is-approved'), + whenADocumentIsAssignedToAReviewer: _('notifications-screen.options.when-a-document-is-assigned-to-a-reviewer'), + whenADocumentIsSentForApproval: _('notifications-screen.options.when-a-document-is-sent-for-approval'), + whenAReviewerIsUnassignedFromADocument: _('notifications-screen.options.when-a-reviewer-is-unassigned-from-a-document'), + whenIAmAssignedOnADocument: _('notifications-screen.options.when-i-am-assigned-on-a-document'), + whenIAmUnassignedFromADocument: _('notifications-screen.options.when-i-am-unassigned-from-a-document'), } as const; diff --git a/apps/red-ui/src/app/modules/dossier/components/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/modules/dossier/components/pdf-viewer/pdf-viewer.component.ts index 89f0532db..4cd21ba90 100644 --- a/apps/red-ui/src/app/modules/dossier/components/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/pdf-viewer/pdf-viewer.component.ts @@ -295,7 +295,7 @@ export class PdfViewerComponent implements OnInit, OnChanges { } private _setSelectionMode(): void { - const textTool = (this.instance.Core.Tools.TextTool) as TextTool; + const textTool = ( this.instance.Core.Tools.TextTool) as TextTool; textTool.SELECTION_MODE = this._configService.values.SELECTION_MODE; } diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossiers-listing/screen/dossiers-listing-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossiers-listing/screen/dossiers-listing-screen.component.ts index 09e2e3e0b..4a5321717 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossiers-listing/screen/dossiers-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossiers-listing/screen/dossiers-listing-screen.component.ts @@ -38,8 +38,7 @@ import { DossiersService } from '@services/entity-services/dossiers.service'; }) export class DossiersListingScreenComponent extends ListingComponent - implements OnInit, AfterViewInit, OnDestroy, OnAttach, OnDetach -{ + implements OnInit, AfterViewInit, OnDestroy, OnAttach, OnDetach { readonly currentUser = this._userService.currentUser; readonly tableColumnConfigs = this._configService.tableConfig; readonly tableHeaderLabel = _('dossier-listing.table-header.title'); diff --git a/apps/red-ui/src/app/modules/dossier/shared/components/needs-work-badge/needs-work-badge.component.ts b/apps/red-ui/src/app/modules/dossier/shared/components/needs-work-badge/needs-work-badge.component.ts index 7fe83e885..847c1e6c1 100644 --- a/apps/red-ui/src/app/modules/dossier/shared/components/needs-work-badge/needs-work-badge.component.ts +++ b/apps/red-ui/src/app/modules/dossier/shared/components/needs-work-badge/needs-work-badge.component.ts @@ -45,7 +45,7 @@ export class NeedsWorkBadgeComponent { } get hasAnnotationComments(): boolean { - return this.needsWorkInput instanceof File && (this.needsWorkInput).hasAnnotationComments; + return this.needsWorkInput instanceof File && ( this.needsWorkInput).hasAnnotationComments; } reanalysisRequired() { diff --git a/apps/red-ui/src/app/services/notification-preferences.service.ts b/apps/red-ui/src/app/services/notification-preferences.service.ts index 11c8c0eb2..e85a2fc91 100644 --- a/apps/red-ui/src/app/services/notification-preferences.service.ts +++ b/apps/red-ui/src/app/services/notification-preferences.service.ts @@ -12,6 +12,10 @@ export class NotificationPreferencesService extends GenericService { } getNotificationPreferences(): Observable { - return super._getOne([this._userService.currentUser.id]); + return super.get(); + } + + updateNotificationPreferences(body: any): Observable { + return super._post(body); } } diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 95323132d..facb109d3 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -279,7 +279,9 @@ export class AppStateService { } private _getDictionaryFor(dossier: IDossier) { - return this._dictionaryService.getFor(dossier.dossierTemplateId, 'dossier_redaction', dossier.dossierId).toPromise(); + return this._dictionaryService.getFor(dossier.dossierTemplateId, 'dossier_redaction', dossier.dossierId) + .pipe(catchError(() => of({ type: '' }))) + .toPromise(); } private _getDictionaryDataForDossierTemplate$(dossierTemplateId: string): Observable<{ [key: string]: any }> { diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 4b4441fbb..d1e68990c 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,7 +1,7 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://dev-06.iqser.cloud/redaction-gateway-v1", + "API_URL": "https://red-staging.iqser.cloud/redaction-gateway-v1", "APP_NAME": "RedactManager", "AUTO_READ_TIME": 1.5, "BACKEND_APP_VERSION": "4.4.40", @@ -17,7 +17,7 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://dev-06.iqser.cloud/auth/realms/redaction", + "OAUTH_URL": "https://red-staging.iqser.cloud/auth/realms/redaction", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural" } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 929c0daa2..2e0d25652 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1287,9 +1287,9 @@ "in-app-notifications": "In-App Notifications" }, "groups": { - "dossiers-you-are-approver-on": "Dossiers you are approver on", - "dossiers-you-are-reviewer-on": "Dossiers you are reviewer on", - "dossiers-you-own": "Dossiers you own" + "approver": "Dossiers you are approver on", + "own": "Dossiers you own", + "reviewer": "Dossiers you are reviewer on" }, "options-title": "Choose on which category you want to be notified", "options": { From 5d5f68976c2d71cbe1bea1de51fe82df9e9119cc Mon Sep 17 00:00:00 2001 From: Valentin Date: Thu, 4 Nov 2021 22:48:45 +0200 Subject: [PATCH 07/13] removed changes pushed by mistake --- apps/red-ui/src/app/state/app-state.service.ts | 4 +--- apps/red-ui/src/assets/config/config.json | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index facb109d3..95323132d 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -279,9 +279,7 @@ export class AppStateService { } private _getDictionaryFor(dossier: IDossier) { - return this._dictionaryService.getFor(dossier.dossierTemplateId, 'dossier_redaction', dossier.dossierId) - .pipe(catchError(() => of({ type: '' }))) - .toPromise(); + return this._dictionaryService.getFor(dossier.dossierTemplateId, 'dossier_redaction', dossier.dossierId).toPromise(); } private _getDictionaryDataForDossierTemplate$(dossierTemplateId: string): Observable<{ [key: string]: any }> { diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index d1e68990c..4b4441fbb 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,7 +1,7 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://red-staging.iqser.cloud/redaction-gateway-v1", + "API_URL": "https://dev-06.iqser.cloud/redaction-gateway-v1", "APP_NAME": "RedactManager", "AUTO_READ_TIME": 1.5, "BACKEND_APP_VERSION": "4.4.40", @@ -17,7 +17,7 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://red-staging.iqser.cloud/auth/realms/redaction", + "OAUTH_URL": "https://dev-06.iqser.cloud/auth/realms/redaction", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural" } From dd0248e7f5fc7a0fda359f81df9759cbfa583cc0 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 5 Nov 2021 10:13:18 +0200 Subject: [PATCH 08/13] added model --- .../notifications/notifications-screen.component.ts | 6 ++++++ .../src/app/services/notification-preferences.service.ts | 9 +++++---- .../notification-preferences.ts | 7 +++++++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 libs/red-domain/src/lib/notifications-preferences/notification-preferences.ts diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts index 3a3c8de9d..dffef0425 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { notificationsTranslations } from '../../translations/notifications-translations'; import { NotificationPreferencesService } from '../../../../services/notification-preferences.service'; +import { LoadingService } from '../../../../../../../../libs/common-ui/src'; @Component({ selector: 'redaction-notifications-screen', @@ -23,6 +24,7 @@ export class NotificationsScreenComponent implements OnInit { constructor( private readonly _formBuilder: FormBuilder, + private readonly _loadingService: LoadingService, private readonly _notificationPreferencesService: NotificationPreferencesService, ) {} @@ -60,11 +62,15 @@ export class NotificationsScreenComponent implements OnInit { async save() { console.log('formGroup: ', this.formGroup.value); return; + this._loadingService.start(); await this._notificationPreferencesService.updateNotificationPreferences(this.formGroup.value).toPromise(); + this._loadingService.stop(); } private async _initializeForm() { + this._loadingService.start(); // const notificationPreferences = await this._notificationPreferencesService.getNotificationPreferences().toPromise(); + this._loadingService.stop(); const notificationPreferences = { emailNotificationType: 'DAILY', diff --git a/apps/red-ui/src/app/services/notification-preferences.service.ts b/apps/red-ui/src/app/services/notification-preferences.service.ts index e85a2fc91..f1528b5c2 100644 --- a/apps/red-ui/src/app/services/notification-preferences.service.ts +++ b/apps/red-ui/src/app/services/notification-preferences.service.ts @@ -2,20 +2,21 @@ import { Injectable, Injector } from '@angular/core'; import { GenericService } from '../../../../../libs/common-ui/src'; import { Observable } from 'rxjs'; import { UserService } from './user.service'; +import { INotificationPreferences } from '../../../../../libs/red-domain/src/lib/notifications-preferences/notification-preferences'; @Injectable({ providedIn: 'root', }) -export class NotificationPreferencesService extends GenericService { +export class NotificationPreferencesService extends GenericService { constructor(protected readonly _injector: Injector, private readonly _userService: UserService) { super(_injector, 'notification-preferences'); } - getNotificationPreferences(): Observable { + getNotificationPreferences(): Observable { return super.get(); } - updateNotificationPreferences(body: any): Observable { - return super._post(body); + updateNotificationPreferences(notificationPreferences: INotificationPreferences): Observable { + return super._post(notificationPreferences); } } diff --git a/libs/red-domain/src/lib/notifications-preferences/notification-preferences.ts b/libs/red-domain/src/lib/notifications-preferences/notification-preferences.ts new file mode 100644 index 000000000..a70aa9d87 --- /dev/null +++ b/libs/red-domain/src/lib/notifications-preferences/notification-preferences.ts @@ -0,0 +1,7 @@ +export interface INotificationPreferences { + emailNotificationType: 'INSTANT' | 'DAILY' | 'WEEKLY'; + emailNotifications: string[]; + emailNotificationsEnabled: boolean; + inAppNotifications: string[]; + inAppNotificationsEnabled: boolean; +} From 0a74269d56cc46803fd0f1c0234f4a1237ecd225 Mon Sep 17 00:00:00 2001 From: Valentin Date: Sun, 7 Nov 2021 14:12:16 +0200 Subject: [PATCH 09/13] updated request --- .../notifications-screen.component.html | 4 +-- .../notifications-screen.component.ts | 26 ++++++++----------- .../notifications-translations.ts | 3 +++ .../notification-preferences.service.ts | 24 +++++++++++++---- apps/red-ui/src/assets/i18n/en.json | 3 +++ libs/common-ui | 2 +- libs/red-domain/src/index.ts | 1 + .../lib/notifications-preferences/index.ts | 1 + 8 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 libs/red-domain/src/lib/notifications-preferences/index.ts diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html index 1659a116f..059169d07 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html @@ -11,7 +11,7 @@
- +
@@ -35,7 +35,7 @@
-
+
{ - return super.get(); + getNotificationPreferences(): Observable { + return super.get().pipe( + map(notificationPreferences => (Array.isArray(notificationPreferences) ? notificationPreferences[0] : notificationPreferences)), + catchError(() => of(this._defaultPreferences)), + ); } updateNotificationPreferences(notificationPreferences: INotificationPreferences): Observable { return super._post(notificationPreferences); } + + private get _defaultPreferences(): INotificationPreferences { + return { + emailNotificationType: 'INSTANT', + emailNotifications: [], + emailNotificationsEnabled: false, + inAppNotifications: [], + inAppNotificationsEnabled: true, + }; + } } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 8036f1649..76a9badda 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1287,6 +1287,9 @@ "email-notifications": "Email Notifications", "in-app-notifications": "In-App Notifications" }, + "error": { + "generic": "Something went wrong... Preferences update failed!" + }, "groups": { "approver": "Dossiers you are approver on", "own": "Dossiers you own", diff --git a/libs/common-ui b/libs/common-ui index 1df1b1ab8..712178ea3 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 1df1b1ab899e21093eb07c444acf90def933cb02 +Subproject commit 712178ea34c998098cd2c079a0be1dd863dd266e diff --git a/libs/red-domain/src/index.ts b/libs/red-domain/src/index.ts index 5365dabd6..3cd713b40 100644 --- a/libs/red-domain/src/index.ts +++ b/libs/red-domain/src/index.ts @@ -6,6 +6,7 @@ export * from './lib/users'; export * from './lib/pages'; export * from './lib/audit'; export * from './lib/notifications'; +export * from './lib/notifications-preferences'; export * from './lib/dossier-templates'; export * from './lib/dictionaries'; export * from './lib/redaction-log'; diff --git a/libs/red-domain/src/lib/notifications-preferences/index.ts b/libs/red-domain/src/lib/notifications-preferences/index.ts new file mode 100644 index 000000000..8a3478f79 --- /dev/null +++ b/libs/red-domain/src/lib/notifications-preferences/index.ts @@ -0,0 +1 @@ +export * from './notification-preferences'; From 115884609135d21feb4c299441bcec3f17c83dfe Mon Sep 17 00:00:00 2001 From: Valentin Date: Tue, 9 Nov 2021 22:22:01 +0200 Subject: [PATCH 10/13] solved pr comments --- .../modules/account/account-routing.module.ts | 9 ++- .../account-side-nav.component.ts | 3 +- .../src/app/modules/account/account.module.ts | 12 +-- .../base-account-screen-component.html | 20 +++++ .../base-account-screen-component.scss} | 17 ++--- .../base-account-screen-component.ts | 27 +++++++ .../screens/notifications/constants.ts | 47 ++++++++++++ .../notifications-screen.component.html | 64 ---------------- .../notifications-screen.component.scss | 73 ------------------- .../notifications-screen.component.html | 43 +++++++++++ .../notifications-screen.component.scss | 51 +++++++++++++ .../notifications-screen.component.ts | 43 ++++++----- .../notifications/notifications.module.ts | 13 ++++ .../user-profile-screen.component.html | 62 ---------------- .../user-profile-screen.component.html | 37 ++++++++++ .../user-profile-screen.component.scss | 3 + .../user-profile-screen.component.ts | 13 ++-- .../user-profile/user-profile.module.ts | 13 ++++ .../notification-preferences.service.ts | 12 ++- .../notifications-translations.ts | 2 + libs/common-ui | 2 +- .../notification-preferences.ts | 4 +- 22 files changed, 314 insertions(+), 256 deletions(-) create mode 100644 apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.html rename apps/red-ui/src/app/modules/account/{screens/user-profile/user-profile-screen.component.scss => base-account-screen/base-account-screen-component.scss} (64%) create mode 100644 apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.ts create mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/constants.ts delete mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html delete mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss create mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.html create mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.scss rename apps/red-ui/src/app/modules/account/screens/notifications/{ => notifications-screen}/notifications-screen.component.ts (64%) create mode 100644 apps/red-ui/src/app/modules/account/screens/notifications/notifications.module.ts delete mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.html create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.scss rename apps/red-ui/src/app/modules/account/screens/user-profile/{ => user-profile-screen}/user-profile-screen.component.ts (87%) create mode 100644 apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.module.ts rename apps/red-ui/src/app/{ => modules/account}/services/notification-preferences.service.ts (72%) diff --git a/apps/red-ui/src/app/modules/account/account-routing.module.ts b/apps/red-ui/src/app/modules/account/account-routing.module.ts index d0e896a3c..777b82c0c 100644 --- a/apps/red-ui/src/app/modules/account/account-routing.module.ts +++ b/apps/red-ui/src/app/modules/account/account-routing.module.ts @@ -4,27 +4,28 @@ import { CompositeRouteGuard } from '@iqser/common-ui'; import { AuthGuard } from '../auth/auth.guard'; import { RedRoleGuard } from '../auth/red-role.guard'; import { AppStateGuard } from '../../state/app-state.guard'; -import { NotificationsScreenComponent } from './screens/notifications/notifications-screen.component'; -import { UserProfileScreenComponent } from './screens/user-profile/user-profile-screen.component'; +import { BaseAccountScreenComponent } from './base-account-screen/base-account-screen-component'; const routes = [ { path: '', redirectTo: 'user-profile', pathMatch: 'full' }, { path: 'user-profile', - component: UserProfileScreenComponent, + component: BaseAccountScreenComponent, canActivate: [CompositeRouteGuard], data: { routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard], requiredRoles: ['RED_USER'], }, + loadChildren: () => import('./screens/user-profile/user-profile.module').then(m => m.UserProfileModule), }, { path: 'notifications', - component: NotificationsScreenComponent, + component: BaseAccountScreenComponent, canActivate: [CompositeRouteGuard], data: { routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard], }, + loadChildren: () => import('./screens/notifications/notifications.module').then(m => m.NotificationsModule), }, ]; diff --git a/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.ts b/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.ts index ee4d86e53..f4cf007ae 100644 --- a/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.ts +++ b/apps/red-ui/src/app/modules/account/account-side-nav/account-side-nav.component.ts @@ -1,5 +1,5 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; -import { Component } from '@angular/core'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; interface NavItem { readonly label: string; @@ -10,6 +10,7 @@ interface NavItem { selector: 'redaction-account-side-nav', templateUrl: './account-side-nav.component.html', styleUrls: ['./account-side-nav.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, }) export class AccountSideNavComponent { readonly items: NavItem[] = [ diff --git a/apps/red-ui/src/app/modules/account/account.module.ts b/apps/red-ui/src/app/modules/account/account.module.ts index bc2e1c527..28b2ee431 100644 --- a/apps/red-ui/src/app/modules/account/account.module.ts +++ b/apps/red-ui/src/app/modules/account/account.module.ts @@ -3,16 +3,12 @@ import { CommonModule } from '@angular/common'; import { SharedModule } from '../shared/shared.module'; import { AccountRoutingModule } from './account-routing.module'; import { AccountSideNavComponent } from './account-side-nav/account-side-nav.component'; -import { NotificationsScreenComponent } from './screens/notifications/notifications-screen.component'; -import { UserProfileScreenComponent } from './screens/user-profile/user-profile-screen.component'; - -const screens = [NotificationsScreenComponent, UserProfileScreenComponent]; - -const components = [AccountSideNavComponent, ...screens]; +import { BaseAccountScreenComponent } from './base-account-screen/base-account-screen-component'; +import { NotificationPreferencesService } from './services/notification-preferences.service'; @NgModule({ - declarations: [components], - providers: [], + declarations: [AccountSideNavComponent, BaseAccountScreenComponent], imports: [CommonModule, SharedModule, AccountRoutingModule], + providers: [NotificationPreferencesService], }) export class AccountModule {} diff --git a/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.html b/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.html new file mode 100644 index 000000000..1597a1874 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.html @@ -0,0 +1,20 @@ +
+
+ + + +
+
+
+
+
+
+
+
+ + +
+
+
+
+
diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss b/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.scss similarity index 64% rename from apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss rename to apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.scss index e145e5430..fd508d3c9 100644 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.scss +++ b/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.scss @@ -1,15 +1,16 @@ -@use 'variables'; -@use 'common-mixins'; - -.dialog { - min-height: unset; -} +@use 'apps/red-ui/src/assets/styles/variables'; +@use 'libs/common-ui/src/assets/styles/common-mixins'; .content-container { background-color: variables.$grey-2; justify-content: center; @include common-mixins.scroll-bar; overflow: auto; + + .dialog { + width: var(--width); + min-height: unset; + } } .full-height { @@ -21,7 +22,3 @@ height: calc(100% + 50px); z-index: 1; } - -a { - color: black; -} diff --git a/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.ts b/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.ts new file mode 100644 index 000000000..c87363a82 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/base-account-screen/base-account-screen-component.ts @@ -0,0 +1,27 @@ +import { ChangeDetectionStrategy, Component, OnInit, ViewContainerRef } from '@angular/core'; +import { Router } from '@angular/router'; +import { notificationsTranslations } from '../translations/notifications-translations'; + +@Component({ + selector: 'redaction-base-account-screen', + templateUrl: './base-account-screen-component.html', + styleUrls: ['./base-account-screen-component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class BaseAccountScreenComponent implements OnInit { + readonly translations = notificationsTranslations; + path: string; + + constructor(private readonly _router: Router, private readonly _hostRef: ViewContainerRef) { + this.path = this._router.url.split('/').pop(); + } + + ngOnInit(): void { + this._setDialogWidth(); + } + + private _setDialogWidth() { + const element = this._hostRef.element.nativeElement as HTMLElement; + element.style.setProperty('--width', this.path === 'user-profile' ? 'unset' : '100%'); + } +} diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts b/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts new file mode 100644 index 000000000..9f2eb7f6b --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts @@ -0,0 +1,47 @@ +export const EmailNotificationScheduleTypes = { + INSTANT: 'INSTANT', + DAILY: 'DAILY', + WEEKLY: 'WEEKLY', +} as const; + +export type EmailNotificationScheduleType = keyof typeof EmailNotificationScheduleTypes; +export const EmailNotificationScheduleTypesValues = Object.values(EmailNotificationScheduleTypes); + +export const NotificationCategories = { + inAppNotifications: 'inAppNotifications', + emailNotifications: 'emailNotifications', +} as const; + +export const NotificationCategoriesValues = Object.values(NotificationCategories); + +export const OwnDossiersNotificationsTypes = { + dossierStatusChanges: 'dossierStatusChanges', + requestToJoinTheDossier: 'requestToJoinTheDossier', + documentStatusChanges: 'documentStatusChanges', + documentIsSentForApproval: 'documentIsSentForApproval', +} as const; + +export const OwnDossiersNotificationsTypesValues = Object.values(OwnDossiersNotificationsTypes); + +export const ReviewerOnDossiersNotificationsTypes = { + whenIAmAssignedOnADocument: 'whenIAmAssignedOnADocument', + whenIAmUnassignedFromADocument: 'whenIAmUnassignedFromADocument', + whenADocumentIsApproved: 'whenADocumentIsApproved', +} as const; + +export const ReviewerOnDossiersNotificationsTypesValues = Object.values(ReviewerOnDossiersNotificationsTypes); + +export const ApproverOnDossiersNotificationsTypes = { + whenADocumentIsSentForApproval: 'whenADocumentIsSentForApproval', + whenADocumentIsAssignedToAReviewer: 'whenADocumentIsAssignedToAReviewer', + whenAReviewerIsUnassignedFromADocument: 'whenAReviewerIsUnassignedFromADocument', +} as const; + +export const ApproverOnDossiersNotificationsTypesValues = Object.values(ApproverOnDossiersNotificationsTypes); + +export const NotificationGroupsKeys = ['own', 'reviewer', 'approver']; +export const NotificationGroupsValues = [ + OwnDossiersNotificationsTypesValues, + ReviewerOnDossiersNotificationsTypesValues, + ApproverOnDossiersNotificationsTypesValues, +]; diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html deleted file mode 100644 index 059169d07..000000000 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.html +++ /dev/null @@ -1,64 +0,0 @@ -
-
- - - -
-
-
-
-
-
-
-
- -
-
-
- {{ - translations[category] | translate - }} -
- -
-
-
- - - {{ translations[type.toLocaleLowerCase()] | translate }} -
-
- -
- -
-
-
- - {{ translations[preference] | translate }} - -
-
-
-
-
- -
- -
- -
-
-
-
-
diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss deleted file mode 100644 index e541ddbed..000000000 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.scss +++ /dev/null @@ -1,73 +0,0 @@ -@use 'variables'; -@use 'common-mixins'; - -.content-container { - background-color: variables.$grey-2; - justify-content: center; - @include common-mixins.scroll-bar; - overflow: auto; - - .dialog { - width: 100%; - min-height: unset; - - .dialog-content { - flex-direction: column; - - .header { - grid-column: span 2; - padding: 10px 10px; - margin-bottom: -1px; - border-top: 1px solid variables.$separator; - border-bottom: 1px solid variables.$separator; - } - - .options-content { - padding: 10px 48px; - - .statement { - opacity: 0.7; - color: variables.$grey-1; - font-weight: 500; - padding: 10px 0; - } - - .radio-container { - display: flex; - padding: 10px 0 10px; - .radio-button { - display: flex; - align-items: center; - padding-right: 30px; - iqser-round-checkbox { - margin-right: 8px; - } - } - } - - .group { - padding: 10px 0; - - .group-title { - color: variables.$grey-1; - font-weight: 600; - } - - .iqser-input-group { - margin-top: 5px; - } - } - } - } - } -} - -.full-height { - display: flex; - flex-direction: row; - position: absolute; - bottom: 0; - width: 100%; - height: calc(100% + 50px); - z-index: 1; -} diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.html b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.html new file mode 100644 index 000000000..8c76795dc --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.html @@ -0,0 +1,43 @@ +
+
+
+
+ {{ + translations[category] | translate + }} +
+ +
+
+
+ + + {{ translations[type.toLocaleLowerCase()] | translate }} +
+
+ +
+ +
+
+
+ + {{ translations[preference] | translate }} + +
+
+
+
+
+ +
+ +
+
diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.scss b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.scss new file mode 100644 index 000000000..0556bd0c0 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.scss @@ -0,0 +1,51 @@ +@use 'apps/red-ui/src/assets/styles/variables'; +@use 'libs/common-ui/src/assets/styles/common-mixins'; + +.dialog-content { + flex-direction: column; + + .header { + grid-column: span 2; + padding: 10px 10px; + margin-bottom: -1px; + border-top: 1px solid variables.$separator; + border-bottom: 1px solid variables.$separator; + } + + .options-content { + padding: 10px 48px; + + .statement { + opacity: 0.7; + color: variables.$grey-1; + font-weight: 500; + padding: 10px 0; + } + + .radio-container { + display: flex; + padding: 10px 0 10px; + .radio-button { + display: flex; + align-items: center; + padding-right: 30px; + iqser-round-checkbox { + margin-right: 8px; + } + } + } + + .group { + padding: 10px 0; + + .group-title { + color: variables.$grey-1; + font-weight: 600; + } + + .iqser-input-group { + margin-top: 5px; + } + } + } +} diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts similarity index 64% rename from apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts rename to apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts index b0ea86c3c..0c810a54e 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts @@ -1,24 +1,27 @@ -import { Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { notificationsTranslations } from '../../translations/notifications-translations'; -import { NotificationPreferencesService } from '../../../../services/notification-preferences.service'; +import { notificationsTranslations } from '../../../translations/notifications-translations'; +import { NotificationPreferencesService } from '../../../services/notification-preferences.service'; import { LoadingService, Toaster } from '@iqser/common-ui'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; +import { + EmailNotificationScheduleTypesValues, + NotificationCategoriesValues, + NotificationGroupsKeys, + NotificationGroupsValues, +} from '../constants'; @Component({ selector: 'redaction-notifications-screen', templateUrl: './notifications-screen.component.html', styleUrls: ['./notifications-screen.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, }) export class NotificationsScreenComponent implements OnInit { - readonly emailNotificationTypes: string[] = ['INSTANT', 'DAILY', 'WEEKLY']; - readonly notificationCategories: string[] = ['inAppNotifications', 'emailNotifications']; - readonly notificationGroupsKeys: string[] = ['own', 'reviewer', 'approver']; - readonly notificationGroupsValues: string[][] = [ - ['dossierStatusChanges', 'requestToJoinTheDossier', 'documentStatusChanges', 'documentIsSentForApproval'], - ['whenIAmAssignedOnADocument', 'whenIAmUnassignedFromADocument', 'whenADocumentIsApproved'], - ['whenADocumentIsSentForApproval', 'whenADocumentIsAssignedToAReviewer', 'whenAReviewerIsUnassignedFromADocument'], - ]; + readonly emailNotificationScheduleTypes = EmailNotificationScheduleTypesValues; + readonly notificationCategories = NotificationCategoriesValues; + readonly notificationGroupsKeys = NotificationGroupsKeys; + readonly notificationGroupsValues = NotificationGroupsValues; readonly translations = notificationsTranslations; formGroup: FormGroup; @@ -28,7 +31,15 @@ export class NotificationsScreenComponent implements OnInit { private readonly _formBuilder: FormBuilder, private readonly _loadingService: LoadingService, private readonly _notificationPreferencesService: NotificationPreferencesService, - ) {} + ) { + this.formGroup = this._formBuilder.group({ + inAppNotificationsEnabled: [undefined], + emailNotificationsEnabled: [undefined], + emailNotificationType: [undefined], + emailNotifications: [undefined], + inAppNotifications: [undefined], + }); + } async ngOnInit(): Promise { await this._initializeForm(); @@ -75,13 +86,7 @@ export class NotificationsScreenComponent implements OnInit { this._loadingService.start(); const notificationPreferences = await this._notificationPreferencesService.getNotificationPreferences().toPromise(); - this.formGroup = this._formBuilder.group({ - inAppNotificationsEnabled: [notificationPreferences.inAppNotificationsEnabled], - emailNotificationsEnabled: [notificationPreferences.emailNotificationsEnabled], - emailNotificationType: [notificationPreferences.emailNotificationType], - emailNotifications: [notificationPreferences.emailNotifications], - inAppNotifications: [notificationPreferences.inAppNotifications], - }); + this.formGroup.patchValue(notificationPreferences); this._loadingService.stop(); } diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications.module.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications.module.ts new file mode 100644 index 000000000..bc6d3f30a --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from '../../../shared/shared.module'; +import { NotificationsScreenComponent } from './notifications-screen/notifications-screen.component'; + +const routes = [{ path: '', component: NotificationsScreenComponent }]; + +@NgModule({ + declarations: [NotificationsScreenComponent], + imports: [RouterModule.forChild(routes), CommonModule, SharedModule], +}) +export class NotificationsModule {} diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html deleted file mode 100644 index aa7945a3f..000000000 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.html +++ /dev/null @@ -1,62 +0,0 @@ -
-
- - - -
-
-
-
-
-
-
-
-
-
-
-
- - -
- -
- - -
- -
- - -
-
- - - - {{ translations[language] | translate }} - - -
- -
-
- -
- -
-
-
-
-
-
-
diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.html b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.html new file mode 100644 index 000000000..25d5a5a44 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.html @@ -0,0 +1,37 @@ +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ + + + {{ translations[language] | translate }} + + +
+ +
+
+ +
+ +
+
diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.scss b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.scss new file mode 100644 index 000000000..e1573c569 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.scss @@ -0,0 +1,3 @@ +a { + color: black; +} diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.ts similarity index 87% rename from apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts rename to apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.ts index f43f3db3b..f1a23936a 100644 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.ts @@ -1,19 +1,20 @@ -import { Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { languagesTranslations } from '../../translations/languages-translations'; -import { UserService } from '../../../../services/user.service'; -import { PermissionsService } from '../../../../services/permissions.service'; -import { ConfigService } from '../../../../services/config.service'; -import { LanguageService } from '../../../../i18n/language.service'; import { DomSanitizer } from '@angular/platform-browser'; import { TranslateService } from '@ngx-translate/core'; import { LoadingService } from '@iqser/common-ui'; import { IProfile } from '@red/domain'; +import { languagesTranslations } from '../../../translations/languages-translations'; +import { PermissionsService } from '../../../../../services/permissions.service'; +import { UserService } from '../../../../../services/user.service'; +import { ConfigService } from '../../../../../services/config.service'; +import { LanguageService } from '../../../../../i18n/language.service'; @Component({ selector: 'redaction-user-profile-screen', templateUrl: './user-profile-screen.component.html', styleUrls: ['./user-profile-screen.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, }) export class UserProfileScreenComponent implements OnInit { formGroup: FormGroup; diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.module.ts b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.module.ts new file mode 100644 index 000000000..928581695 --- /dev/null +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { CommonModule } from '@angular/common'; +import { SharedModule } from '../../../shared/shared.module'; +import { UserProfileScreenComponent } from './user-profile-screen/user-profile-screen.component'; + +const routes = [{ path: '', component: UserProfileScreenComponent }]; + +@NgModule({ + declarations: [UserProfileScreenComponent], + imports: [RouterModule.forChild(routes), CommonModule, SharedModule], +}) +export class UserProfileModule {} diff --git a/apps/red-ui/src/app/services/notification-preferences.service.ts b/apps/red-ui/src/app/modules/account/services/notification-preferences.service.ts similarity index 72% rename from apps/red-ui/src/app/services/notification-preferences.service.ts rename to apps/red-ui/src/app/modules/account/services/notification-preferences.service.ts index ecd17e5ae..d4d44a9d5 100644 --- a/apps/red-ui/src/app/services/notification-preferences.service.ts +++ b/apps/red-ui/src/app/modules/account/services/notification-preferences.service.ts @@ -1,9 +1,10 @@ import { Injectable, Injector } from '@angular/core'; import { GenericService } from '@iqser/common-ui'; import { Observable, of } from 'rxjs'; -import { UserService } from './user.service'; +import { UserService } from '../../../services/user.service'; import { INotificationPreferences } from '@red/domain'; -import { catchError, map } from 'rxjs/operators'; +import { catchError } from 'rxjs/operators'; +import { EmailNotificationScheduleTypes } from '../screens/notifications/constants'; @Injectable({ providedIn: 'root', @@ -14,10 +15,7 @@ export class NotificationPreferencesService extends GenericService { - return super.get().pipe( - map(notificationPreferences => (Array.isArray(notificationPreferences) ? notificationPreferences[0] : notificationPreferences)), - catchError(() => of(this._defaultPreferences)), - ); + return super.get().pipe(catchError(() => of(this._defaultPreferences))); } updateNotificationPreferences(notificationPreferences: INotificationPreferences): Observable { @@ -26,7 +24,7 @@ export class NotificationPreferencesService extends GenericService Date: Wed, 10 Nov 2021 10:46:02 +0200 Subject: [PATCH 11/13] solved comments --- .../account/screens/notifications/constants.ts | 13 ++----------- .../notifications-screen.component.scss | 2 +- .../notifications-screen.component.ts | 12 ++++-------- .../services/notification-preferences.service.ts | 11 ++++------- libs/common-ui | 2 +- .../src/lib/notifications-preferences/index.ts | 1 + .../notification-preferences.ts | 2 +- .../src/lib/notifications-preferences/types.ts | 8 ++++++++ 8 files changed, 22 insertions(+), 29 deletions(-) create mode 100644 libs/red-domain/src/lib/notifications-preferences/types.ts diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts b/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts index 9f2eb7f6b..3c98f33b1 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts @@ -1,12 +1,3 @@ -export const EmailNotificationScheduleTypes = { - INSTANT: 'INSTANT', - DAILY: 'DAILY', - WEEKLY: 'WEEKLY', -} as const; - -export type EmailNotificationScheduleType = keyof typeof EmailNotificationScheduleTypes; -export const EmailNotificationScheduleTypesValues = Object.values(EmailNotificationScheduleTypes); - export const NotificationCategories = { inAppNotifications: 'inAppNotifications', emailNotifications: 'emailNotifications', @@ -39,9 +30,9 @@ export const ApproverOnDossiersNotificationsTypes = { export const ApproverOnDossiersNotificationsTypesValues = Object.values(ApproverOnDossiersNotificationsTypes); -export const NotificationGroupsKeys = ['own', 'reviewer', 'approver']; +export const NotificationGroupsKeys = ['own', 'reviewer', 'approver'] as const; export const NotificationGroupsValues = [ OwnDossiersNotificationsTypesValues, ReviewerOnDossiersNotificationsTypesValues, ApproverOnDossiersNotificationsTypesValues, -]; +] as const; diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.scss b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.scss index 0556bd0c0..82f2afa68 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.scss +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.scss @@ -1,4 +1,4 @@ -@use 'apps/red-ui/src/assets/styles/variables'; +@use 'variables'; @use 'libs/common-ui/src/assets/styles/common-mixins'; .dialog-content { diff --git a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts index 0c810a54e..e6b8f4a2a 100644 --- a/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/notifications/notifications-screen/notifications-screen.component.ts @@ -4,12 +4,8 @@ import { notificationsTranslations } from '../../../translations/notifications-t import { NotificationPreferencesService } from '../../../services/notification-preferences.service'; import { LoadingService, Toaster } from '@iqser/common-ui'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; -import { - EmailNotificationScheduleTypesValues, - NotificationCategoriesValues, - NotificationGroupsKeys, - NotificationGroupsValues, -} from '../constants'; +import { NotificationCategoriesValues, NotificationGroupsKeys, NotificationGroupsValues } from '../constants'; +import { EmailNotificationScheduleTypesValues } from '@red/domain'; @Component({ selector: 'redaction-notifications-screen', @@ -75,7 +71,7 @@ export class NotificationsScreenComponent implements OnInit { async save() { this._loadingService.start(); try { - await this._notificationPreferencesService.updateNotificationPreferences(this.formGroup.value).toPromise(); + await this._notificationPreferencesService.update(this.formGroup.value).toPromise(); } catch (e) { this._toaster.error(_('notifications-screen.error.generic')); } @@ -85,7 +81,7 @@ export class NotificationsScreenComponent implements OnInit { private async _initializeForm() { this._loadingService.start(); - const notificationPreferences = await this._notificationPreferencesService.getNotificationPreferences().toPromise(); + const notificationPreferences = await this._notificationPreferencesService.get().toPromise(); this.formGroup.patchValue(notificationPreferences); this._loadingService.stop(); diff --git a/apps/red-ui/src/app/modules/account/services/notification-preferences.service.ts b/apps/red-ui/src/app/modules/account/services/notification-preferences.service.ts index d4d44a9d5..acd23a718 100644 --- a/apps/red-ui/src/app/modules/account/services/notification-preferences.service.ts +++ b/apps/red-ui/src/app/modules/account/services/notification-preferences.service.ts @@ -2,23 +2,20 @@ import { Injectable, Injector } from '@angular/core'; import { GenericService } from '@iqser/common-ui'; import { Observable, of } from 'rxjs'; import { UserService } from '../../../services/user.service'; -import { INotificationPreferences } from '@red/domain'; +import { EmailNotificationScheduleTypes, INotificationPreferences } from '@red/domain'; import { catchError } from 'rxjs/operators'; -import { EmailNotificationScheduleTypes } from '../screens/notifications/constants'; -@Injectable({ - providedIn: 'root', -}) +@Injectable() export class NotificationPreferencesService extends GenericService { constructor(protected readonly _injector: Injector, private readonly _userService: UserService) { super(_injector, 'notification-preferences'); } - getNotificationPreferences(): Observable { + get(): Observable { return super.get().pipe(catchError(() => of(this._defaultPreferences))); } - updateNotificationPreferences(notificationPreferences: INotificationPreferences): Observable { + update(notificationPreferences: INotificationPreferences): Observable { return super._post(notificationPreferences); } diff --git a/libs/common-ui b/libs/common-ui index 64bf1b270..ca957326b 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 64bf1b270deb96f399b1ab603cf9cd00ff700f36 +Subproject commit ca957326b3514c7bc158fd80c9f65d1967d431d0 diff --git a/libs/red-domain/src/lib/notifications-preferences/index.ts b/libs/red-domain/src/lib/notifications-preferences/index.ts index 8a3478f79..f2fedd47f 100644 --- a/libs/red-domain/src/lib/notifications-preferences/index.ts +++ b/libs/red-domain/src/lib/notifications-preferences/index.ts @@ -1 +1,2 @@ export * from './notification-preferences'; +export * from './types'; diff --git a/libs/red-domain/src/lib/notifications-preferences/notification-preferences.ts b/libs/red-domain/src/lib/notifications-preferences/notification-preferences.ts index 8577fb137..394af0193 100644 --- a/libs/red-domain/src/lib/notifications-preferences/notification-preferences.ts +++ b/libs/red-domain/src/lib/notifications-preferences/notification-preferences.ts @@ -1,4 +1,4 @@ -import { EmailNotificationScheduleType } from '../../../../../apps/red-ui/src/app/modules/account/screens/notifications/constants'; +import { EmailNotificationScheduleType } from './types'; export interface INotificationPreferences { emailNotificationType: EmailNotificationScheduleType; diff --git a/libs/red-domain/src/lib/notifications-preferences/types.ts b/libs/red-domain/src/lib/notifications-preferences/types.ts new file mode 100644 index 000000000..1b7068c38 --- /dev/null +++ b/libs/red-domain/src/lib/notifications-preferences/types.ts @@ -0,0 +1,8 @@ +export const EmailNotificationScheduleTypes = { + INSTANT: 'INSTANT', + DAILY: 'DAILY', + WEEKLY: 'WEEKLY', +} as const; + +export type EmailNotificationScheduleType = keyof typeof EmailNotificationScheduleTypes; +export const EmailNotificationScheduleTypesValues = Object.values(EmailNotificationScheduleTypes); From 2dbe010982ada86f1995e7a4ea85228891af967c Mon Sep 17 00:00:00 2001 From: Valentin Date: Wed, 10 Nov 2021 11:48:13 +0200 Subject: [PATCH 12/13] removed 'red-page-layout.scss' --- .../src/assets/styles/red-page-layout.scss | 388 ------------------ 1 file changed, 388 deletions(-) delete mode 100644 apps/red-ui/src/assets/styles/red-page-layout.scss diff --git a/apps/red-ui/src/assets/styles/red-page-layout.scss b/apps/red-ui/src/assets/styles/red-page-layout.scss deleted file mode 100644 index d16387f6a..000000000 --- a/apps/red-ui/src/assets/styles/red-page-layout.scss +++ /dev/null @@ -1,388 +0,0 @@ -@use 'variables'; -@use 'common-mixins'; - -html, -body { - margin: 0; - padding: 0; - height: 100vh; - font-family: 'Inter', sans-serif; - color: variables.$accent; - font-size: 13px; - line-height: 16px; -} - -section.settings { - display: flex; - - .page-header, - .red-content-inner { - width: calc(100vw - 200px); - } - - redaction-account-side-nav, - redaction-admin-side-nav { - height: calc(100vh - 61px); - } -} - -.page-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 0 24px; - height: 50px; - width: 100vw; - box-sizing: border-box; - background-color: variables.$white; - border-bottom: 1px solid variables.$separator; - - .filters { - display: flex; - align-items: center; - - > *:not(:last-child) { - margin-right: 2px; - } - - > div:first-child { - margin-right: 8px; - } - - form { - margin-left: 6px; - - .iqser-input-group { - width: 250px; - } - } - - .reset-filters { - margin-left: 12px; - color: variables.$primary; - cursor: pointer; - } - } - - .actions { - display: flex; - align-items: center; - justify-content: flex-end; - - > *:not(:last-child) { - margin-right: 2px; - } - } -} - -.fullscreen { - .page-header { - position: absolute; - top: 0; - } - - .red-content-inner { - height: calc(100% - 50px); - } - - .overlay-shadow { - top: 50px; - } -} - -.red-content-inner { - display: flex; - flex-direction: row; - position: absolute; - bottom: 0; - width: 100%; - height: calc(100% - 111px); - transition: height ease-in-out 0.2s; -} - -.content-container { - overflow: hidden; - position: relative; - width: 100%; - - .dialog { - border-radius: 8px; - margin-top: 40px; - margin-bottom: 70px; - background-color: variables.$white; - max-width: 650px; - height: fit-content; - box-shadow: 0 1px 5px 0 rgba(40, 50, 65, 0.19); - position: unset; - - .heading-l { - margin-bottom: 16px; - } - - .dialog-content { - display: flex; - - .dialog-content-left { - min-width: 300px; - margin-right: 64px; - } - - .link-action { - margin-top: 8px; - } - } - } - - @media only screen and (max-width: 1600px) { - .user-column { - justify-content: center; - align-items: center; - - redaction-initials-avatar .username { - display: none; - } - } - } -} - -.right-container { - border-left: 1px solid variables.$grey-4; - box-sizing: border-box; - background: variables.$white; - overflow: hidden; - transition: width ease-in-out 0.2s, min-width ease-in-out 0.2s; - - &:hover { - overflow-y: auto; - @include common-mixins.scroll-bar; - } - - .collapsed-wrapper { - display: none; - } - - &.collapsed { - padding-left: 0 !important; - padding-right: 0 !important; - width: 60px !important; - min-width: 60px !important; - display: flex; - - div:not(.collapsed-wrapper) { - display: none; - } - - .collapsed-wrapper { - display: flex; - flex-direction: column; - align-items: center; - width: 60px; - - div { - display: initial; - } - - .all-caps-label { - transform: rotate(90deg) translateX(50%); - white-space: nowrap; - margin-top: 10px; - } - } - } -} - -.flex { - display: flex !important; -} - -.flex-end { - display: flex; - justify-content: flex-end; -} - -.flex-center { - display: flex; - justify-content: center; -} - -.flex-align-items-center { - display: flex; - align-items: center; -} - -.flex-1 { - flex: 1; -} - -.flex-2 { - flex: 2; -} - -.mt-5 { - margin-top: 5px; -} - -.mt-8 { - margin-top: 8px; -} - -.mt-16 { - margin-top: 16px !important; -} - -.mt-20 { - margin-top: 20px; -} - -.mt-24 { - margin-top: 24px; -} - -.mt-32 { - margin-top: 32px; -} - -.mb-6 { - margin-bottom: 6px; -} - -.mb-8 { - margin-bottom: 8px !important; -} - -.mb-12 { - margin-bottom: 12px !important; -} - -.ml-8 { - margin-left: 8px; -} - -.ml-14 { - margin-left: 14px; -} - -.ml-16 { - margin-left: 16px; -} - -.mr-24 { - margin-right: 24px; -} - -.pb-24 { - padding-bottom: 24px; -} - -.pb-32 { - padding-bottom: 32px; -} - -.w-100 { - min-width: 100px !important; - width: 100px !important; -} - -.break-20 { - height: 20px; - background: transparent; - display: block; -} - -.detail-row { - opacity: 1; - font-family: Inter, sans-serif; - font-size: 14px; - letter-spacing: 0; - line-height: 14px; - padding: 4px; -} - -.red-top-bar { - height: 61px; - width: 100vw; - max-height: 61px; - display: flex; - flex-direction: column; - - .top-bar-row { - height: 60px; - display: flex; - justify-content: space-between; - padding: 0 24px; - - .center { - display: flex; - align-items: center; - justify-content: center; - margin: 0 50px; - } - - .app-name { - font-family: 'OpenSans Extrabold', sans-serif; - margin-left: 10px; - height: 20px; - font-size: 13px; - font-weight: 800; - letter-spacing: 0; - line-height: 20px; - white-space: nowrap; - } - - .menu { - display: flex; - align-items: center; - overflow: hidden; - - &.right { - justify-content: flex-end; - } - } - } - - .divider { - height: 1px; - opacity: 0.15; - background-color: variables.$accent; - } -} - -.hidden { - display: none !important; -} - -.not-visible { - visibility: hidden; -} - -.pointer { - cursor: pointer; -} - -.mr-4 { - margin-right: 4px !important; -} - -.mr-8 { - margin-right: 8px !important; -} - -.mr-16 { - margin-right: 16px; -} - -.mr-34 { - margin-right: 34px; -} - -.fit-content { - width: fit-content; -} - -.d-flex { - display: flex; -} - -.cdk-overlay-container { - z-index: 800; -} From 070df8a0ab5ced2e9c2e525f2f2e856ce045bcef Mon Sep 17 00:00:00 2001 From: Valentin Date: Wed, 10 Nov 2021 12:01:55 +0200 Subject: [PATCH 13/13] updated EmailNotificationScheduleTypes to match with the backend values --- .../account/translations/notifications-translations.ts | 6 +++--- libs/red-domain/src/lib/notifications-preferences/types.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts b/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts index 852bee8e1..c85d03104 100644 --- a/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts +++ b/apps/red-ui/src/app/modules/account/translations/notifications-translations.ts @@ -1,9 +1,9 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; export const notificationsTranslations: { [key: string]: string } = { - instant: _('notifications-screen.schedule.instant'), - daily: _('notifications-screen.schedule.daily'), - weekly: _('notifications-screen.schedule.weekly'), + daily: _('notifications-screen.schedule.instant'), + daily_summary: _('notifications-screen.schedule.daily'), + weekly_summary: _('notifications-screen.schedule.weekly'), inAppNotifications: _('notifications-screen.category.in-app-notifications'), emailNotifications: _('notifications-screen.category.email-notifications'), documentIsSentForApproval: _('notifications-screen.options.document-is-sent-for-approval'), diff --git a/libs/red-domain/src/lib/notifications-preferences/types.ts b/libs/red-domain/src/lib/notifications-preferences/types.ts index 1b7068c38..31c6061e1 100644 --- a/libs/red-domain/src/lib/notifications-preferences/types.ts +++ b/libs/red-domain/src/lib/notifications-preferences/types.ts @@ -1,7 +1,7 @@ export const EmailNotificationScheduleTypes = { - INSTANT: 'INSTANT', - DAILY: 'DAILY', - WEEKLY: 'WEEKLY', + INSTANT: 'DAILY', + DAILY: 'DAILY_SUMMARY', + WEEKLY: 'WEEKLY_SUMMARY', } as const; export type EmailNotificationScheduleType = keyof typeof EmailNotificationScheduleTypes;