mirror of
https://github.com/cosscom/coss.git
synced 2026-09-14 20:06:50 +08:00
6c7dcfa923
* refactor: restructure examples folder to support multiple apps - Move current examples app to examples/calcom - Update workspace configuration to include apps/examples/* - Rename package from 'examples' to '@examples/calcom' This allows the examples folder to contain multiple different example apps. Co-Authored-By: pasquale@cal.com <pasquale@cal.com> * mc --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: pasquale@cal.com <pasquale@cal.com> Co-authored-by: pasqualevitiello <pasqualevitiello@gmail.com>
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
"use client";
|
|
|
|
import { createContext, type ReactNode, useContext, useState } from "react";
|
|
|
|
interface DebugContextValue {
|
|
enableArtificialDelay: boolean;
|
|
isLoadingOverride: boolean | null;
|
|
setEnableArtificialDelay: (value: boolean) => void;
|
|
setIsLoadingOverride: (value: boolean | null) => void;
|
|
}
|
|
|
|
const DebugContext = createContext<DebugContextValue | null>(null);
|
|
|
|
export function DebugProvider({ children }: { children: ReactNode }) {
|
|
const [isLoadingOverride, setIsLoadingOverride] = useState<boolean | null>(
|
|
null,
|
|
);
|
|
const [enableArtificialDelay, setEnableArtificialDelay] = useState(false);
|
|
|
|
return (
|
|
<DebugContext.Provider
|
|
value={{
|
|
enableArtificialDelay,
|
|
isLoadingOverride,
|
|
setEnableArtificialDelay,
|
|
setIsLoadingOverride,
|
|
}}
|
|
>
|
|
{children}
|
|
</DebugContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useDebug() {
|
|
const context = useContext(DebugContext);
|
|
if (!context) {
|
|
throw new Error("useDebug must be used within a DebugProvider");
|
|
}
|
|
return context;
|
|
}
|