Files
gerbeur/src/contexts/WSContext.ts
2026-03-16 07:34:49 +00:00

23 lines
567 B
TypeScript

import { createContext } from "react";
import type { Dump, OnlineUser } from "../model.ts";
export interface WSContextValue {
onlineUsers: OnlineUser[];
voteCounts: Record<string, number>;
myVotes: Set<string>;
recentDumps: Dump[];
deletedDumpIds: Set<string>;
castVote: (dumpId: string) => void;
removeVote: (dumpId: string) => void;
}
export const WSContext = createContext<WSContextValue>({
onlineUsers: [],
voteCounts: {},
myVotes: new Set(),
recentDumps: [],
deletedDumpIds: new Set(),
castVote: () => {},
removeVote: () => {},
});