aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/Hololive/Lives.svelte24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/lib/Hololive/Lives.svelte b/src/lib/Hololive/Lives.svelte
index 38def6fa..31843be2 100644
--- a/src/lib/Hololive/Lives.svelte
+++ b/src/lib/Hololive/Lives.svelte
@@ -20,27 +20,13 @@
$: categorisedStreams = schedule.lives
.sort((a, b) => new Date(a.time).getTime() - new Date(b.time).getTime())
.sort((a, b) => {
- const now = Date.now();
- const aTime = new Date(a.time).getTime();
- const bTime = new Date(b.time).getTime();
- const aIsLive = a.streaming;
- const bIsLive = b.streaming;
- const aIsClosestPinned = closestUpcomingPinnedStreams.get(a.streamer) === a;
- const bIsClosestPinned = closestUpcomingPinnedStreams.get(b.streamer) === b;
+ const aPinned = pinnedStreams.includes(a.streamer);
+ const bPinned = pinnedStreams.includes(b.streamer);
- if (aIsLive && pinnedStreams.includes(a.streamer)) return -1;
- if (bIsLive && pinnedStreams.includes(b.streamer)) return 1;
+ if (aPinned && !bPinned) return -1;
+ if (!aPinned && bPinned) return 1;
- if (aIsLive && !bIsLive) return -1;
- if (bIsLive && !aIsLive) return 1;
-
- if (aIsClosestPinned && !bIsClosestPinned) return -1;
- if (bIsClosestPinned && !aIsClosestPinned) return 1;
-
- if (aTime > now && !(aTime < now && !aIsLive)) return -1;
- if (bTime > now && !(bTime < now && !bIsLive)) return 1;
-
- return bTime - aTime;
+ return 0;
})
.reduce(
(