Add global stats to UI (not desktop yet)

This commit is contained in:
Igor Katson 2024-08-21 12:58:15 +01:00
parent ae606fac4a
commit 61b7a643aa
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 89 additions and 11 deletions

View file

@ -0,0 +1,26 @@
import { create } from "zustand";
import { SessionStats } from "../api-types";
export interface StatsStore {
stats: SessionStats;
setStats: (stats: SessionStats) => void;
}
export const useStatsStore = create<StatsStore>((set) => ({
stats: {
download_speed: { human_readable: "N/A", mbps: 0 },
upload_speed: { human_readable: "N/A", mbps: 0 },
peers: {
connecting: 0,
dead: 0,
live: 0,
not_needed: 0,
queued: 0,
seen: 0,
},
},
setStats: (stats) => {
set({ stats });
},
}));