REFACTOR: Repositioned chat toggle functionality and context management;

UPDATE: Improve stream time display;
REFACTOR: Update Video Page Styles;

Co-authored-by: JustIceO7 <oscarcao777@gmail.com>
This commit is contained in:
Chris-1010
2025-02-26 13:02:31 +00:00
parent 1341a10d76
commit c56c5ffa41
3 changed files with 113 additions and 60 deletions

View File

@@ -0,0 +1,26 @@
import { createContext, useContext, useState, ReactNode } from "react";
interface ChatContextType {
showChat: boolean;
setShowChat: (show: boolean) => void;
}
const ChatContext = createContext<ChatContextType | undefined>(undefined);
export function ChatProvider({ children }: { children: ReactNode }) {
const [showChat, setShowChat] = useState(true);
return (
<ChatContext.Provider value={{ showChat, setShowChat }}>
{children}
</ChatContext.Provider>
);
}
export function useChat() {
const context = useContext(ChatContext);
if (context === undefined) {
throw new Error("useChat must be used within a ChatProvider");
}
return context;
}