mirror of
https://github.com/ivabus/gui
synced 2025-06-08 00:00:27 +03:00
lint
This commit is contained in:
parent
c6963c08d3
commit
8531041a23
1 changed files with 14 additions and 12 deletions
|
@ -23,18 +23,20 @@
|
||||||
const searchLimit = 5;
|
const searchLimit = 5;
|
||||||
|
|
||||||
const setPackages = (pkgs: GUIPackage[], isSearch?: boolean) => {
|
const setPackages = (pkgs: GUIPackage[], isSearch?: boolean) => {
|
||||||
packages = isSearch ? pkgs : pkgs.sort((a, b) => {
|
packages = isSearch
|
||||||
if (sortBy === 'popularity') {
|
? pkgs
|
||||||
const aPop = +a.dl_count + a.installs;
|
: pkgs.sort((a, b) => {
|
||||||
const bPop = +b.dl_count + b.installs;
|
if (sortBy === 'popularity') {
|
||||||
return sortDirection === 'asc' ? aPop - bPop : bPop - aPop;
|
const aPop = +a.dl_count + a.installs;
|
||||||
} else {
|
const bPop = +b.dl_count + b.installs;
|
||||||
// most recent
|
return sortDirection === 'asc' ? aPop - bPop : bPop - aPop;
|
||||||
const aDate = new Date(a.last_modified);
|
} else {
|
||||||
const bDate = new Date(b.last_modified);
|
// most recent
|
||||||
return sortDirection === 'asc' ? +aDate - +bDate : +bDate - +aDate;
|
const aDate = new Date(a.last_modified);
|
||||||
}
|
const bDate = new Date(b.last_modified);
|
||||||
});
|
return sortDirection === 'asc' ? +aDate - +bDate : +bDate - +aDate;
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
packagesStore.subscribe((v) => {
|
packagesStore.subscribe((v) => {
|
||||||
|
|
Loading…
Reference in a new issue