diff --git a/package-lock.json b/package-lock.json index a42e9fc4..b10ec721 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2127,6 +2127,11 @@ "schema-utils": "^2.7.0" } }, + "@juggle/resize-observer": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.2.0.tgz", + "integrity": "sha512-fsLxt0CHx2HCV9EL8lDoVkwHffsA0snUpddYjdLyXcG5E41xaamn9ZyQqOE9TUJdrRlH8/hjIf+UdOdDeKCUgg==" + }, "@ngtools/webpack": { "version": "11.0.3", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-11.0.3.tgz", @@ -3245,6 +3250,11 @@ "callsite": "1.0.0" } }, + "bezier-easing": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/bezier-easing/-/bezier-easing-2.1.0.tgz", + "integrity": "sha1-wE3+i5JtbsrKGBPWn/F5t8ICXYY=" + }, "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -10379,6 +10389,16 @@ "resolved": "https://registry.npmjs.org/ngx-cookieconsent/-/ngx-cookieconsent-2.2.3.tgz", "integrity": "sha512-vg7M4XZSTFRAQq20M0YVJdz5OkXIu0t0MSYos0vvu7oblaEivQstA1Mg5bO7OJYp+oFoTEefWhvO2nCiyHn9SQ==" }, + "ngx-scrollbar": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/ngx-scrollbar/-/ngx-scrollbar-7.4.1.tgz", + "integrity": "sha512-yuM2oLOJTr6cc6I9pN0Wtq33jK3Thi2ArKObQOwjWpiMBf5ezvXnKYdNHu39rUkkXcITUV5o/tS3eGIW7xWVxw==", + "requires": { + "@juggle/resize-observer": "*", + "bezier-easing": "*", + "tslib": "^2.0.0" + } + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", diff --git a/package.json b/package.json index 0f29401e..9e679161 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "ng-zorro-antd": "^10.2.0", "ngx-cookie-service": "^11.0.2", "ngx-cookieconsent": "^2.2.3", + "ngx-scrollbar": "^7.4.1", "rxjs": "~6.6.0", "tslib": "^2.0.3", "zone.js": "~0.10.2" diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index defd8fb2..19e99e71 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -19,7 +19,8 @@ const routes: Routes = [ { path: 'analytics', loadChildren: () => import('./pages/analytics/analytics.module').then(m => m.AnalyticsModule) } ] }, - { path: 'p/:snippet', redirectTo: '/error' }, + { path: 'p/:snippet', loadChildren: () => import('./pages/poll-participants/poll-participants.module') + .then(m => m.PollParticipantsModule) }, { path: '**', pathMatch: 'full', redirectTo: '/error' }, { path: 'error', loadChildren: () => import('./pages/error/error.module').then(m => m.ErrorModule) }, ]; diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 27970dff..efe975c8 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -23,6 +23,7 @@ export class AppComponent implements OnInit { // Event Emitters onUserDataChanged: EventEmitter; + onLoginResultChanged: EventEmitter; // Variables currentPage: any; @@ -70,6 +71,9 @@ export class AppComponent implements OnInit { this.onUserDataChanged = child.onUserDataChanged; if (this.userData) this.onUserDataChanged.emit(this.userData); } + if (child.onLoginResultChanged) { + this.onLoginResultChanged = child.onLoginResultChanged; + } if (child.onLogout) { child.onLogout.subscribe(_ => this.logout()); } @@ -136,8 +140,10 @@ export class AppComponent implements OnInit { this.http.post(env.apiBaseUrl + '/authenticate/login', body, options).subscribe((_: HttpResponse) => { // Load user data this.loadUserData(true); - }, (_) => { + }, (error) => { this.showErrorMessage('Login failed.'); + console.log(error); + this.onLoginResultChanged.emit(error); }); } @@ -180,7 +186,7 @@ export class AppComponent implements OnInit { this.darkTheme = darkTheme; if (darkTheme) { // Remove light theme - const dom = document.getElementById('light-theme'); + const dom = document.getElementById('dark-theme'); if (dom) dom.remove(); // Apply dark theme const style = document.createElement('link'); @@ -191,13 +197,13 @@ export class AppComponent implements OnInit { document.body.appendChild(style); } else { // Remove dark theme - const dom = document.getElementById('dark-theme'); + const dom = document.getElementById('light-theme'); if (dom) dom.remove(); // Apply light theme const style = document.createElement('link'); style.type = 'text/css'; style.rel = 'stylesheet'; - style.id = 'dark-theme'; + style.id = 'light-theme'; style.href = 'assets/themes/light.css'; document.body.appendChild(style); } diff --git a/src/app/components/main-options-menu/main-options-menu.component.html b/src/app/components/main-options-menu/main-options-menu.component.html index 4c474f17..d2c97b89 100644 --- a/src/app/components/main-options-menu/main-options-menu.component.html +++ b/src/app/components/main-options-menu/main-options-menu.component.html @@ -1,13 +1,17 @@ - + + + -
+
- @@ -21,25 +25,23 @@ - -
- Account + Account - + @@ -57,16 +59,15 @@ - + - + - Notifications + Notifications diff --git a/src/app/components/main-options-menu/main-options-menu.component.sass b/src/app/components/main-options-menu/main-options-menu.component.sass index e69de29b..ae39cd77 100644 --- a/src/app/components/main-options-menu/main-options-menu.component.sass +++ b/src/app/components/main-options-menu/main-options-menu.component.sass @@ -0,0 +1,31 @@ +/*! + / Copyright © Live-Poll 2020. All rights reserved + / + +nz-tabset + margin: -12px -16px + +.tab-1 + width: 410px + margin-top: -16px + padding: 10px + +.upload-image-button + margin-top: 10px + +.edit-button + position: absolute + bottom: 0 + left: 0 + +.logout-button + position: absolute + bottom: 0 + right: 0 + +.tab-title + margin: 0 15px + +.notification-list + width: 410px + margin-top: -16px diff --git a/src/app/components/main-options-menu/main-options-menu.component.spec.ts b/src/app/components/main-options-menu/main-options-menu.component.spec.ts index 6e666593..2d784d6b 100644 --- a/src/app/components/main-options-menu/main-options-menu.component.spec.ts +++ b/src/app/components/main-options-menu/main-options-menu.component.spec.ts @@ -1,6 +1,10 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +/* + * Copyright © Live-Poll 2020. All rights reserved + */ -import { MainOptionsMenuComponent } from './main-options-menu.component'; +import {ComponentFixture, TestBed} from '@angular/core/testing'; + +import {MainOptionsMenuComponent} from './main-options-menu.component'; describe('MainOptionsMenuComponent', () => { let component: MainOptionsMenuComponent; diff --git a/src/app/components/main-options-menu/main-options-menu.component.ts b/src/app/components/main-options-menu/main-options-menu.component.ts index 9905dff0..af5df912 100644 --- a/src/app/components/main-options-menu/main-options-menu.component.ts +++ b/src/app/components/main-options-menu/main-options-menu.component.ts @@ -1,3 +1,7 @@ +/* + * Copyright © Live-Poll 2020. All rights reserved + */ + import {Component, EventEmitter, Input, Output} from '@angular/core'; import {User} from '../../model/user'; diff --git a/src/app/components/main-options-menu/main-options-menu.module.ts b/src/app/components/main-options-menu/main-options-menu.module.ts index f2e9b65d..580d4368 100644 --- a/src/app/components/main-options-menu/main-options-menu.module.ts +++ b/src/app/components/main-options-menu/main-options-menu.module.ts @@ -1,6 +1,10 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MainOptionsMenuComponent } from './main-options-menu.component'; +/* + * Copyright © Live-Poll 2020. All rights reserved + */ + +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {MainOptionsMenuComponent} from './main-options-menu.component'; import {NzTabsModule} from 'ng-zorro-antd/tabs'; import {NzUploadModule} from 'ng-zorro-antd/upload'; import {NzAvatarModule} from 'ng-zorro-antd/avatar'; diff --git a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.html b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.html index d704898f..160e676c 100644 --- a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.html +++ b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.html @@ -2,8 +2,8 @@ ~ Copyright © Live-Poll 2020. All rights reserved --> - + New Poll Item - {{step > stepLabels.length ? 'Creating ...' : stepLabels[step -1]}} @@ -11,7 +11,7 @@ - + @@ -54,11 +54,11 @@ - + -
+
@@ -70,19 +70,19 @@
-
- The answers are going to be randomized for each user. +
+ The answers are going to be randomized for each user. @@ -103,12 +103,12 @@
diff --git a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.sass b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.sass index b796977e..98cb12bf 100644 --- a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.sass +++ b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.sass @@ -14,3 +14,19 @@ nz-content .radio-description margin-left: 25px + +.dialog-content + margin: -24px + +.add-answer-button-container + padding-top: 10px + float: right + +.add-answer-button-label + margin-inline-end: 20px + +.right-answer + color: #4ca857 + +.wrong-answer + color: #ff194f diff --git a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.ts b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.ts index 099f9055..07143cae 100644 --- a/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.ts +++ b/src/app/dialogs/new-poll-item-dialog/new-poll-item-dialog.component.ts @@ -178,7 +178,7 @@ export class NewPollItemDialogComponent { .subscribe((response: HttpResponse) => { if (response.ok) { // Request was successful, continue - this.onClose.emit(false); + this.onClose.emit(true); // Reset dialog this.step = 1; this.itemType = 0; diff --git a/src/app/model/poll.ts b/src/app/model/poll.ts index 6750c34a..0754d155 100644 --- a/src/app/model/poll.ts +++ b/src/app/model/poll.ts @@ -13,7 +13,6 @@ export class Poll { name: string; startDate: Date; endDate: Date; - open: boolean; snippet: string; pollItems: PollItem[]; } diff --git a/src/app/pages/analytics/analytics.component.html b/src/app/pages/analytics/analytics.component.html index c47f03b2..79d35948 100644 --- a/src/app/pages/analytics/analytics.component.html +++ b/src/app/pages/analytics/analytics.component.html @@ -13,7 +13,7 @@ - +

Polls found. This component does render them in the future!

diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 8da80301..28f78690 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -35,13 +35,13 @@

Live-Poll

- - - + +