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 setPackages = (pkgs: GUIPackage[], isSearch?: boolean) => {
|
||||
packages = isSearch ? pkgs : pkgs.sort((a, b) => {
|
||||
if (sortBy === 'popularity') {
|
||||
const aPop = +a.dl_count + a.installs;
|
||||
const bPop = +b.dl_count + b.installs;
|
||||
return sortDirection === 'asc' ? aPop - bPop : bPop - aPop;
|
||||
} else {
|
||||
// most recent
|
||||
const aDate = new Date(a.last_modified);
|
||||
const bDate = new Date(b.last_modified);
|
||||
return sortDirection === 'asc' ? +aDate - +bDate : +bDate - +aDate;
|
||||
}
|
||||
});
|
||||
packages = isSearch
|
||||
? pkgs
|
||||
: pkgs.sort((a, b) => {
|
||||
if (sortBy === 'popularity') {
|
||||
const aPop = +a.dl_count + a.installs;
|
||||
const bPop = +b.dl_count + b.installs;
|
||||
return sortDirection === 'asc' ? aPop - bPop : bPop - aPop;
|
||||
} else {
|
||||
// most recent
|
||||
const aDate = new Date(a.last_modified);
|
||||
const bDate = new Date(b.last_modified);
|
||||
return sortDirection === 'asc' ? +aDate - +bDate : +bDate - +aDate;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
packagesStore.subscribe((v) => {
|
||||
|
|
Loading…
Reference in a new issue