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 deleted file mode 100644 index a6649c927..000000000 --- a/apps/red-ui/src/app/modules/account/screens/notifications/constants.ts +++ /dev/null @@ -1,43 +0,0 @@ -export const NotificationCategories = { - inAppNotifications: 'inAppNotifications', - emailNotifications: 'emailNotifications', -} as const; - -export const NotificationCategoriesValues = Object.values(NotificationCategories); - -export const DossierNotificationsTypes = { - dossierOwnerSet: 'DOSSIER_OWNER_SET', - dossierOwnerRemoved: 'DOSSIER_OWNER_REMOVED', - userBecomseDossierMember: 'USER_BECOMES_DOSSIER_MEMBER', - userRemovedAsDossierMember: 'USER_REMOVED_AS_DOSSIER_MEMBER', - userPromotedToApprover: 'USER_PROMOTED_TO_APPROVER', - userDegradedToReviewer: 'USER_DEGRADED_TO_REVIEWER', - dossierOwnerDeleted: 'DOSSIER_OWNER_DELETED', - dossierDeleted: 'DOSSIER_DELETED', -} as const; - -export const DossierNotificationsTypesValues = Object.values(DossierNotificationsTypes); - -export const DocumentNotificationsTypes = { - assignReviewer: 'ASSIGN_REVIEWER', - assignApprover: 'ASSIGN_APPROVER', - unassignedFromFile: 'UNASSIGNED_FROM_FILE', - // documentUnderReview: 'DOCUMENT_UNDER_REVIEW', - // documentUnderApproval: 'DOCUMENT_UNDER_APPROVAL', - documentApproved: 'DOCUMENT_APPROVED', -} as const; - -export const DocumentNotificationsTypesValues = Object.values(DocumentNotificationsTypes); - -export const OtherNotificationsTypes = { - downloadReady: 'DOWNLOAD_READY', -} as const; - -export const OtherNotificationsTypesValues = Object.values(OtherNotificationsTypes); - -export const NotificationGroupsKeys = ['dossier', 'document', 'other'] as const; -export const NotificationGroupsValues = [ - DossierNotificationsTypesValues, - DocumentNotificationsTypesValues, - OtherNotificationsTypesValues, -] as const; 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 index 8c76795dc..94a52a5c3 100644 --- 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 @@ -7,25 +7,25 @@ }} -
-
-
- - - {{ translations[type.toLocaleLowerCase()] | translate }} -
-
+
+ + + + + + +
-
-
+
+
{{ translations[preference] | translate }} 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 c2003cddb..73657ced5 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,8 +4,12 @@ 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 { NotificationCategoriesValues, NotificationGroupsKeys, NotificationGroupsValues } from '../constants'; -import { EmailNotificationScheduleTypesValues } from '@red/domain'; +import { + EmailNotificationScheduleTypesValues, + NotificationCategoriesValues, + NotificationGroupsKeys, + NotificationGroupsValues, +} from '@red/domain'; @Component({ selector: 'redaction-notifications-screen', @@ -33,16 +37,6 @@ export class NotificationsScreenComponent implements OnInit { await this._initializeForm(); } - private _getForm(): FormGroup { - return this._formBuilder.group({ - inAppNotificationsEnabled: [undefined], - emailNotificationsEnabled: [undefined], - emailNotificationType: [undefined], - emailNotifications: [undefined], - inAppNotifications: [undefined], - }); - } - isCategoryActive(category: string) { return this.formGroup.get(`${category}Enabled`).value; } @@ -80,6 +74,16 @@ export class NotificationsScreenComponent implements OnInit { this._loadingService.stop(); } + private _getForm(): FormGroup { + return this._formBuilder.group({ + inAppNotificationsEnabled: [undefined], + emailNotificationsEnabled: [undefined], + emailNotificationType: [undefined], + emailNotifications: [undefined], + inAppNotifications: [undefined], + }); + } + private async _initializeForm() { this._loadingService.start(); diff --git a/libs/red-domain/src/lib/notifications-preferences/types.ts b/libs/red-domain/src/lib/notifications-preferences/types.ts index 31c6061e1..a0e1a2d23 100644 --- a/libs/red-domain/src/lib/notifications-preferences/types.ts +++ b/libs/red-domain/src/lib/notifications-preferences/types.ts @@ -6,3 +6,47 @@ export const EmailNotificationScheduleTypes = { 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 DossierNotificationsTypes = { + dossierOwnerSet: 'DOSSIER_OWNER_SET', + dossierOwnerRemoved: 'DOSSIER_OWNER_REMOVED', + userBecomseDossierMember: 'USER_BECOMES_DOSSIER_MEMBER', + userRemovedAsDossierMember: 'USER_REMOVED_AS_DOSSIER_MEMBER', + userPromotedToApprover: 'USER_PROMOTED_TO_APPROVER', + userDegradedToReviewer: 'USER_DEGRADED_TO_REVIEWER', + dossierOwnerDeleted: 'DOSSIER_OWNER_DELETED', + dossierDeleted: 'DOSSIER_DELETED', +} as const; + +export const DossierNotificationsTypesValues = Object.values(DossierNotificationsTypes); + +export const DocumentNotificationsTypes = { + assignReviewer: 'ASSIGN_REVIEWER', + assignApprover: 'ASSIGN_APPROVER', + unassignedFromFile: 'UNASSIGNED_FROM_FILE', + // documentUnderReview: 'DOCUMENT_UNDER_REVIEW', + // documentUnderApproval: 'DOCUMENT_UNDER_APPROVAL', + documentApproved: 'DOCUMENT_APPROVED', +} as const; + +export const DocumentNotificationsTypesValues = Object.values(DocumentNotificationsTypes); + +export const OtherNotificationsTypes = { + downloadReady: 'DOWNLOAD_READY', +} as const; + +export const OtherNotificationsTypesValues = Object.values(OtherNotificationsTypes); + +export const NotificationGroupsKeys = ['dossier', 'document', 'other'] as const; +export const NotificationGroupsValues = [ + DossierNotificationsTypesValues, + DocumentNotificationsTypesValues, + OtherNotificationsTypesValues, +] as const;