mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-26 20:19:50 +01:00
feat: tier sorting
This commit is contained in:
1 parent
b4936bf13b
commit
385cc3b6d2
8 files changed
+64
-7
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { api } from "../core/api/dynamic";
|
||||
import { useAwait } from "./useAwait";
|
||||
|
||||
export function useTierCompare() {
|
||||
const tiers = useAwait(() => api.tiers(), "tiers");
|
||||
|
||||
function compare(a: string, b: string) {
|
||||
const [, tierNameA] = a.split(".");
|
||||
const [, tierNameB] = b.split(".");
|
||||
const tierA = tiers.tiers[tierNameA];
|
||||
const tierB = tiers.tiers[tierNameB];
|
||||
|
||||
return tierB.carousel_level - tierA.carousel_level;
|
||||
}
|
||||
|
||||
return compare;
|
||||
}
|
||||
Reference in new issue
Block a user