From 59a6c64d4d178c1cc33a6ca66ffd369acc74ace4 Mon Sep 17 00:00:00 2001 From: Ae0h Date: Wed, 4 Dec 2024 10:20:33 -0800 Subject: [PATCH] API key patch --- docusaurus.config.js | 3 ++- index.js | 17 +++++++++++++++++ src/theme/Navbar/AIButton/index.js | 1 - src/theme/Navbar/AskCookbook/index.js | 16 ++++++++++------ 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 index.js diff --git a/docusaurus.config.js b/docusaurus.config.js index d89f2262..b039b99c 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -26,7 +26,8 @@ const config = { baseUrl: '/', customFields: { keys : { - mendable : process.env.MENDABLE_KEY + mendable : process.env.MENDABLE_KEY, + cookbook: process.env.COOKBOOK_PUBLIC_API_KEY, }, homePage: { editUrl: 'https://github.com/rsksmart/devportal/tree/main/', diff --git a/index.js b/index.js new file mode 100644 index 00000000..592b87c8 --- /dev/null +++ b/index.js @@ -0,0 +1,17 @@ +import React from 'react'; +import SearchBar from '@theme-original/SearchBar'; +import AskCookbook from '@cookbookdev/docsbot/react'; +import BrowserOnly from '@docusaurus/BrowserOnly'; +/** It's a public API key, so it's safe to expose it here */ +const COOKBOOK_PUBLIC_API_KEY = + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NzMyNzg3MDE1OTY2Mzc4MGQ0NTM2MjQiLCJpYXQiOjE3MzEzNjA4ODAsImV4cCI6MjA0NjkzNjg4MH0.RqZAvNBAUcTMNxsGvYLKa-lpGE0s3P3A2PsJB_SoyZE'; +export default function SearchBarWrapper(props) { + return ( + <> + + + {() => } + + + ); +} diff --git a/src/theme/Navbar/AIButton/index.js b/src/theme/Navbar/AIButton/index.js index 2cdafed1..dd2fb383 100644 --- a/src/theme/Navbar/AIButton/index.js +++ b/src/theme/Navbar/AIButton/index.js @@ -7,7 +7,6 @@ export default function AIButton() { const { siteConfig: {customFields}, } = useDocusaurusContext(); - const {keys} = customFields; const {colorMode} = useColorMode(); diff --git a/src/theme/Navbar/AskCookbook/index.js b/src/theme/Navbar/AskCookbook/index.js index 62deee3e..13ebdec8 100644 --- a/src/theme/Navbar/AskCookbook/index.js +++ b/src/theme/Navbar/AskCookbook/index.js @@ -1,20 +1,24 @@ import React, { Suspense } from "react"; import BrowserOnly from "@docusaurus/BrowserOnly"; - -/** It's a public API key, so it's safe to expose it here */ -const COOKBOOK_PUBLIC_API_KEY = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NjU5NmUwZTAwZTliZDQ2MzcwYzMyMzUiLCJpYXQiOjE3MTcxMzY5MTAsImV4cCI6MjAzMjcxMjkxMH0.U6DOhRqbucP5ncR3_LqB_EUHL4kPgFR6sblVkIRl1bc"; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; const BaseAskCookbook = React.lazy(() => import("@cookbookdev/docsbot/react-fixed") ); -export default function AskCookbook() { +const { + siteConfig: {customFields}, +} = useDocusaurusContext(); +const {keys} = customFields; + +const CookbookPubKey = keys.cookbook; + +export default function AskCookbook() { return ( {() => ( - + )}