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",
"index": "/index.html",
"dataGroups": [
{
"name": "api",
"urls": [
"/api"
],
"cacheConfig": {
"maxSize": 0,
"maxAge": "0u",
"strategy": "freshness"
}
}
],
"appData": {
"version": "1.5.1"
},
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"updateMode": "lazy",
"resources": {
"files": [
"/favicon.ico",
@ -32,7 +21,6 @@
{
"name": "assets",
"installMode": "prefetch",
"updateMode": "lazy",
"resources": {
"files": [
"/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",
"version": "1.5.0",
"version": "1.5.1",
"license": "AGPL3",
"scripts": {
"ng": "ng",
"start": "ng serve",
@ -35,19 +36,12 @@
"@angular/compiler-cli": "^15.0.2",
"@angular/localize": "^15.0.2",
"@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-spec-reporter": "~7.0.0",
"karma": "^6.4.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-html-reporter": "^2.0.0",
"protractor": "~7.0.0",
"ts-node": "~10.9.1",
"tslint": "~6.1.0",
"typescript": "~4.8.4"
}
}

View File

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

View File

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

View File

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