2025-03-10 02:12:57 +05:30
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { createContext, useContext, useState, ReactNode } from 'react';
|
|
|
|
|
|
|
|
|
|
export type RLNImplementationType = 'standard' | 'light';
|
|
|
|
|
|
|
|
|
|
interface RLNImplementationContextType {
|
|
|
|
|
implementation: RLNImplementationType;
|
|
|
|
|
setImplementation: (implementation: RLNImplementationType) => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const RLNImplementationContext = createContext<RLNImplementationContextType | undefined>(undefined);
|
|
|
|
|
|
|
|
|
|
export function RLNImplementationProvider({ children }: { children: ReactNode }) {
|
2025-03-27 15:38:43 +05:30
|
|
|
const [implementation, setImplementation] = useState<RLNImplementationType>('light');
|
2025-03-10 02:12:57 +05:30
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<RLNImplementationContext.Provider value={{ implementation, setImplementation }}>
|
|
|
|
|
{children}
|
|
|
|
|
</RLNImplementationContext.Provider>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function useRLNImplementation() {
|
|
|
|
|
const context = useContext(RLNImplementationContext);
|
|
|
|
|
if (context === undefined) {
|
|
|
|
|
throw new Error('useRLNImplementation must be used within a RLNImplementationProvider');
|
|
|
|
|
}
|
|
|
|
|
return context;
|
2025-03-27 14:12:19 +05:30
|
|
|
}
|