feat: user registration and chat messaging (wip)

This commit is contained in:
Alexander Daichendt 2025-02-12 11:21:57 +01:00
parent b0ce2fe0af
commit 18dd8b83f0
14 changed files with 243 additions and 33 deletions

View file

@ -0,0 +1,17 @@
import { createContext, useContext } from "react";
import { ChatMessage, User } from "../../../shared";
interface ChatContextType {
messages: ChatMessage[];
currentUser: User | null;
addMessage: (message: ChatMessage) => void;
setCurrentUser: (user: User) => void;
}
export const ChatContext = createContext<ChatContextType | null>(null);
export const useChatState = () => {
const context = useContext(ChatContext);
if (!context) throw new Error("useChat must be used within ChatProvider");
return context;
};