From 355fed53f3dc45fc27245e5b13dcefadac774b87 Mon Sep 17 00:00:00 2001 From: seraph Date: Tue, 5 May 2020 18:17:12 +0200 Subject: [PATCH 1/2] add user settings button & modal --- angular.json | 1 + package.json | 5 +- src/app/app-routing.module.ts | 2 - src/app/app.component.ts | 7 +- .../components/header/header.component.html | 30 +- .../components/header/header.component.ts | 15 +- .../components/login/login.component.html | 1 - .../core/components/login/login.component.ts | 12 - .../language-selector.component.html | 10 - .../language-selector.component.ts | 38 - .../theme-selector.component.html | 24 - src/app/core/core.module.ts | 16 +- src/app/core/enums/answer-granularity.enum.ts | 4 - .../{answer-type.enum.ts => response.enum.ts} | 2 +- src/app/core/enums/user-role.enum.ts | 2 +- src/app/core/enums/workflow-step.enum.ts | 2 +- .../core/interfaces/date-options.interface.ts | 5 - src/app/core/models/answer.model.ts | 6 +- src/app/core/models/choice.model.ts | 5 + src/app/core/models/comment.model.ts | 3 + src/app/core/models/configuration.model.ts | 26 + src/app/core/models/poll-config.model.ts | 13 - src/app/core/models/poll-options.model.ts | 9 - src/app/core/models/poll.model.ts | 26 +- src/app/core/models/question.model.ts | 3 + src/app/core/models/user.model.ts | 6 +- src/app/core/services/api.service.ts | 31 +- .../core/services/language.service.spec.ts | 16 + src/app/core/services/language.service.ts | 66 + src/app/core/services/loader.service.spec.ts | 16 + src/app/core/services/loader.service.ts | 14 + src/app/core/services/mocking.service.ts | 31 +- src/app/core/services/modal.service.spec.ts | 16 + src/app/core/services/modal.service.ts | 15 + src/app/core/services/poll.service.ts | 5 +- src/app/core/services/storage.service.ts | 3 + src/app/core/services/url.service.spec.ts | 16 + src/app/core/services/url.service.ts | 23 + src/app/core/services/user.service.ts | 11 +- src/app/core/services/workflow.service.ts | 2 +- src/app/core/utils/date-utils.service.ts | 31 - .../edit-description.component.ts | 8 +- .../poll-edit/poll-edit.component.ts | 8 +- .../profile/profile.component.html | 8 +- .../profile/profile.component.ts | 7 +- .../stepper/stepper.component.ts | 2 +- .../old-stuff/old-stuff-routing.module.ts | 4 +- .../create-or-retrieve.component.html | 4 +- .../voting-navigation.component.html | 2 +- .../voting-summary.component.html | 4 +- .../participation-routing.module.ts | 10 +- .../participation.component.html | 33 +- .../participation/participation.component.ts | 26 +- .../participation/participation.module.ts | 3 +- .../poll-comment/poll-comment.component.html | 1 + .../poll-comment/poll-comment.component.scss} | 0 .../poll-comment.component.spec.ts | 24 + .../poll-comment/poll-comment.component.ts | 12 + .../participation/poll/poll.component.html | 16 +- .../participation/poll/poll.component.ts | 22 +- .../language-selector.component.html | 14 + .../language-selector.component.scss | 0 .../language-selector.component.spec.ts | 0 .../language-selector.component.ts | 27 + .../theme-selector.component.html | 30 + .../theme-selector.component.scss | 0 .../theme-selector.component.spec.ts | 0 .../theme-selector.component.ts | 10 +- .../settings/settings.component.html | 33 + .../settings/settings.component.scss | 0 .../settings/settings.component.spec.ts} | 12 +- .../components/settings/settings.component.ts | 41 + src/app/shared/shared.module.ts | 76 +- src/environments/environment.prod.ts | 34 +- src/environments/environment.ts | 19 +- yarn.lock | 1255 ++++++++--------- 76 files changed, 1308 insertions(+), 1006 deletions(-) delete mode 100644 src/app/core/components/login/login.component.html delete mode 100644 src/app/core/components/login/login.component.ts delete mode 100644 src/app/core/components/selectors/language-selector/language-selector.component.html delete mode 100644 src/app/core/components/selectors/language-selector/language-selector.component.ts delete mode 100644 src/app/core/components/selectors/theme-selector/theme-selector.component.html delete mode 100644 src/app/core/enums/answer-granularity.enum.ts rename src/app/core/enums/{answer-type.enum.ts => response.enum.ts} (64%) delete mode 100644 src/app/core/interfaces/date-options.interface.ts create mode 100644 src/app/core/models/choice.model.ts create mode 100644 src/app/core/models/comment.model.ts create mode 100644 src/app/core/models/configuration.model.ts delete mode 100644 src/app/core/models/poll-config.model.ts delete mode 100644 src/app/core/models/poll-options.model.ts create mode 100644 src/app/core/models/question.model.ts create mode 100644 src/app/core/services/language.service.spec.ts create mode 100644 src/app/core/services/language.service.ts create mode 100644 src/app/core/services/loader.service.spec.ts create mode 100644 src/app/core/services/loader.service.ts create mode 100644 src/app/core/services/modal.service.spec.ts create mode 100644 src/app/core/services/modal.service.ts create mode 100644 src/app/core/services/url.service.spec.ts create mode 100644 src/app/core/services/url.service.ts create mode 100644 src/app/features/participation/poll-comment/poll-comment.component.html rename src/app/{core/components/login/login.component.scss => features/participation/poll-comment/poll-comment.component.scss} (100%) create mode 100644 src/app/features/participation/poll-comment/poll-comment.component.spec.ts create mode 100644 src/app/features/participation/poll-comment/poll-comment.component.ts create mode 100644 src/app/shared/components/selectors/language-selector/language-selector.component.html rename src/app/{core => shared}/components/selectors/language-selector/language-selector.component.scss (100%) rename src/app/{core => shared}/components/selectors/language-selector/language-selector.component.spec.ts (100%) create mode 100644 src/app/shared/components/selectors/language-selector/language-selector.component.ts create mode 100644 src/app/shared/components/selectors/theme-selector/theme-selector.component.html rename src/app/{core => shared}/components/selectors/theme-selector/theme-selector.component.scss (100%) rename src/app/{core => shared}/components/selectors/theme-selector/theme-selector.component.spec.ts (100%) rename src/app/{core => shared}/components/selectors/theme-selector/theme-selector.component.ts (67%) create mode 100644 src/app/shared/components/settings/settings.component.html create mode 100644 src/app/shared/components/settings/settings.component.scss rename src/app/{core/components/login/login.component.spec.ts => shared/components/settings/settings.component.spec.ts} (54%) create mode 100644 src/app/shared/components/settings/settings.component.ts diff --git a/angular.json b/angular.json index 3440256d..8864f04b 100644 --- a/angular.json +++ b/angular.json @@ -28,6 +28,7 @@ "node_modules/primeicons/primeicons.css", "node_modules/primeng/resources/themes/nova-light/theme.css", "node_modules/primeng/resources/primeng.min.css", + "node_modules/primeflex/primeflex.css", "src/styles.scss" ], "scripts": [ diff --git a/package.json b/package.json index eea091af..3bcda40e 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "ngx-clipboard": "^13.0.0", "ngx-markdown": "^9.0.0", "ngx-webstorage": "^5.0.0", + "primeflex": "^1.0.0", "primeicons": "^2.0.0", "primeng": "^9.0.6", "quill": "^1.3.7", @@ -67,12 +68,12 @@ "@types/uuid": "^7.0.2", "@typescript-eslint/eslint-plugin": "^2.27.0", "@typescript-eslint/parser": "^2.27.0", - "babel-jest": "^25.4.0", + "babel-jest": "^26.0.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-prettier": "^3.1.3", "husky": "^4.2.5", - "jest": "^25.5.1", + "jest": "^26.0.0", "jest-environment-jsdom-sixteen": "^1.0.3", "jest-preset-angular": "^8.1.3", "lint-staged": "^10.1.7", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 93f2c91c..ca478a7f 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -2,12 +2,10 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { HomeComponent } from './core/components/home/home.component'; -import { LoginComponent } from './core/components/login/login.component'; import { PageNotFoundComponent } from './shared/components/page-not-found/page-not-found.component'; const routes: Routes = [ { path: '', component: HomeComponent }, - { path: 'login', component: LoginComponent }, { path: 'administration', loadChildren: () => diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 8cd65e6f..0059d36d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -5,6 +5,8 @@ import { Subscription } from 'rxjs'; import { environment } from '../environments/environment'; import { Theme } from './core/enums/theme.enum'; import { UserRole } from './core/enums/user-role.enum'; +import { User } from './core/models/user.model'; +import { LanguageService } from './core/services/language.service'; import { MockingService } from './core/services/mocking.service'; import { ThemeService } from './core/services/theme.service'; @@ -22,15 +24,18 @@ export class AppComponent implements OnInit, OnDestroy { constructor( private titleService: Title, private themeService: ThemeService, + private languageService: LanguageService, private mockingService: MockingService ) {} ngOnInit(): void { if (!environment.production) { this.appTitle += ' [DEV]'; - this.mockingService.loadUser(UserRole.REGISTERED); + // TODO: to be removed + this.mockingService.loadUser(new User('TOTO', 'toto@gafam.com', UserRole.REGISTERED, false)); } this.titleService.setTitle(this.appTitle); + this.languageService.configureAndInitTranslations(); this.themeSubscription = this.themeService.theme.subscribe((theme: Theme) => { switch (theme) { case Theme.DARK: diff --git a/src/app/core/components/header/header.component.html b/src/app/core/components/header/header.component.html index c5a76c78..ffc65486 100644 --- a/src/app/core/components/header/header.component.html +++ b/src/app/core/components/header/header.component.html @@ -40,8 +40,12 @@ Administration - - Participation + + Participation à citron_ou_orange Old stuff @@ -50,22 +54,14 @@ - - - diff --git a/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.html b/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.html index 3c7d44a7..e7458fe0 100644 --- a/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.html +++ b/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.html @@ -47,7 +47,7 @@

diff --git a/src/app/features/old-stuff/pages/home/home.component.html b/src/app/features/old-stuff/pages/home/home.component.html index 1eec32ce..fa5b21ce 100644 --- a/src/app/features/old-stuff/pages/home/home.component.html +++ b/src/app/features/old-stuff/pages/home/home.component.html @@ -79,11 +79,11 @@