Download web/context/external-api-panel-context.tsx from Underground-Digital/Workflow-Engine: direct link, hf CLI and curl.
- Browser
- Download file 889 Bytes
-
https://huggingface.co/spaces/Underground-Digital/Workflow-Engine/resolve/main/web/context/external-api-panel-context.tsx
- Command line
-
hf download hf://spaces/Underground-Digital/Workflow-Engine/web/context/external-api-panel-context.tsx
-
curl -L -o external-api-panel-context.tsx https://huggingface.co/spaces/Underground-Digital/Workflow-Engine/resolve/main/web/context/external-api-panel-context.tsx
889 Bytes
| 'use client' | |
| import React, { createContext, useContext, useState } from 'react' | |
| type ExternalApiPanelContextType = { | |
| showExternalApiPanel: boolean | |
| setShowExternalApiPanel: (show: boolean) => void | |
| } | |
| const ExternalApiPanelContext = createContext<ExternalApiPanelContextType | undefined>(undefined) | |
| export const ExternalApiPanelProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { | |
| const [showExternalApiPanel, setShowExternalApiPanel] = useState(false) | |
| return ( | |
| <ExternalApiPanelContext.Provider value={{ showExternalApiPanel, setShowExternalApiPanel }}> | |
| {children} | |
| </ExternalApiPanelContext.Provider> | |
| ) | |
| } | |
| export const useExternalApiPanel = () => { | |
| const context = useContext(ExternalApiPanelContext) | |
| if (context === undefined) | |
| throw new Error('useExternalApiPanel must be used within an ExternalApiPanelProvider') | |
| return context | |
| } | |