Skip to content

Commit

Permalink
sort sounds by name in dashboard and settings (closes #14)
Browse files Browse the repository at this point in the history
sounds are sorted by their name in ascending order case-insensitively
  • Loading branch information
dominikks committed Nov 6, 2023
1 parent 011434e commit 5bf6d63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/app/services/sounds.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import { sortBy } from 'lodash-es';
import { Guild } from './api.service';

interface ApiSound {
Expand Down Expand Up @@ -64,7 +65,10 @@ export class SoundsService {
constructor(private http: HttpClient) {}

loadSounds() {
return this.http.get<ApiSound[]>('/api/sounds').pipe(map(sounds => sounds.map(sound => new Sound(sound))));
return this.http.get<ApiSound[]>('/api/sounds').pipe(
map(sounds => sounds.map(sound => new Sound(sound))),
map(sounds => sortBy(sounds, sound => sound.name.toLowerCase()))
);
}

playSound(sound: Sound, guild: Guild | string, autojoin: boolean) {
Expand Down

0 comments on commit 5bf6d63

Please sign in to comment.