diff --git a/src/app/runs/components/LiveRunRow.tsx b/src/app/runs/components/LiveRunRow.tsx index 08faad2..05d4bec 100644 --- a/src/app/runs/components/LiveRunRow.tsx +++ b/src/app/runs/components/LiveRunRow.tsx @@ -21,7 +21,7 @@ export default function LiveRunRow({ const [problem] = useAction(() => getProblem(run.problem)); const now = new Date().getTime() + 1000; - const isTop = run.views > 5; + const isTop = run.views >= 5; return ( { + const aTrending = a.views >= 5; + const bTrending = b.views >= 5; + + if (aTrending && bTrending) { + // Both trending → sort by views descending, then timestamp descending + if (b.views !== a.views) return b.views - a.views; + return b.start - a.start; + } else if (aTrending) { + return -1; // a goes first + } else if (bTrending) { + return 1; // b goes first + } else { + // Neither trending → sort by timestamp descending + return b.start - a.start; + } + }); return (
@@ -26,7 +41,7 @@ export default function LiveRuns() {

Live Runs

- 42 live runs · Streaming in real time + {liveRuns?.length} live runs · Streaming in real time