diff --git a/.eslintrc.js b/.eslintrc.js
index 5e525719..904bcc17 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,19 +1,20 @@
module.exports = {
- parser: '@typescript-eslint/parser',
- parserOptions: {
- ecmaVersion: 2018,
- sourceType: 'module',
- project: './tsconfig.json',
- tsconfigRootDir: __dirname,
- },
- plugins: ['@typescript-eslint'],
- extends: [
- 'eslint:recommended',
- 'plugin:@typescript-eslint/eslint-recommended',
- 'plugin:@typescript-eslint/recommended',
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
- 'prettier/@typescript-eslint',
- 'plugin:prettier/recommended',
- ],
- rules: {},
+ parser: '@typescript-eslint/parser',
+ plugins: ['@typescript-eslint'],
+ extends: [
+ 'eslint:recommended',
+ 'plugin:@typescript-eslint/eslint-recommended',
+ 'plugin:@typescript-eslint/recommended',
+ 'plugin:prettier/recommended',
+ 'prettier/@typescript-eslint',
+ ],
+ parserOptions: {
+ ecmaVersion: 2018,
+ sourceType: 'module',
+ project: './tsconfig.json',
+ tsconfigRootDir: __dirname,
+ },
+ rules: {
+ '@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
+ },
};
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 96b90df3..974e9088 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,7 +13,7 @@ pages:
stage: pages
script:
- yarn install --pure-lockfile
- - npx ng build --base-href=/framadate/funky-framadate-front/
+ - yarn build
- mv dist/framadate/ public/
artifacts:
paths:
diff --git a/README.md b/README.md
index b4d32f1a..8430f0b9 100644
--- a/README.md
+++ b/README.md
@@ -1,27 +1,29 @@
## LIBRARIES USED
-| status | lib name | usage |
-| --------------- | -------------------------------------------------------------- | ---------------------------------------- |
-| | [axios](https://github.com/axios/axios) | http client |
-| | [bulma](https://bulma.io/) | CSS framework |
-| | [chart.js](https://www.chartjs.org/) | Display graphs. (Comes with MomentJS) |
-| | [compodoc](https://compodoc.app/) | Generate technic documentation |
-| | ESlint, Prettier, Lint-staged | Format & lint code |
-| | [fork-awesome](https://forkaweso.me) | Icons collection |
-| | [fullcalendar](https://fullcalendar.io/docs/initialize-es6) | Manage & display calendars |
-| | [husky](https://www.npmjs.com/package/husky) | Hook actions on commit |
-| | [jest](https://jestjs.io/) | test engine |
-| removed | [locale-enum](https://www.npmjs.com/package/locale-enum) | enum of all locales |
-| | [momentJS](https://momentjs.com/) | manipulate dates. (chartJS’s dependency) |
-| to be installed | [ng2-charts](https://valor-software.com/ng2-charts/) | Manipulate graphs along with chart.js |
-| | [ngx-clipboard](https://www.npmjs.com/package/ngx-clipboard) | Handle clipboard |
-| | [ngx-markdown](https://www.npmjs.com/package/ngx-markdown) | markdown parser |
-| | [ngx-webstorage](https://www.npmjs.com/package/ngx-webstorage) | handle localStorage & webStorage |
-| | [primeNG](https://www.primefaces.org/primeng/) | UI components collection |
-| | [quill](https://www.npmjs.com/package/quill) | powerful rich text editor. WYSIWYG. |
-| removed | [storybook](https://storybook.js.org/) | StyleGuide UI |
-| | [ts-mockito](https://www.npmjs.com/package/ts-mockito) | Mocks for testing. |
-| | [uuid](https://www.npmjs.com/package/uuid) | handle client-side generation of uuids |
+| status | lib name | usage |
+| :-------------: | -------------------------------------------------------------- | --------------------------------------------------------- |
+| | [axios](https://github.com/axios/axios) | http client |
+| | [bulma](https://bulma.io/) | CSS framework |
+| | [chart.js](https://www.chartjs.org/) | PrimeNG solution for graphs. (Chart.js installs MomentJS) |
+| | [compodoc](https://compodoc.app/) | Generate technic documentation |
+| | ESlint, Prettier, Lint-staged | Format & lint code |
+| | [fork-awesome](https://forkaweso.me) | Icons collection |
+| | [fullcalendar](https://fullcalendar.io/docs/initialize-es6) | PrimeNG solution to manage & display calendars |
+| | [husky](https://www.npmjs.com/package/husky) | Hook actions on commit |
+| | [jest](https://jestjs.io/) | test engine |
+| | [json-server](https://www.npmjs.com/package/json-server) | local server for mocking data backend |
+| removed | [locale-enum](https://www.npmjs.com/package/locale-enum) | enum of all locales |
+| | [momentJS](https://momentjs.com/) | manipulate dates. (chartJS’s dependency) |
+| to be installed | [ng2-charts](https://valor-software.com/ng2-charts/) | Manipulate graphs along with chart.js |
+| | [ngx-clipboard](https://www.npmjs.com/package/ngx-clipboard) | Handle clipboard |
+| | [ngx-markdown](https://www.npmjs.com/package/ngx-markdown) | markdown parser |
+| | [ngx-webstorage](https://www.npmjs.com/package/ngx-webstorage) | handle localStorage & webStorage |
+| | [primeNG](https://www.primefaces.org/primeng/) | UI components collection |
+| | [quill](https://www.npmjs.com/package/quill) | powerful rich text editor. WYSIWYG. |
+| to be installed | [short-uuid](https://www.npmjs.com/package/short-uuid) | generate uuid |
+| removed | [storybook](https://storybook.js.org/) | StyleGuide UI |
+| | [ts-mockito](https://www.npmjs.com/package/ts-mockito) | Mocks for testing. |
+| to be removed | [uuid](https://www.npmjs.com/package/uuid) | generate uuid |
---
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.1.
diff --git a/angular.json b/angular.json
index 3440256d..a9606a6f 100644
--- a/angular.json
+++ b/angular.json
@@ -25,9 +25,9 @@
"assets": ["src/favicon.ico", "src/assets"],
"styles": [
"node_modules/fork-awesome/css/fork-awesome.min.css",
- "node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/themes/nova-light/theme.css",
"node_modules/primeng/resources/primeng.min.css",
+ "node_modules/bulma-switch/dist/css/bulma-switch.min.css",
"src/styles.scss"
],
"scripts": [
diff --git a/mocks/db.json b/mocks/db.json
new file mode 100644
index 00000000..eef2dd98
--- /dev/null
+++ b/mocks/db.json
@@ -0,0 +1,234 @@
+{
+ "owners": [
+ { "id": 1, "email": "toto@gafam.com", "pseudo": "TOTO" },
+ { "id": 2, "email": "titi@gafam.com", "pseudo": "TITI" }
+ ],
+ "voters": [{ "pseudo": "TOTO", "polls": [] }],
+ "polls": [
+ {
+ "id": 1,
+ "slug": "picnic",
+ "configuration": {
+ "isAboutDate": true,
+ "isProtectedByPassword": false,
+ "isOwnerNotifiedByEmailOnNewVote": false,
+ "isOwnerNotifiedByEmailOnNewComment": false,
+ "isMaybeAnswerAvailable": true,
+ "areResultsPublic": true,
+ "dateCreated": "2020-05-17",
+ "expires": "2020-06-17"
+ },
+ "ownerId": 1,
+ "question": "Quelle date pour le picnic ?",
+ "description": "Gros badass picnic en plein air ! Come on !",
+ "answersByChoiceByParticipant": {
+ "TOTO": { "samedi": "YES", "dimanche": "NO" },
+ "TATA": { "samedi": "NO", "dimanche": null },
+ "TITI": { "samedi": "MAYBE", "dimanche": "NO" }
+ },
+ "answers": [
+ {
+ "pseudo": "TOTO",
+ "token": "TOTO-TOKEN",
+ "responsesByChoices": [
+ { "choice": { "label": "samedi", "imagePath": null }, "responseType": "YES" },
+ { "choice": { "label": "dimanche", "imagePath": null }, "responseType": "NO" }
+ ]
+ },
+ {
+ "pseudo": "TATA",
+ "token": "TATA-TOKEN",
+ "responsesByChoices": [
+ { "choice": { "label": "samedi", "imagePath": null }, "responseType": "NO" },
+ { "choice": { "label": "dimanche", "imagePath": null }, "responseType": "NO" }
+ ]
+ },
+ {
+ "pseudo": "TITI",
+ "token": "TITI-TOKEN",
+ "responsesByChoices": [
+ { "choice": { "label": "samedi", "imagePath": null }, "responseType": "NO" },
+ { "choice": { "label": "dimanche", "imagePath": null }, "responseType": "YES" }
+ ]
+ },
+ {
+ "pseudo": "TETE",
+ "token": "TETE-TOKEN",
+ "responsesByChoices": [
+ { "choice": { "label": "samedi", "imagePath": null }, "responseType": "YES" },
+ { "choice": { "label": "dimanche", "imagePath": null }, "responseType": "NO" }
+ ]
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "slug": "vacances",
+ "configuration": {
+ "isAboutDate": true,
+ "isProtectedByPassword": false,
+ "isOwnerNotifiedByEmailOnNewVote": false,
+ "isOwnerNotifiedByEmailOnNewComment": false,
+ "isMaybeAnswerAvailable": true,
+ "areResultsPublic": true,
+ "dateCreated": "2020-05-17",
+ "expires": "2020-06-17"
+ },
+ "ownerId": 2,
+ "question": "On fait quoi pendant les vacances ?",
+ "description": "Vacances en famille",
+ "answersByChoiceByParticipant": {
+ "TOTO": { "bateau": "YES", "montagne": "NO", "quad": "MAYBE" },
+ "TATA": { "bateau": "NO", "montagne": null, "quad": "YES" },
+ "TITI": { "bateau": "MAYBE", "montagne": "NO", "quad": null }
+ },
+ "answers": [
+ {
+ "pseudo": "TOTO",
+ "token": "TOTO-TOKEN",
+ "responsesByChoices": [
+ { "choice": { "label": "bateau", "imagePath": null }, "responseType": "YES" },
+ { "choice": { "label": "montagne", "imagePath": null }, "responseType": "NO" },
+ { "choice": { "label": "quad", "imagePath": null }, "responseType": "NO" }
+ ]
+ },
+ {
+ "pseudo": "TATA",
+ "token": "TATA-TOKEN",
+ "responsesByChoices": [
+ { "choice": { "label": "bateau", "imagePath": null }, "responseType": "NO" },
+ { "choice": { "label": "montagne", "imagePath": null }, "responseType": "NO" },
+ { "choice": { "label": "quad", "imagePath": null }, "responseType": "NO" }
+ ]
+ },
+ {
+ "pseudo": "TITI",
+ "token": "TITI-TOKEN",
+ "responsesByChoices": [
+ { "choice": { "label": "bateau", "imagePath": null }, "responseType": "NO" },
+ { "choice": { "label": "montagne", "imagePath": null }, "responseType": "YES" },
+ { "choice": { "label": "quad", "imagePath": null }, "responseType": "NO" }
+ ]
+ },
+ {
+ "pseudo": "TETE",
+ "token": "TETE-TOKEN",
+ "responsesByChoices": [
+ { "choice": { "label": "bateau", "imagePath": null }, "responseType": "YES" },
+ { "choice": { "label": "montagne", "imagePath": null }, "responseType": "NO" },
+ { "choice": { "label": "quad", "imagePath": null }, "responseType": "NO" }
+ ]
+ }
+ ]
+ }
+ ],
+ "choices": [
+ {
+ "id": 1,
+ "pollId": 1,
+ "pollSlug": "picnic",
+ "label": "samedi",
+ "participants": [
+ ["YES", ["TOTO", "TITI"]],
+ ["NO", ["TETE"]],
+ ["MAYBE", ["TATA"]]
+ ]
+ },
+ {
+ "id": 2,
+ "pollId": 1,
+ "pollSlug": "picnic",
+ "label": "dimanche",
+ "participants": [
+ ["YES", ["TOTO", "TITI"]],
+ ["NO", ["TETE"]],
+ ["MAYBE", ["TATA"]]
+ ]
+ },
+ {
+ "id": 3,
+ "pollId": 2,
+ "pollSlug": "vacances",
+ "label": "bateau",
+ "participants": [
+ ["YES", ["TOTO", "TITI"]],
+ ["NO", ["TETE"]],
+ ["MAYBE", ["TATA"]]
+ ]
+ },
+ {
+ "id": 4,
+ "pollId": 2,
+ "pollSlug": "vacances",
+ "label": "montagne",
+ "participants": [
+ ["YES", ["TOTO", "TITI"]],
+ ["NO", ["TETE"]],
+ ["MAYBE", ["TATA"]]
+ ]
+ },
+ {
+ "id": 5,
+ "pollId": 2,
+ "pollSlug": "vacances",
+ "label": "quad",
+ "participants": [
+ ["YES", ["TOTO", "TITI"]],
+ ["NO", ["TETE"]],
+ ["MAYBE", ["TATA"]]
+ ]
+ }
+ ],
+ "answers": [
+ { "choiceId": 1, "pseudo": "TOTO", "response": "YES", "token": "TOTO-TOKEN" },
+ { "choiceId": 1, "pseudo": "TATA", "response": "NO", "token": "TATA-TOKEN" },
+ { "choiceId": 1, "pseudo": "TITI", "response": "MAYBE", "token": "TITI-TOKEN" },
+ { "choiceId": 2, "pseudo": "TOTO", "response": "YES", "token": "TOTO-TOKEN" },
+ { "choiceId": 2, "pseudo": "TATA", "response": "NO", "token": "TATA-TOKEN" },
+ { "choiceId": 2, "pseudo": "TITI", "response": "MAYBE", "token": "TITI-TOKEN" },
+ { "choiceId": 2, "pseudo": "EVA", "response": null, "token": "EVA-TOKEN" },
+ { "choiceId": 3, "pseudo": "TOTO", "response": "YES", "token": "TOTO-TOKEN" },
+ { "choiceId": 3, "pseudo": "TATA", "response": "NO", "token": "TATA-TOKEN" },
+ { "choiceId": 3, "pseudo": "TITI", "response": "MAYBE", "token": "TITI-TOKEN" },
+ { "choiceId": 4, "pseudo": "TOTO", "response": "YES", "token": "TOTO-TOKEN" },
+ { "choiceId": 4, "pseudo": "TATA", "response": "NO", "token": "TATA-TOKEN" },
+ { "choiceId": 4, "pseudo": "TITI", "response": "MAYBE", "token": "TITI-TOKEN" },
+ { "choiceId": 5, "pseudo": "TOTO", "response": "YES", "token": "TOTO-TOKEN" },
+ { "choiceId": 5, "pseudo": "TATA", "response": "NO", "token": "TATA-TOKEN" },
+ { "choiceId": 5, "pseudo": "TITI", "response": "MAYBE", "token": "TITI-TOKEN" }
+ ],
+ "comments": [
+ {
+ "id": 1,
+ "pollId": 1,
+ "pollSlug": "picnic",
+ "content": "Les picnics, c’est trop bien, j’adore!",
+ "author": "TATA",
+ "dateCreated": 1589111111111
+ },
+ {
+ "id": 2,
+ "pollId": 1,
+ "pollSlug": "picnic",
+ "content": "Oué, grave!",
+ "author": "TETE",
+ "dateCreated": 1589222222222
+ },
+ {
+ "id": 3,
+ "pollId": 2,
+ "pollSlug": "vacances",
+ "content": "Désolé je pourrai pas être là, mais je penserai bien à vous. Mamie",
+ "author": "MAMIE",
+ "dateCreated": 1589333333333
+ },
+ {
+ "id": 4,
+ "pollId": 2,
+ "pollSlug": "vacances",
+ "content": "Arf, trop dommage.",
+ "author": "Tom",
+ "dateCreated": 1589444444444
+ }
+ ]
+}
diff --git a/mocks/routes.json b/mocks/routes.json
new file mode 100644
index 00000000..45524edf
--- /dev/null
+++ b/mocks/routes.json
@@ -0,0 +1,8 @@
+{
+ "/api/v1/*": "/$1",
+ "/owners/:email/": "/owners?email=:email",
+ "/choices": "/choices?_embed=answers",
+ "/polls/:slug": "/polls?slug=:slug&_expand=owner&_embed=choices&_embed=comments",
+ "/polls/:slug/choices": "/choices?pollSlug=:slug&_embed=answers",
+ "/polls/:slug/comments": "/comments?pollSlug=:slug"
+}
diff --git a/package.json b/package.json
index eea091af..ec19d7f0 100644
--- a/package.json
+++ b/package.json
@@ -12,12 +12,15 @@
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
- "lint": "ng lint",
+ "lint": "prettier --write \"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}\"",
"e2e": "ng e2e",
"format:check": "prettier --list-different \"src/{app,environments,assets}/**/*{.ts,.js,.json,.css,.scss}\"",
"format:all": "prettier --write \"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}\"",
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr",
- "compodoc": "compodoc -p tsconfig.app.json"
+ "compodoc": "compodoc -p tsconfig.app.json",
+ "mock:server": "json-server --port 8000 --watch ./mocks/db.json --routes ./mocks/routes.json",
+ "start:proxy": "ng serve --proxy-config proxy.conf.json",
+ "start:proxymock": "concurrently --kill-others \"yarn mock:server\" \"yarn start:proxy\""
},
"private": false,
"dependencies": {
@@ -36,19 +39,19 @@
"@ngx-translate/http-loader": "^4.0.0",
"angular-date-value-accessor": "^1.0.2",
"axios": "^0.19.2",
- "bulma": "^0.8.2",
+ "bulma": "^0.9.0",
+ "bulma-switch": "^2.0.0",
"chart.js": "^2.9.3",
"fork-awesome": "^1.1.7",
"ng2-charts": "^2.3.0",
"ngx-clipboard": "^13.0.0",
"ngx-markdown": "^9.0.0",
"ngx-webstorage": "^5.0.0",
- "primeicons": "^2.0.0",
"primeng": "^9.0.6",
"quill": "^1.3.7",
"rxjs": "^6.5.5",
"rxjs-compat": "^6.5.5",
- "tslib": "^1.11.1",
+ "tslib": "<2.0.0",
"uuid": "^8.0.0",
"zone.js": "^0.10.3"
},
@@ -63,22 +66,24 @@
"@babel/preset-typescript": "^7.9.0",
"@compodoc/compodoc": "^1.1.11",
"@types/jest": "^25.2.1",
- "@types/node": "^13.13.2",
- "@types/uuid": "^7.0.2",
- "@typescript-eslint/eslint-plugin": "^2.27.0",
- "@typescript-eslint/parser": "^2.27.0",
- "babel-jest": "^25.4.0",
- "eslint": "^6.8.0",
+ "@types/node": "^14.0.1",
+ "@types/uuid": "^8.0.0",
+ "@typescript-eslint/eslint-plugin": "^3.0.0",
+ "@typescript-eslint/parser": "^3.0.0",
+ "babel-jest": "^26.0.0",
+ "concurrently": "^5.2.0",
+ "eslint": "^7.0.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",
+ "json-server": "^0.16.1",
"lint-staged": "^10.1.7",
"prettier": "^2.0.5",
- "protractor": "~5.4.3",
- "ts-jest": "^25.4.0",
+ "protractor": "~7.0.0",
+ "ts-jest": "^26.0.0",
"ts-mockito": "^2.5.0",
"ts-node": "^8.10.1",
"typescript": "~3.8.3"
@@ -89,11 +94,13 @@
}
},
"lint-staged": {
- "src/{app,environments,assets}/**/*.{js,jsx,ts,tsx,md,html,css,scss}": [
+ "src/**/*.{js,jsx,ts,tsx,md,html,css,scss}": [
"prettier --write",
"git add"
],
- "*.js": "eslint --cache --fix"
+ "*.js": [
+ "prettier --write"
+ ]
},
"jest": {
"preset": "jest-preset-angular",
diff --git a/proxy.conf.json b/proxy.conf.json
new file mode 100644
index 00000000..220da25b
--- /dev/null
+++ b/proxy.conf.json
@@ -0,0 +1,11 @@
+{
+ "/api/v1/*": {
+ "target": "http://localhost:8000",
+ "secure": false,
+ "pathRewrite": {
+ "^/api/v1": ""
+ },
+ "changeOrigin": false,
+ "logLevel": "debug"
+ }
+}
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 93f2c91c..1694a968 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -2,17 +2,19 @@ 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: () =>
import('./features/administration/administration.module').then((m) => m.AdministrationModule),
},
+ {
+ path: 'consultation',
+ loadChildren: () => import('./features/consultation/consultation.module').then((m) => m.ConsultationModule),
+ },
{
path: 'participation',
loadChildren: () => import('./features/participation/participation.module').then((m) => m.ParticipationModule),
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 8cd65e6f..c9586d99 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));
}
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/app.module.ts b/src/app/app.module.ts
index 71defe54..9667d072 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -1,5 +1,7 @@
-import { CommonModule } from '@angular/common';
+import { APP_BASE_HREF, CommonModule, registerLocaleData } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http';
+import localeEn from '@angular/common/locales/en';
+import localeFr from '@angular/common/locales/fr';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule, Title } from '@angular/platform-browser';
@@ -21,8 +23,9 @@ import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { CoreModule } from './core/core.module';
import { SharedModule } from './shared/shared.module';
-import { ParticipationModule } from './features/participation/participation.module';
-import { AdministrationModule } from './features/administration/administration.module';
+
+registerLocaleData(localeEn, 'en-EN');
+registerLocaleData(localeFr, 'fr-FR');
export class MyMissingTranslationHandler implements MissingTranslationHandler {
public handle(params: MissingTranslationHandlerParams): string {
@@ -38,7 +41,6 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
declarations: [AppComponent],
imports: [
AppRoutingModule,
- AdministrationModule,
BrowserAnimationsModule,
BrowserModule,
ClipboardModule,
@@ -61,9 +63,8 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
},
useDefaultLang: false,
}),
- ParticipationModule,
],
- providers: [Title, TranslateService],
+ providers: [{ provide: APP_BASE_HREF, useValue: environment.baseHref }, Title, TranslateService],
bootstrap: [AppComponent],
})
export class AppModule {}
diff --git a/src/app/core/components/header/header.component.html b/src/app/core/components/header/header.component.html
index c5a76c78..432ec7e3 100644
--- a/src/app/core/components/header/header.component.html
+++ b/src/app/core/components/header/header.component.html
@@ -37,35 +37,43 @@
+
-
-
-
-
-
diff --git a/src/app/core/components/header/header.component.ts b/src/app/core/components/header/header.component.ts
index 245b95a0..ad2de52a 100644
--- a/src/app/core/components/header/header.component.ts
+++ b/src/app/core/components/header/header.component.ts
@@ -1,14 +1,38 @@
-import { Component, EventEmitter, Output, Input } from '@angular/core';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { Observable } from 'rxjs';
+
+import { User } from '../../models/user.model';
+import { ApiService } from '../../services/api.service';
+import { ModalService } from '../../services/modal.service';
+import { UserService } from '../../services/user.service';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss'],
})
-export class HeaderComponent {
+export class HeaderComponent implements OnInit {
@Input() isSidebarOpened: boolean;
@Output() toggleSidebarEE = new EventEmitter
();
+ public _user: Observable = this.userService.user;
+
+ public slugsAvailables: string[] = [];
+
+ constructor(private userService: UserService, private modalService: ModalService, private apiService: ApiService) {}
+
+ public ngOnInit(): void {
+ this.getSlugs();
+ }
+
+ public async getSlugs(): Promise {
+ this.slugsAvailables = await this.apiService.getAllPollsSlugs();
+ }
+
+ public openDialog(): void {
+ this.modalService.openSettingsComponent();
+ }
+
public toggleSidebarOpening(): void {
this.isSidebarOpened = !this.isSidebarOpened;
this.toggleSidebarEE.emit(this.isSidebarOpened);
diff --git a/src/app/core/components/login/login.component.html b/src/app/core/components/login/login.component.html
deleted file mode 100644
index 147cfc4f..00000000
--- a/src/app/core/components/login/login.component.html
+++ /dev/null
@@ -1 +0,0 @@
-login works!
diff --git a/src/app/core/components/login/login.component.ts b/src/app/core/components/login/login.component.ts
deleted file mode 100644
index a062274e..00000000
--- a/src/app/core/components/login/login.component.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-
-@Component({
- selector: 'app-login',
- templateUrl: './login.component.html',
- styleUrls: ['./login.component.scss'],
-})
-export class LoginComponent implements OnInit {
- constructor() {}
-
- ngOnInit(): void {}
-}
diff --git a/src/app/core/components/selectors/language-selector/language-selector.component.html b/src/app/core/components/selectors/language-selector/language-selector.component.html
deleted file mode 100644
index 2d865b0a..00000000
--- a/src/app/core/components/selectors/language-selector/language-selector.component.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
diff --git a/src/app/core/components/selectors/language-selector/language-selector.component.ts b/src/app/core/components/selectors/language-selector/language-selector.component.ts
deleted file mode 100644
index 5adfb671..00000000
--- a/src/app/core/components/selectors/language-selector/language-selector.component.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { Component, DoCheck, OnInit } from '@angular/core';
-import { TranslateService } from '@ngx-translate/core';
-
-import { Language } from '../../../enums/language.enum';
-import { StorageService } from '../../../services/storage.service';
-
-@Component({
- selector: 'app-language-selector',
- templateUrl: './language-selector.component.html',
- styleUrls: ['./language-selector.component.scss'],
-})
-export class LanguageSelectorComponent implements OnInit, DoCheck {
- public currentLang: Language;
- public languagesAvailable: string[] = Object.values(Language);
-
- constructor(private translate: TranslateService, private storageService: StorageService) {}
-
- ngOnInit(): void {
- const currentBrowserLanguage: Language = this.translate.getBrowserLang().toUpperCase() as Language;
- if (this.storageService.language && Object.keys(Language).includes(this.storageService.language)) {
- this.currentLang = this.storageService.language;
- } else if (Object.keys(Language).includes(currentBrowserLanguage)) {
- this.currentLang = currentBrowserLanguage;
- } else {
- this.currentLang = Language.EN;
- }
- this.updateLanguage();
- }
-
- ngDoCheck(): void {
- this.updateLanguage();
- }
-
- public updateLanguage(): void {
- this.translate.use(this.currentLang.toString().toUpperCase());
- this.storageService.language = this.currentLang;
- }
-}
diff --git a/src/app/core/components/selectors/theme-selector/theme-selector.component.html b/src/app/core/components/selectors/theme-selector/theme-selector.component.html
deleted file mode 100644
index 9f87a43d..00000000
--- a/src/app/core/components/selectors/theme-selector/theme-selector.component.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
diff --git a/src/app/core/components/sibebar/navigation/navigation.component.html b/src/app/core/components/sibebar/navigation/navigation.component.html
index 54c8767d..ccfc3f6a 100644
--- a/src/app/core/components/sibebar/navigation/navigation.component.html
+++ b/src/app/core/components/sibebar/navigation/navigation.component.html
@@ -1,11 +1,7 @@