rewrite ui with vite+react

This commit is contained in:
2026-03-12 11:57:43 +03:00
parent 44c7126ac5
commit da9f4bb0ec
24 changed files with 3165 additions and 63 deletions

21
web/src/player/context.ts Normal file
View File

@@ -0,0 +1,21 @@
import { createContext, useContext } from "react";
import type { EpisodeDetail } from "../api/podcasts";
export type PlayerStatus = "stopped" | "playing" | "paused";
export type PlayerContext = {
status: PlayerStatus;
setStatus: (status: PlayerStatus) => void;
episode: EpisodeDetail | null;
setEpisode: (episode: EpisodeDetail | null) => void;
};
export const playerContext = createContext<PlayerContext | null>(null);
export const usePlayerContext = () => {
const ctx = useContext(playerContext);
if (!ctx) {
throw new Error("No PlayerProvider in component tree");
}
return ctx;
};