From 4dcc5089da35583906dc3c5a652fbc7e9d3cb2e6 Mon Sep 17 00:00:00 2001 From: Jannik Streek Date: Mon, 22 Jan 2024 09:53:02 +0100 Subject: [PATCH] fix lint --- .../core/services/dialog/dialog.service.ts | 4 +- .../core/services/pictograms/picto-types.ts | 79 +++++-------------- .../services/pictograms/pictogram.service.ts | 38 +++++---- .../app/core/services/utils/utils.service.ts | 2 +- .../modules/application/application.module.ts | 2 +- .../dialog-pictograms.component.html | 2 +- .../dialog-pictograms.component.ts | 48 ++++++----- .../components/toolbar/toolbar.component.html | 16 ++-- .../components/toolbar/toolbar.component.ts | 2 + teammapper-frontend/src/app/root.module.ts | 2 +- .../src/app/shared/shared.module.ts | 6 +- teammapper-frontend/src/assets/i18n/de.json | 2 +- .../src/environments/environment.prod.ts | 3 + .../src/environments/environment.ts | 3 + 14 files changed, 93 insertions(+), 116 deletions(-) diff --git a/teammapper-frontend/src/app/core/services/dialog/dialog.service.ts b/teammapper-frontend/src/app/core/services/dialog/dialog.service.ts index f86544dc..50ba09cb 100644 --- a/teammapper-frontend/src/app/core/services/dialog/dialog.service.ts +++ b/teammapper-frontend/src/app/core/services/dialog/dialog.service.ts @@ -17,7 +17,9 @@ export class DialogService { constructor(private dialog: MatDialog) {} openPictogramDialog() { - this.pictogramsModalRef = this.dialog.open(DialogPictogramsComponent, { width: '100%' }); + this.pictogramsModalRef = this.dialog.open(DialogPictogramsComponent, { + width: '100%', + }); } closePictogramDialog() { diff --git a/teammapper-frontend/src/app/core/services/pictograms/picto-types.ts b/teammapper-frontend/src/app/core/services/pictograms/picto-types.ts index 8287603c..b3abed3a 100644 --- a/teammapper-frontend/src/app/core/services/pictograms/picto-types.ts +++ b/teammapper-frontend/src/app/core/services/pictograms/picto-types.ts @@ -1,61 +1,22 @@ export type IPictogramResponse = { - schematic: boolean, - sex: boolean, - violence: boolean, - aac: boolean, - aacColor: boolean, - skin: boolean, - hair: boolean, - downloads: number, - categories: string[], - synsets: string[], - tags: string[], - _id: number, + schematic: boolean; + sex: boolean; + violence: boolean; + aac: boolean; + aacColor: boolean; + skin: boolean; + hair: boolean; + downloads: number; + categories: string[]; + synsets: string[]; + tags: string[]; + _id: number; keywords: { - keyword: string, - type: number, - plural: string, - hasLocution: boolean - }[], - created: Date, - lastUpdated: Date, -} - -export type ISearchResultResponse = { - _id: number, - tags: string[], - synsets: string[], - sex: boolean, - schematic: boolean, - keywords: { - type: number, - meaning: string, - plural: string, - keyword: string, - hasLocation: boolean, - }[], - desc: string, - categories: string[], - violence: boolean, - hair: false, - skin: false, - aac: false, - aacColor: false, - score: number, -}[] - -export type IPictogramNewResponse = { - aac: boolean, - aacColor: boolean, - categories: string[], - downloads: number, - hair: boolean, - keywords: string[], - schematic: boolean, - sex: boolean, - skin: boolean, - synsets: string[], - tags: string[], - violence: boolean, - _id: number, -}[]; \ No newline at end of file + keyword: string; + type: number; + plural: string; + hasLocution: boolean; + }[]; + created: Date; + lastUpdated: Date; +}; diff --git a/teammapper-frontend/src/app/core/services/pictograms/pictogram.service.ts b/teammapper-frontend/src/app/core/services/pictograms/pictogram.service.ts index 7c0ffd16..79cedce4 100644 --- a/teammapper-frontend/src/app/core/services/pictograms/pictogram.service.ts +++ b/teammapper-frontend/src/app/core/services/pictograms/pictogram.service.ts @@ -1,35 +1,33 @@ -import { Injectable, OnDestroy } from "@angular/core"; +import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { Observable } from "rxjs/internal/Observable"; -import { IPictogramResponse } from "./picto-types"; +import { Observable } from 'rxjs/internal/Observable'; +import { IPictogramResponse } from './picto-types'; +import { environment } from 'src/environments/environment'; @Injectable({ providedIn: 'root', }) -export class PictogramService implements OnDestroy { - private apirUrl = "https://api.arasaac.org/v1/pictograms" - private staticAssetUrl = "https://static.arasaac.org/pictograms" - private apiResource = "bestsearch" - //export const apiBaseUrl = process.env.REACT_APP_API || 'https://api.arasaac.org/api'; - //export const apiIdentifierBaseUrl = process.env.REACT_APP_API_IMAGES || 'https://static.arasaac.org/images'; +export class PictogramService { + private apirUrl = + environment.pictogramApiUrl || 'https://api.arasaac.org/v1/pictograms'; + private staticAssetUrl = + environment.pictogramStaticUrl || 'https://static.arasaac.org/pictograms'; + private apiResource = 'bestsearch'; constructor(private http: HttpClient) {} - ngOnDestroy() { - } - getPictos(seachTerm: string): Observable { - const language = 'de' - const url = `${this.apirUrl}/${language}/${this.apiResource}/${seachTerm}` - return this.http.get(url) + const language = 'de'; + const url = `${this.apirUrl}/${language}/${this.apiResource}/${seachTerm}`; + return this.http.get(url); } - getPictoImageUrl(id: number, size: number = 300, fileType: string = 'png') { - return `${this.staticAssetUrl}/${id}/${id}_${size}.${fileType}` + getPictoImageUrl(id: number, size = 300, fileType = 'png') { + return `${this.staticAssetUrl}/${id}/${id}_${size}.${fileType}`; } getPictoImage(id: number): Observable { - const url = this.getPictoImageUrl(id) - return this.http.get(url, { responseType: 'blob' }) + const url = this.getPictoImageUrl(id); + return this.http.get(url, { responseType: 'blob' }); } -} \ No newline at end of file +} diff --git a/teammapper-frontend/src/app/core/services/utils/utils.service.ts b/teammapper-frontend/src/app/core/services/utils/utils.service.ts index 65c26267..14b40fb1 100644 --- a/teammapper-frontend/src/app/core/services/utils/utils.service.ts +++ b/teammapper-frontend/src/app/core/services/utils/utils.service.ts @@ -157,5 +157,5 @@ export class UtilsService { resolve(reader.result); }; }); - }; + } } diff --git a/teammapper-frontend/src/app/modules/application/application.module.ts b/teammapper-frontend/src/app/modules/application/application.module.ts index 7a25871a..4105b806 100644 --- a/teammapper-frontend/src/app/modules/application/application.module.ts +++ b/teammapper-frontend/src/app/modules/application/application.module.ts @@ -24,7 +24,7 @@ import { DialogPictogramsComponent } from './components/dialog-pictograms/dialog MatMenuModule, MatTabsModule, ApplicationRoutingModule, - ColorPickerModule + ColorPickerModule, ], declarations: [ ApplicationComponent, diff --git a/teammapper-frontend/src/app/modules/application/components/dialog-pictograms/dialog-pictograms.component.html b/teammapper-frontend/src/app/modules/application/components/dialog-pictograms/dialog-pictograms.component.html index d00bf7e9..16d30a73 100644 --- a/teammapper-frontend/src/app/modules/application/components/dialog-pictograms/dialog-pictograms.component.html +++ b/teammapper-frontend/src/app/modules/application/components/dialog-pictograms/dialog-pictograms.component.html @@ -20,7 +20,7 @@

{{ 'MODALS.PICTOGRAMS.TITLE' | translate }}

{{ 'MODALS.PICTOGRAMS.TERMS_TEXT' | translate }}
-
+
- +
+ +
diff --git a/teammapper-frontend/src/app/modules/application/components/toolbar/toolbar.component.ts b/teammapper-frontend/src/app/modules/application/components/toolbar/toolbar.component.ts index 9e6b5a57..5d405b35 100644 --- a/teammapper-frontend/src/app/modules/application/components/toolbar/toolbar.component.ts +++ b/teammapper-frontend/src/app/modules/application/components/toolbar/toolbar.component.ts @@ -3,6 +3,7 @@ import { ExportNodeProperties } from '@mmp/map/types'; import { TranslateService } from '@ngx-translate/core'; import { DialogService } from 'src/app/core/services/dialog/dialog.service'; import { MmpService } from 'src/app/core/services/mmp/mmp.service'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'teammapper-toolbar', @@ -12,6 +13,7 @@ import { MmpService } from 'src/app/core/services/mmp/mmp.service'; export class ToolbarComponent { @Input() public node: ExportNodeProperties; @Input() public editDisabled: boolean; + public featureFlagPictograms: boolean = environment.featureFlagPictograms; constructor( private translationService: TranslateService, diff --git a/teammapper-frontend/src/app/root.module.ts b/teammapper-frontend/src/app/root.module.ts index 274ce925..461315f7 100644 --- a/teammapper-frontend/src/app/root.module.ts +++ b/teammapper-frontend/src/app/root.module.ts @@ -31,7 +31,7 @@ export function createTranslateLoader(http: HttpClient) { deps: [HttpClient], }, }), - HotkeyModule.forRoot() + HotkeyModule.forRoot(), ], declarations: [RootComponent], providers: [ diff --git a/teammapper-frontend/src/app/shared/shared.module.ts b/teammapper-frontend/src/app/shared/shared.module.ts index b8eb0dd3..f1d16ae8 100644 --- a/teammapper-frontend/src/app/shared/shared.module.ts +++ b/teammapper-frontend/src/app/shared/shared.module.ts @@ -18,8 +18,8 @@ import { MatLegacySlideToggleModule as MatSlideToggleModule } from '@angular/mat import { StripTags } from './pipes/striptags.pipe'; import { InverseBoolPipe } from './pipes/inverse-bool.pipe'; import { MatDialogModule } from '@angular/material/dialog'; -import {MatGridListModule} from '@angular/material/grid-list'; -import { NgOptimizedImage } from '@angular/common' +import { MatGridListModule } from '@angular/material/grid-list'; +import { NgOptimizedImage } from '@angular/common'; const PIPES = [StripTags, InverseBoolPipe]; @@ -43,7 +43,7 @@ const PIPES = [StripTags, InverseBoolPipe]; MatInputModule, MatSelectModule, MatSlideToggleModule, - NgOptimizedImage + NgOptimizedImage, ], declarations: [...PIPES], exports: [ diff --git a/teammapper-frontend/src/assets/i18n/de.json b/teammapper-frontend/src/assets/i18n/de.json index 5b76cdf0..5d357947 100644 --- a/teammapper-frontend/src/assets/i18n/de.json +++ b/teammapper-frontend/src/assets/i18n/de.json @@ -83,7 +83,7 @@ "TITLE": "Piktogramm einfügen", "BUTTON_SEARCH": "Suchen", "FORM_INPUT_LABEL_SEARCH": "Suchwort", - "TERMS_TEXT": "Piktogramme von Sergio Palao (Urheber), ARASAAC (arasaac.org), Regierung von Aragón in Spanien (Eigentümer), CC BY-SA-NC 4.0", + "TERMS_TEXT": "Piktogramm-Urheber Sergio Palao. Herkunft: ARASAAC (http://www.arasaac.org). Lizenz: CC (BY-NC-SA). Eigentümer: Regierung von Aragon (Spanien)", "EMPTY": "Aktuell keine Ergebnisse" }, "SHARE": { diff --git a/teammapper-frontend/src/environments/environment.prod.ts b/teammapper-frontend/src/environments/environment.prod.ts index 773a97f9..f0d4dd7c 100644 --- a/teammapper-frontend/src/environments/environment.prod.ts +++ b/teammapper-frontend/src/environments/environment.prod.ts @@ -2,4 +2,7 @@ export const environment = { production: true, version: '0.4.0', name: 'TeamMapper', + pictogramApiUrl: 'https://api.arasaac.org/v1/pictograms', + pictogramStaticUrl: 'https://static.arasaac.org/pictograms', + featureFlagPictograms: true, }; diff --git a/teammapper-frontend/src/environments/environment.ts b/teammapper-frontend/src/environments/environment.ts index a0ee4f62..583f9262 100644 --- a/teammapper-frontend/src/environments/environment.ts +++ b/teammapper-frontend/src/environments/environment.ts @@ -2,4 +2,7 @@ export const environment = { production: false, version: '0.4.0', name: 'TeamMapper', + pictogramApiUrl: 'https://api.arasaac.org/v1/pictograms', + pictogramStaticUrl: 'https://static.arasaac.org/pictograms', + featureFlagPictograms: true, };