mirror of
https://github.com/vercel/components.build.git
synced 2026-09-14 20:06:39 +08:00
55fae375a4
* Update Geistdocs * Update geistdocs.tsx * Run translation script * Delete toc.tsx * Update route.ts * Update route.ts
24 lines
581 B
TypeScript
24 lines
581 B
TypeScript
import { atom, useAtom } from "jotai";
|
|
import { atomWithStorage } from "jotai/utils";
|
|
|
|
// Export the prompt atom so it can be used from other parts of the app
|
|
export const chatPromptAtom = atom<string>("");
|
|
|
|
// Export the open state atom for controlling chat visibility
|
|
export const chatOpenAtom = atomWithStorage<boolean>(
|
|
"geistdocs:chat-open",
|
|
false
|
|
);
|
|
|
|
export const useChatContext = () => {
|
|
const [prompt, setPrompt] = useAtom(chatPromptAtom);
|
|
const [isOpen, setIsOpen] = useAtom(chatOpenAtom);
|
|
|
|
return {
|
|
prompt,
|
|
setPrompt,
|
|
isOpen,
|
|
setIsOpen,
|
|
};
|
|
};
|