Picsur/frontend/src/app/routes/settings/general/settings-general.component.ts
2022-12-25 23:36:59 +01:00

31 lines
886 B
TypeScript

import { Component } from '@angular/core';
import { DecodedPref } from 'picsur-shared/dist/dto/preferences.dto';
import { Observable } from 'rxjs';
import {
UsrPreferenceFriendlyNames,
UsrPreferenceHelpText,
} from 'src/app/i18n/usr-pref.i18n';
import { UsrPrefService } from 'src/app/services/api/usr-pref.service';
@Component({
templateUrl: './settings-general.component.html',
})
export class SettingsGeneralComponent {
private readonly translator = UsrPreferenceFriendlyNames;
private readonly helpTranslator = UsrPreferenceHelpText;
public getName(key: string) {
return (this.translator as any)[key] ?? key;
}
public getHelpText(key: string) {
return (this.helpTranslator as any)[key] ?? '';
}
preferences: Observable<DecodedPref[]>;
constructor(public readonly usrPrefService: UsrPrefService) {
this.preferences = usrPrefService.live;
}
}