From 4127d5f12a19dd27e93ffafe9a6897c6b5b405d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de> Date: Sun, 19 May 2019 20:02:19 +0200 Subject: [PATCH] Several pwa fixes --- ngsw-config.json | 17 ++++++++++++++++- src/app/app-routing.module.ts | 6 ++---- src/app/app.module.ts | 2 +- .../present-comment.component.ts | 2 +- .../shared/comment/comment.component.html | 6 ++++-- src/index.html | 2 +- src/manifest.webmanifest | 4 ++-- 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ngsw-config.json b/ngsw-config.json index fa9410f34..1f2ae3661 100644 --- a/ngsw-config.json +++ b/ngsw-config.json @@ -1,5 +1,17 @@ { "index": "/index.html", + "dataGroups": + [ + { + "name": "api", + "urls": ["/**"], + "cacheConfig": { + "maxSize": 500, + "maxAge": "7d", + "strategy": "performance" + } + } + ], "assetGroups": [ { "name": "app", @@ -7,9 +19,12 @@ "resources": { "files": [ "/favicon.ico", - "/index.html", + "/*.html", "/*.css", "/*.js" + ], + "urls": [ + "https://fonts.googleapis.com/**" ] } }, { diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 839a91057..a599b06ef 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,8 +1,6 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { PageNotFoundComponent } from './components/shared/page-not-found/page-not-found.component'; -import { CreatorModule } from './components/creator/creator.module'; -import { ParticipantModule } from './components/participant/participant.module'; import { HomePageComponent } from './components/home/home-page/home-page.component'; const routes: Routes = [ @@ -17,11 +15,11 @@ const routes: Routes = [ }, { path: 'creator', - loadChildren: () => CreatorModule + loadChildren: './components/creator/creator.module#CreatorModule' }, { path: 'participant', - loadChildren: () => ParticipantModule + loadChildren: './components/participant/participant.module#ParticipantModule' }, { path: '**', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 12073d650..7d2292031 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -58,7 +58,7 @@ export function initializeApp(appConfig: AppConfig) { EssentialsModule, SharedModule, ThemeModule, - ServiceWorkerModule.register('ngsw-worker.js', { enabled: true }) // environment.production + ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }) ], providers: [ AppConfig, diff --git a/src/app/components/shared/_dialogs/present-comment/present-comment.component.ts b/src/app/components/shared/_dialogs/present-comment/present-comment.component.ts index db98ecce3..35bc3e620 100644 --- a/src/app/components/shared/_dialogs/present-comment/present-comment.component.ts +++ b/src/app/components/shared/_dialogs/present-comment/present-comment.component.ts @@ -24,7 +24,7 @@ export class PresentCommentComponent implements OnInit { this.dialogRef.close('close'); } - private updateFontSize(event: any): void { + updateFontSize(event: any): void { document.getElementById('comment').style.fontSize = (event.value * 2.5) + 'em'; } } diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index a6146daea..a36915c6d 100644 --- a/src/app/components/shared/comment/comment.component.html +++ b/src/app/components/shared/comment/comment.component.html @@ -1,4 +1,5 @@ -<mat-card id="comment-card" [ngClass]="{true : 'highlighted', false: ''}[comment.highlighted]" [@slide]> +<mat-card id="comment-card" [ngClass]="{'highlighted': comment.highlighted, + '': !comment.highlighted}" [@slide]> <div fxLayout="column"> <div fxLayout="row"> <span class="fill-remaining-space"></span> @@ -17,7 +18,8 @@ <mat-icon [ngClass]="{true: 'favorite-icon', false: 'not-marked'}[comment.favorite]">favorite_border</mat-icon> </button> <button mat-icon-button [disabled]="isStudent" (click)="setRead(comment)" [matTooltip]="comment.read ? 'Mark as unread' : 'Mark as read'"> - <mat-icon class="icon" [ngClass]="{true: 'read-icon', false: 'not-marked'}[comment.read]">visibility</mat-icon> + <mat-icon class="icon" [ngClass]="{'read-icon': comment.read, + 'not-marked' : !comment.read}">visibility</mat-icon> </button> </div> <div fxLayout="row"> diff --git a/src/index.html b/src/index.html index 2b1a07751..e33f54078 100644 --- a/src/index.html +++ b/src/index.html @@ -28,7 +28,7 @@ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="manifest" href="manifest.webmanifest"> - <meta name="theme-color" content="#4DB6AC"> + <meta name="theme-color" content="#b2dfdb"> </head> <body> <app-root></app-root> diff --git a/src/manifest.webmanifest b/src/manifest.webmanifest index d854eff0e..346ea67f7 100644 --- a/src/manifest.webmanifest +++ b/src/manifest.webmanifest @@ -1,8 +1,8 @@ { "name": "ARSnova Lite", "short_name": "ARSnova", - "theme_color": "#4DB6AC", - "background_color": "#B2DFDB", + "theme_color": "#b2dfdb", + "background_color": "#b2dfdb", "display": "standalone", "scope": "/", "start_url": "/home", -- GitLab