mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-05-26 03:26:58 +00:00
fix sort
This commit is contained in:
parent
96e6530612
commit
28c85cc271
@ -43,14 +43,15 @@ export function formatTimestamp(timestamp: number): string {
|
|||||||
// Both have timestamp, sort by timestamp descending
|
// Both have timestamp, sort by timestamp descending
|
||||||
return b.timestamp - a.timestamp;
|
return b.timestamp - a.timestamp;
|
||||||
} else if (a.timestamp) {
|
} else if (a.timestamp) {
|
||||||
// Only `a` has timestamp, it comes first
|
|
||||||
return -1;
|
return -1;
|
||||||
} else if (b.timestamp) {
|
} else if (b.timestamp) {
|
||||||
// Only `b` has timestamp, it comes first
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
// Neither has timestamp, sort alphabetically by groupName
|
// Neither has timestamp, sort alphabetically by groupName (with fallback)
|
||||||
return a.groupName.localeCompare(b.groupName);
|
const nameA = a.groupName || '';
|
||||||
|
const nameB = b.groupName || '';
|
||||||
|
return nameA.localeCompare(nameB);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user