garage-erp/apps/dashboard/modules/estimates/estimate-context.tsx
2026-04-15 04:59:05 +03:00

30 lines
587 B
TypeScript

"use client"
import { createContext, useContext } from "react"
export type EstimateContextValue = {
id: string
label: string
data?: Record<string, any>
}
const EstimateContext = createContext<EstimateContextValue | null>(null)
export function EstimateProvider({
estimate,
children,
}: {
estimate: EstimateContextValue
children: React.ReactNode
}) {
return (
<EstimateContext.Provider value={estimate}>
{children}
</EstimateContext.Provider>
)
}
export function useEstimate() {
return useContext(EstimateContext)
}