v2: global player, infinite scroll, image picker, threaded comments

This commit is contained in:
khannurien
2026-03-21 13:55:22 +00:00
parent be426eb150
commit 7c098e7c4c
48 changed files with 4346 additions and 711 deletions

View File

@@ -1,5 +1,5 @@
import { createContext } from "react";
import type { Dump, OnlineUser, Playlist } from "../model.ts";
import type { Comment, Dump, OnlineUser, Playlist } from "../model.ts";
export interface VoteEvent {
dumpId: string;
@@ -15,6 +15,13 @@ export interface PlaylistEvent {
dumpIds?: string[];
}
export interface CommentEvent {
type: "created" | "deleted";
dumpId: string;
comment?: Comment;
commentId?: string;
}
export interface WSContextValue {
onlineUsers: OnlineUser[];
voteCounts: Record<string, number>;
@@ -22,8 +29,10 @@ export interface WSContextValue {
recentDumps: Dump[];
deletedDumpIds: Set<string>;
lastVoteEvent: VoteEvent | null;
lastDumpEvent: Dump | null;
lastPlaylistEvent: PlaylistEvent | null;
deletedPlaylistIds: Set<string>;
lastCommentEvent: CommentEvent | null;
castVote: (dumpId: string) => void;
removeVote: (dumpId: string) => void;
}
@@ -35,8 +44,10 @@ export const WSContext = createContext<WSContextValue>({
recentDumps: [],
deletedDumpIds: new Set(),
lastVoteEvent: null,
lastDumpEvent: null,
lastPlaylistEvent: null,
deletedPlaylistIds: new Set(),
lastCommentEvent: null,
castVote: () => {},
removeVote: () => {},
});