Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
17 lines
526 B
TypeScript
17 lines
526 B
TypeScript
'use client'
|
|
/* @refresh reset */
|
|
|
|
import React, { createContext, useMemo, useState } from 'react'
|
|
|
|
import type { LoadingContextType } from '@/types'
|
|
|
|
export const LoadingContext = createContext<LoadingContextType | undefined>(undefined)
|
|
|
|
export const LoadingProvider = ({ children }: { children: React.ReactNode }) => {
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
const value = useMemo(() => ({ loading, setLoading }), [loading])
|
|
|
|
return <LoadingContext.Provider value={value}>{children}</LoadingContext.Provider>
|
|
}
|