23 lines
567 B
TypeScript
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: () => {},
|
|
});
|