Move isSng control to settings page

This commit is contained in:
Geomitron
2023-12-22 14:33:19 -06:00
parent 22521c8f28
commit e504a62a60
10 changed files with 83 additions and 143 deletions

View File

@@ -26,16 +26,12 @@ export class SearchService {
public availableIcons: string[]
public searchControl = new FormControl('', { nonNullable: true })
public isSng: FormControl<boolean>
public instrument: FormControl<Instrument | null>
public difficulty: FormControl<Difficulty | null>
constructor(
private http: HttpClient,
) {
this.isSng = new FormControl<boolean>((localStorage.getItem('isSng') ?? 'true') === 'true', { nonNullable: true })
this.isSng.valueChanges.subscribe(isSng => localStorage.setItem('isSng', `${isSng}`))
this.instrument = new FormControl<Instrument>(
(localStorage.getItem('instrument') === 'null' ? null : localStorage.getItem('instrument')) as Instrument
)

View File

@@ -75,11 +75,11 @@ export class SettingsService {
this.saveSettings()
}
get rateLimitDelay() {
return this.settings.rateLimitDelay
get isSng() {
return this.settings.isSng
}
set rateLimitDelay(delay: number) {
this.settings.rateLimitDelay = delay
set isSng(value: boolean) {
this.settings.isSng = value
this.saveSettings()
}
}