diff --git a/mocks/db.json b/mocks/db.json index a9756ba2..258abf4f 100644 --- a/mocks/db.json +++ b/mocks/db.json @@ -17,7 +17,7 @@ "isMaybeAnswerAvailable": true, "areResultsPublic": true, "dateCreated": "2020-05-17", - "expires": "2020-06-17" + "expires": "2020-12-31" }, "ownerId": 1, "question": "Quelle date pour le picnic ?", @@ -35,7 +35,7 @@ "isMaybeAnswerAvailable": true, "areResultsPublic": true, "dateCreated": "2020-05-17", - "expires": "2020-06-17" + "expires": "2020-11-30" }, "ownerId": 2, "question": "On fait quoi pendant les vacances ?", diff --git a/package.json b/package.json index 65cbb1d9..ef9d01a0 100644 --- a/package.json +++ b/package.json @@ -1,116 +1,116 @@ { - "name": "framadate-funky-frontend", - "version": "1.0.0", - "license": "AGPL-3.0-or-later", - "scripts": { - "ng": "ng", - "start": "ng serve", - "build:prod": "ng build --prod", - "build:prod:stats": "ng build --prod --stats-json", - "build:prod:gitlabpage": "ng build --prod --baseHref=/framadate/funky-framadate-front/", - "build:prod:demobliss": "ng build --prod --baseHref=https://framadate-api.cipherbliss.com", - "test": "jest", - "test:watch": "jest --watch", - "test:ci": "jest --ci", - "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", - "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": { - "@angular/animations": "^9.1.1", - "@angular/cdk": "^9.2.2", - "@angular/common": "^9.0.7", - "@angular/compiler": "^9.0.7", - "@angular/core": "^9.0.7", - "@angular/forms": "^9.0.7", - "@angular/localize": "^9.1.1", - "@angular/platform-browser": "^9.0.7", - "@angular/platform-browser-dynamic": "^9.0.7", - "@angular/router": "^9.0.7", - "@fullcalendar/core": "^4.4.0", - "@ngx-translate/core": "^12.1.2", - "@ngx-translate/http-loader": "^4.0.0", - "angular-date-value-accessor": "^1.0.2", - "axios": "^0.19.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", - "primeng": "^9.0.6", - "quill": "^1.3.7", - "rxjs": "^6.5.5", - "rxjs-compat": "^6.5.5", - "tslib": "<2.0.0", - "uuid": "^8.0.0", - "zone.js": "^0.10.3" - }, - "devDependencies": { - "@angular-builders/jest": "^9.0.1", - "@angular-devkit/build-angular": "^0.901.2", - "@angular/cli": "^9.1.2", - "@angular/compiler-cli": "^9.1.1", - "@angular/language-service": "^9.0.7", - "@babel/core": "^7.9.0", - "@babel/preset-env": "^7.9.5", - "@babel/preset-typescript": "^7.9.0", - "@compodoc/compodoc": "^1.1.11", - "@types/jest": "^26.0.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": "^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": "~7.0.0", - "ts-jest": "^26.0.0", - "ts-mockito": "^2.5.0", - "ts-node": "^8.10.1", - "typescript": "<3.9.0" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "src/**/*.{js,jsx,ts,tsx,md,html,css,scss}": [ - "prettier --write", - "git add" - ], - "*.js": [ - "prettier --write" - ] - }, - "jest": { - "preset": "jest-preset-angular", - "setupFilesAfterEnv": [ - "/src/jest.setup.ts" - ], - "testEnvironment": "jest-environment-jsdom-sixteen", - "transform": { - "^.+\\.(ts|html)$": "ts-jest", - "^.+\\.jsx?$": "babel-jest" - } - } + "name": "framadate-funky-frontend", + "version": "1.0.0", + "license": "AGPL-3.0-or-later", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build:prod": "ng build --prod", + "build:prod:stats": "ng build --prod --stats-json", + "build:prod:gitlabpage": "ng build --prod --baseHref=/framadate/funky-framadate-front/", + "build:prod:demobliss": "ng build --prod --baseHref=https://framadate-api.cipherbliss.com", + "test": "jest", + "test:watch": "jest --watch", + "test:ci": "jest --ci", + "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", + "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": { + "@angular/animations": "^9.1.1", + "@angular/cdk": "^9.2.2", + "@angular/common": "^9.0.7", + "@angular/compiler": "^9.0.7", + "@angular/core": "^9.0.7", + "@angular/forms": "^9.0.7", + "@angular/localize": "^9.1.1", + "@angular/material": "^9.2.4", + "@angular/platform-browser": "^9.0.7", + "@angular/platform-browser-dynamic": "^9.0.7", + "@angular/router": "^9.0.7", + "@fullcalendar/core": "^4.4.0", + "@ngx-translate/core": "^12.1.2", + "@ngx-translate/http-loader": "^5.0.0", + "angular-date-value-accessor": "^1.0.2", + "axios": "^0.19.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", + "primeng": "^9.0.6", + "quill": "^1.3.7", + "rxjs": "^6.5.5", + "rxjs-compat": "^6.5.5", + "short-unique-id": "^3.0.3", + "tslib": "<2.0.0", + "zone.js": "^0.10.3" + }, + "devDependencies": { + "@angular-builders/jest": "^9.0.1", + "@angular-devkit/build-angular": "^0.901.2", + "@angular/cli": "^9.1.2", + "@angular/compiler-cli": "^9.1.1", + "@angular/language-service": "^9.0.7", + "@babel/core": "^7.9.0", + "@babel/preset-env": "^7.9.5", + "@babel/preset-typescript": "^7.9.0", + "@compodoc/compodoc": "^1.1.11", + "@types/jest": "^26.0.0", + "@types/node": "^14.0.1", + "@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": "^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": "~7.0.0", + "ts-jest": "^26.0.0", + "ts-mockito": "^2.5.0", + "ts-node": "^8.10.1", + "typescript": "<3.9.0" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "src/**/*.{js,jsx,ts,tsx,md,html,css,scss}": [ + "prettier --write", + "git add" + ], + "*.js": [ + "prettier --write" + ] + }, + "jest": { + "preset": "jest-preset-angular", + "setupFilesAfterEnv": [ + "/src/jest.setup.ts" + ], + "testEnvironment": "jest-environment-jsdom-sixteen", + "transform": { + "^.+\\.(ts|html)$": "ts-jest", + "^.+\\.jsx?$": "babel-jest" + } + } } diff --git a/src/app/app.component.html b/src/app/app.component.html index acb5e667..1f3736f5 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,15 +1,19 @@ -
-
- -
- -
- - -
-
+ + + + - - - - + +
+
+ Dev Menu + +
+ +
+ + +
+
+
+
diff --git a/src/app/core/components/dev-navbar/dev-navbar.component.html b/src/app/core/components/dev-navbar/dev-navbar.component.html new file mode 100644 index 00000000..12403cf0 --- /dev/null +++ b/src/app/core/components/dev-navbar/dev-navbar.component.html @@ -0,0 +1,52 @@ + diff --git a/src/app/features/administration/edit-configuration/edit-configuration.component.scss b/src/app/core/components/dev-navbar/dev-navbar.component.scss similarity index 100% rename from src/app/features/administration/edit-configuration/edit-configuration.component.scss rename to src/app/core/components/dev-navbar/dev-navbar.component.scss diff --git a/src/app/features/administration/poll-edit/poll-edit.component.spec.ts b/src/app/core/components/dev-navbar/dev-navbar.component.spec.ts similarity index 54% rename from src/app/features/administration/poll-edit/poll-edit.component.spec.ts rename to src/app/core/components/dev-navbar/dev-navbar.component.spec.ts index a3e3e6f8..50b465b6 100644 --- a/src/app/features/administration/poll-edit/poll-edit.component.spec.ts +++ b/src/app/core/components/dev-navbar/dev-navbar.component.spec.ts @@ -1,19 +1,19 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { PollEditComponent } from './poll-edit.component'; +import { DevNavbarComponent } from './dev-navbar.component'; -describe('PollEditComponent', () => { - let component: PollEditComponent; - let fixture: ComponentFixture; +describe('DevNavbarComponent', () => { + let component: DevNavbarComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [PollEditComponent], + declarations: [DevNavbarComponent], }).compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(PollEditComponent); + fixture = TestBed.createComponent(DevNavbarComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/core/components/dev-navbar/dev-navbar.component.ts b/src/app/core/components/dev-navbar/dev-navbar.component.ts new file mode 100644 index 00000000..93e3e1f5 --- /dev/null +++ b/src/app/core/components/dev-navbar/dev-navbar.component.ts @@ -0,0 +1,35 @@ +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 { UserService } from '../../services/user.service'; + +@Component({ + selector: 'app-dev-navbar', + templateUrl: './dev-navbar.component.html', + styleUrls: ['./dev-navbar.component.scss'], +}) +export class DevNavbarComponent implements OnInit { + @Input() isSidebarOpened: boolean; + @Output() toggleSidebarEE = new EventEmitter(); + + public _user: Observable = this.userService.user; + + public slugsAvailables: string[] = []; + + constructor(private apiService: ApiService, private userService: UserService) {} + + public ngOnInit(): void { + this.getSlugs(); + } + + public async getSlugs(): Promise { + this.slugsAvailables = await this.apiService.getAllPollsSlugs(); + } + + public toggleSidebarOpening(): void { + this.isSidebarOpened = !this.isSidebarOpened; + this.toggleSidebarEE.emit(this.isSidebarOpened); + } +} diff --git a/src/app/core/components/header/header.component.html b/src/app/core/components/header/header.component.html index 432ec7e3..85520b37 100644 --- a/src/app/core/components/header/header.component.html +++ b/src/app/core/components/header/header.component.html @@ -1,9 +1,7 @@