diff --git a/src/app/components/floating-column/settings/settings.component.html b/src/app/components/floating-column/settings/settings.component.html index 0438f4e4..cfe42025 100644 --- a/src/app/components/floating-column/settings/settings.component.html +++ b/src/app/components/floating-column/settings/settings.component.html @@ -35,7 +35,7 @@ play - +

Shortcuts

switch column:
@@ -50,35 +50,40 @@
- -

Languages

-
- {{ l.name }} ({{l.iso639}}) - -
-
- -
-
- {{ l.name }} ({{l.iso639}}) - -
+

Languages

+
+
+
+ {{ l.name }} ({{l.iso639}}) + remove +
+ +
+ {{ l.name }} ({{l.iso639}}) + add +
+
+

Twitter Bridge

+ (change)="onTwitterBridgeEnabledChanged()" type="checkbox" name="onTwitterBridgeEnabled" + value="onTwitterBridgeEnabled" id="onTwitterBridgeEnabled">

Please provide your bridge instance: - - If you don't know any, consider using BirdsiteLIVE

+ + If you don't know any, consider using BirdsiteLIVE +

- What is this? + What is this?
diff --git a/src/app/components/floating-column/settings/settings.component.scss b/src/app/components/floating-column/settings/settings.component.scss index f2fbd754..9ddfb8e7 100644 --- a/src/app/components/floating-column/settings/settings.component.scss +++ b/src/app/components/floating-column/settings/settings.component.scss @@ -31,6 +31,13 @@ padding: 0 5px 15px 5px; position: relative; + &__content { + display: block; + padding: 0 0 0 5px; + + // outline: 1px dotted greenyellow; + } + &__checkbox { position: relative; top: 3px; @@ -68,6 +75,37 @@ } } +.language { + &__entry { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; + + &:not(:last-child){ + margin-bottom: 1px; + } + + &__name { + display: block; + align-items: stretch; + padding-left: 5px; + } + + &__action { + align-items: stretch; + min-width: 70px; + text-align: center; + padding: 0 10px; + } + } + + &__search { + display: block; + margin: 5px 0 5px 0; + } +} + .form-control { border: 1px solid $settings-text-input-border; color: $settings-text-input-foreground; diff --git a/src/app/components/floating-column/settings/settings.component.ts b/src/app/components/floating-column/settings/settings.component.ts index a9fc0736..051b23f5 100644 --- a/src/app/components/floating-column/settings/settings.component.ts +++ b/src/app/components/floating-column/settings/settings.component.ts @@ -1,6 +1,7 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { Howl } from 'howler'; +import { Subscription } from 'rxjs'; import { environment } from '../../../../environments/environment'; import { ToolsService, InstanceType } from '../../../services/tools.service'; @@ -18,7 +19,7 @@ import { LanguageService } from '../../../services/language.service'; styleUrls: ['./settings.component.scss'] }) -export class SettingsComponent implements OnInit { +export class SettingsComponent implements OnInit, OnDestroy { notificationSounds: NotificationSoundDefinition[]; notificationSoundId: string; @@ -40,6 +41,10 @@ export class SettingsComponent implements OnInit { timeLineMode: TimeLineModeEnum = TimeLineModeEnum.OnTop; contentWarningPolicy: ContentWarningPolicyEnum = ContentWarningPolicyEnum.None; + configuredLangs: ILanguage[] = []; + searchedLangs: ILanguage[] = []; + searchLang: string; + private addCwOnContent: string; set setAddCwOnContent(value: string) { this.setCwPolicy(null, value, null, null); @@ -77,6 +82,8 @@ export class SettingsComponent implements OnInit { return this.twitterBridgeInstance; } + private languageSub: Subscription; + constructor( private readonly languageService: LanguageService, private readonly settingsService: SettingsService, @@ -85,9 +92,15 @@ export class SettingsComponent implements OnInit { private serviceWorkersService: ServiceWorkerService, private readonly toolsService: ToolsService, private readonly notificationService: NotificationService, - private readonly userNotificationsService: UserNotificationService) { } + private readonly userNotificationsService: UserNotificationService) { } ngOnInit() { + this.languageSub = this.languageService.configuredLanguagesChanged.subscribe(l => { + if(l){ + this.configuredLangs = l; + } + }); + this.version = environment.VERSION; const settings = this.settingsService.getSettings(); @@ -135,20 +148,18 @@ export class SettingsComponent implements OnInit { this.configuredLangs = this.languageService.getConfiguredLanguages(); } - configuredLangs: ILanguage[] = []; - searchedLangs: ILanguage[] = []; - - searchLang: string; + ngOnDestroy(): void { + if(this.languageSub) this.languageSub.unsubscribe(); + } onSearchLang(input: string) { - console.warn(input); this.searchedLangs = this.languageService.searchLanguage(input); } onAddLang(lang: ILanguage): boolean { if(this.configuredLangs.findIndex(x => x.iso639 === lang.iso639) >= 0) return false; - this.configuredLangs.push(lang); + // this.configuredLangs.push(lang); this.languageService.addLanguage(lang); this.searchLang = ''; @@ -158,7 +169,7 @@ export class SettingsComponent implements OnInit { } onRemoveLang(lang: ILanguage): boolean { - this.configuredLangs = this.configuredLangs.filter(x => x.iso639 !== lang.iso639); + // this.configuredLangs = this.configuredLangs.filter(x => x.iso639 !== lang.iso639); this.languageService.removeLanguage(lang); return false; } diff --git a/src/app/services/models/mastodon.interfaces.ts b/src/app/services/models/mastodon.interfaces.ts index ec31ddbf..084a1b0d 100644 --- a/src/app/services/models/mastodon.interfaces.ts +++ b/src/app/services/models/mastodon.interfaces.ts @@ -132,7 +132,8 @@ export interface Instancev2 extends Instance { export interface Instancev2Configuration { urls: Instancev2Urls; - statuses: Instancev2Statuses + statuses: Instancev2Statuses; + translation: Instancev2Translation; } export interface InstanceUrls { @@ -147,6 +148,10 @@ export interface Instancev2Statuses { max_characters: number; } +export interface Instancev2Translation { + enabled: boolean; +} + export interface Mention { url: string; username: string;