Skip to main content
Glama
Southclaws

Storyden

by Southclaws
ReplyContext.tsx1.08 kB
"use client"; import { createContext, useContext, useState } from "react"; import { Reply, Thread } from "@/api/openapi-schema"; type ReplyToState = { thread: Thread; reply: Reply; } | null; type ReplyContextValue = { replyTo: ReplyToState; setReplyTo: (thread: Thread, reply: Reply) => void; clearReplyTo: () => void; }; const ReplyContext = createContext<ReplyContextValue | undefined>(undefined); export function ReplyProvider({ children }: { children: React.ReactNode }) { const [replyTo, setReplyToState] = useState<ReplyToState>(null); const setReplyTo = (thread: Thread, reply: Reply) => { setReplyToState({ thread, reply }); }; const clearReplyTo = () => { setReplyToState(null); }; return ( <ReplyContext.Provider value={{ replyTo, setReplyTo, clearReplyTo }}> {children} </ReplyContext.Provider> ); } export function useReplyContext() { const context = useContext(ReplyContext); if (context === undefined) { throw new Error("useReplyContext must be used within a ReplyProvider"); } return context; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server