"use client"; import SiteContext from "@app/contexts/siteContext"; import { GetSiteResponse } from "@server/routers/site/getSite"; import { useState } from "react"; interface SiteProviderProps { children: React.ReactNode; site: GetSiteResponse; } export function SiteProvider({ children, site: serverSite }: SiteProviderProps) { const [site, setSite] = useState(serverSite); const updateSite = (updatedSite: Partial) => { if (!site) { throw new Error("No site to update"); } setSite((prev) => { if (!prev) { return prev; } return { ...prev, ...updatedSite }; }); }; return ( {children} ); } export default SiteProvider;