diff --git a/src/app/tools/tankopedia/components/TankSearch/index.tsx b/src/app/tools/tankopedia/components/TankSearch/index.tsx index 7d06faf4e..511e54012 100644 --- a/src/app/tools/tankopedia/components/TankSearch/index.tsx +++ b/src/app/tools/tankopedia/components/TankSearch/index.tsx @@ -63,14 +63,20 @@ export function TankSearch({ compact, onSelect = () => {} }: TankSearchProps) { awaitedTanks .sort( (a, b) => - treeTypeOrder.indexOf(a.treeType) - - treeTypeOrder.indexOf(b.treeType), + (treeTypeOrder.indexOf(a.treeType) - + treeTypeOrder.indexOf(b.treeType)) * + (sort.direction === 'descending' ? -1 : 1), ) .sort( (a, b) => - tankTypeOrder.indexOf(a.type) - tankTypeOrder.indexOf(b.type), + (tankTypeOrder.indexOf(a.type) - tankTypeOrder.indexOf(b.type)) * + (sort.direction === 'descending' ? -1 : 1), ) - .sort((a, b) => nations.indexOf(a.nation) - nations.indexOf(b.nation)), + .sort( + (a, b) => + (nations.indexOf(a.nation) - nations.indexOf(b.nation)) * + (sort.direction === 'descending' ? -1 : 1), + ), [], ); const input = useRef(null);