v1 feature: added playlists

This commit is contained in:
khannurien
2026-03-16 16:52:53 +00:00
parent 867e64cb5b
commit be426eb150
25 changed files with 2958 additions and 101 deletions

View File

@@ -1,5 +1,5 @@
import { createContext } from "react";
import type { Dump, OnlineUser } from "../model.ts";
import type { Dump, OnlineUser, Playlist } from "../model.ts";
export interface VoteEvent {
dumpId: string;
@@ -7,6 +7,14 @@ export interface VoteEvent {
action: "cast" | "remove";
}
export interface PlaylistEvent {
type: "created" | "updated" | "deleted" | "dumps_updated";
playlistId: string;
playlist?: Playlist;
userId?: string;
dumpIds?: string[];
}
export interface WSContextValue {
onlineUsers: OnlineUser[];
voteCounts: Record<string, number>;
@@ -14,6 +22,8 @@ export interface WSContextValue {
recentDumps: Dump[];
deletedDumpIds: Set<string>;
lastVoteEvent: VoteEvent | null;
lastPlaylistEvent: PlaylistEvent | null;
deletedPlaylistIds: Set<string>;
castVote: (dumpId: string) => void;
removeVote: (dumpId: string) => void;
}
@@ -25,6 +35,8 @@ export const WSContext = createContext<WSContextValue>({
recentDumps: [],
deletedDumpIds: new Set(),
lastVoteEvent: null,
lastPlaylistEvent: null,
deletedPlaylistIds: new Set(),
castVote: () => {},
removeVote: () => {},
});