fix search mobile, add PWA version

This commit is contained in:
_Bastler 2022-12-07 20:56:34 +01:00
parent 94b8792de8
commit 01d705f5fb
6 changed files with 651 additions and 1041 deletions

View File

@ -1,24 +1,13 @@
{ {
"$schema": "./node_modules/@angular/service-worker/config/schema.json", "$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html", "index": "/index.html",
"dataGroups": [ "appData": {
{ "version": "1.5.1"
"name": "api", },
"urls": [
"/api"
],
"cacheConfig": {
"maxSize": 0,
"maxAge": "0u",
"strategy": "freshness"
}
}
],
"assetGroups": [ "assetGroups": [
{ {
"name": "app", "name": "app",
"installMode": "prefetch", "installMode": "prefetch",
"updateMode": "lazy",
"resources": { "resources": {
"files": [ "files": [
"/favicon.ico", "/favicon.ico",
@ -32,7 +21,6 @@
{ {
"name": "assets", "name": "assets",
"installMode": "prefetch", "installMode": "prefetch",
"updateMode": "lazy",
"resources": { "resources": {
"files": [ "files": [
"/assets/**", "/assets/**",
@ -40,5 +28,18 @@
] ]
} }
} }
],
"dataGroups": [
{
"name": "api",
"urls": [
"/api"
],
"cacheConfig": {
"maxSize": 0,
"maxAge": "0u",
"strategy": "freshness"
}
}
] ]
} }

1615
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
{ {
"name": "bstlboard", "name": "bstlboard",
"version": "1.5.0", "version": "1.5.1",
"license": "AGPL3",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
@ -35,19 +36,12 @@
"@angular/compiler-cli": "^15.0.2", "@angular/compiler-cli": "^15.0.2",
"@angular/localize": "^15.0.2", "@angular/localize": "^15.0.2",
"@types/jasmine": "^4.3.1", "@types/jasmine": "^4.3.1",
"@types/jasminewd2": "^2.0.10",
"@types/node": "^18.11.11",
"codelyzer": "^6.0.2",
"jasmine-core": "~4.5.0", "jasmine-core": "~4.5.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "^6.4.1", "karma": "^6.4.1",
"karma-chrome-launcher": "~3.1.1", "karma-chrome-launcher": "~3.1.1",
"karma-coverage-istanbul-reporter": "~3.0.3", "karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0", "karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.0.0", "karma-jasmine-html-reporter": "^2.0.0",
"protractor": "~7.0.0",
"ts-node": "~10.9.1",
"tslint": "~6.1.0",
"typescript": "~4.8.4" "typescript": "~4.8.4"
} }
} }

View File

@ -46,7 +46,7 @@
<mat-sidenav-container> <mat-sidenav-container>
<mat-sidenav #sidenav [mode]="isBiggerScreen() ? 'side' : 'over'" [(opened)]="opened" <mat-sidenav #sidenav [mode]="isBiggerScreen() ? 'side' : 'over'" [(opened)]="opened"
(click)="!isBiggerScreen() && opened=false"> (click)="!isBiggerScreen() && this.close()">
<mat-nav-list> <mat-nav-list>
<ui-viewmenu *ngIf="authenticated"></ui-viewmenu> <ui-viewmenu *ngIf="authenticated"></ui-viewmenu>
<mat-divider *ngIf="moderator"></mat-divider> <mat-divider *ngIf="moderator"></mat-divider>
@ -64,14 +64,14 @@
<span>{{'bookmarks' | i18n}}</span> <span>{{'bookmarks' | i18n}}</span>
</a> </a>
<mat-divider *ngIf="authenticated"></mat-divider> <mat-divider *ngIf="authenticated"></mat-divider>
<a (click)="openExternal('https://wiki.bstly.de/services/bstlboard#faq','_blank')" routerLinkActive="active" <a (click)="openExternal($event,'https://wiki.bstly.de/services/bstlboard#faq','_blank')"
mat-list-item> routerLinkActive="active" mat-list-item>
<mat-icon matListItemIcon>help</mat-icon> <mat-icon matListItemIcon>help</mat-icon>
<span>{{'page.faq' | i18n}}</span> <span>{{'page.faq' | i18n}}</span>
</a> </a>
</mat-nav-list> </mat-nav-list>
<mat-form-field *ngIf="authenticated"> <mat-form-field *ngIf="authenticated" (click)="preventClose($event)">
<input matInput type="text" (change)="search($event.target && $event.target.value || undefined, $event)" <input matInput type="text" (change)="search($event.target && $event.target.value || undefined, $event)"
placeholder="{{'search' | i18n}}"> placeholder="{{'search' | i18n}}">
</mat-form-field> </mat-form-field>
@ -79,13 +79,14 @@
<span class="spacer"></span> <span class="spacer"></span>
<mat-nav-list> <mat-nav-list>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<a (click)="openExternal('https://www.bstly.de/imprint/')" mat-list-item style="font-size: 0.7em;"> <a (click)="openExternal($event,'https://www.bstly.de/imprint/')" mat-list-item style="font-size: 0.7em;">
{{'page.imprint' | i18n}} {{'page.imprint' | i18n}}
</a> </a>
<a (click)="openExternal('https://www.bstly.de/privacy-policy/#bstlboard')" mat-list-item <a (click)="openExternal($event,'https://www.bstly.de/privacy-policy/#bstlboard')" mat-list-item
style="font-size: 0.7em;"> style="font-size: 0.7em;">
{{'page.privacy-policy' | i18n}} {{'page.privacy-policy' | i18n}}
</a> </a>
<span style="font-size: 0.7em; margin-right: 1em; float: right;">v{{version}}</span>
</mat-nav-list> </mat-nav-list>
</mat-sidenav> </mat-sidenav>

View File

@ -10,6 +10,8 @@ import { UserService } from '../../services/user.service';
import { I18nService } from '../../services/i18n.service'; import { I18nService } from '../../services/i18n.service';
import { SettingsService } from '../../services/settings.service'; import { SettingsService } from '../../services/settings.service';
import packageJson from '../../../../package.json';
@Component({ @Component({
selector: 'ui-main', selector: 'ui-main',
templateUrl: './main.ui.html', templateUrl: './main.ui.html',
@ -30,6 +32,8 @@ export class UiMain {
touchStartX: number; touchStartX: number;
touchX: number; touchX: number;
version = packageJson.version;
constructor( constructor(
private i18n: I18nService, private i18n: I18nService,
private authService: AuthService, private authService: AuthService,
@ -91,11 +95,23 @@ export class UiMain {
} }
} }
close() {
this.opened = false;
}
preventClose(event) {
event.preventDefault();
event.stopPropagation();
}
search(text, event) { search(text, event) {
if (text) { if (text) {
this.router.navigate(["search"], { queryParams: { q: text } }); this.router.navigate(["search"], { queryParams: { q: text } });
} }
event.target.value = ''; event.target.value = '';
if (!this.isBiggerScreen()) {
this.close();
}
} }
toggleDarkTheme() { toggleDarkTheme() {
@ -134,8 +150,9 @@ export class UiMain {
} }
} }
openExternal(url, target = '_self') { openExternal(event, url, target = '_self') {
window.open(url, target); window.open(url, target);
this.preventClose(event);
} }
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])

View File

@ -5,6 +5,8 @@
"baseUrl": "./", "baseUrl": "./",
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"sourceMap": true, "sourceMap": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"declaration": false, "declaration": false,
"downlevelIteration": true, "downlevelIteration": true,
"experimentalDecorators": true, "experimentalDecorators": true,