fix sorting of Languages and Software filters

This commit is contained in:
Collin M. Barrett 2018-09-26 17:11:25 -05:00
parent 037fcb2928
commit 0156ea23ff
2 changed files with 4 additions and 3 deletions

View file

@ -33,7 +33,8 @@ const Filter = (props: any, languages: ILanguage[]) =>
value={props.filter ? props.filter.value : "any"}>
<option value="any">Any</option>
{languages.length > 0
? languages.map((l: ILanguage, i: number) => <option value={l.id} key={i}>{l.name}</option>)
? languages.sort((a, b) => a.name.localeCompare(b.name))
.map((l: ILanguage, i: number) => <option value={l.id} key={i}>{l.name}</option>)
: null}
</select>;

View file

@ -34,7 +34,7 @@ const Filter = (props: any, software: ISoftware[]) =>
value={props.filter ? props.filter.value : "any"}>
<option value="any">Any</option>
{software.length > 0
? software.map(
? software.sort((a, b) => a.name.localeCompare(b.name)).map(
(s: ISoftware, i: number) => <option value={s.id} key={i}>{s.name}</option>)
: null}
</select>;
@ -42,5 +42,5 @@ const Filter = (props: any, software: ISoftware[]) =>
const Cell = (listSyntaxId: number, software: ISoftware[]) =>
listSyntaxId
? software.filter((s: ISoftware) => s.syntaxIds.indexOf(listSyntaxId) > -1)
.map((s: ISoftware, i: number) => <SoftwareIcon id={s.id} key={i}/>)
.map((s: ISoftware, i: number) => <SoftwareIcon id={s.id} key={i}/>)
: null;