Added in Logo's and worked on Avatars and Chats

This commit is contained in:
Ace
2026-06-17 16:26:32 +02:00
parent 4898bf7142
commit d6d784cef3
19 changed files with 1135 additions and 35 deletions
+30
View File
@@ -0,0 +1,30 @@
"use client"
import { createContext, useContext, useState, ReactNode } from "react"
import { currentUser } from "@/data/users"
import type { User } from "@/types"
interface UserContextValue {
user: User
updateAvatar: (url: string) => void
}
const UserContext = createContext<UserContextValue | null>(null)
export function UserProvider({ children }: { children: ReactNode }) {
const [avatar, setAvatar] = useState(currentUser.avatar)
const user: User = { ...currentUser, avatar }
return (
<UserContext.Provider value={{ user, updateAvatar: setAvatar }}>
{children}
</UserContext.Provider>
)
}
export function useUser() {
const ctx = useContext(UserContext)
if (!ctx) throw new Error("useUser must be used within UserProvider")
return ctx
}