Files
Dorod-Sky/skyvern-frontend/src/store/DebugStoreContext.tsx
2025-07-10 18:51:45 -04:00

31 lines
695 B
TypeScript

import React, { createContext, useMemo } from "react";
import { useLocation } from "react-router-dom";
function useIsDebugMode() {
const location = useLocation();
return useMemo(
() => location.pathname.includes("debug"),
[location.pathname],
);
}
export type DebugStoreContextType = {
isDebugMode: boolean;
};
export const DebugStoreContext = createContext<
DebugStoreContextType | undefined
>(undefined);
export const DebugStoreProvider: React.FC<{ children: React.ReactNode }> = ({
children,
}) => {
const isDebugMode = useIsDebugMode();
return (
<DebugStoreContext.Provider value={{ isDebugMode }}>
{children}
</DebugStoreContext.Provider>
);
};