(initialApiEndpoint.toString())
- const {getCookieConsent} = useCookieConsent()
- const cookieConsent = getCookieConsent()
-
const debouncedApiEndpoint = useDebouncedValue(inputValue, 500)
const apiEndpointInputClasses = `border border-solid border-tailCall-border-light-500 rounded-lg font-space-grotesk h-11 w-[100%]
p-SPACE_04 text-content-small outline-none focus:border-x-tailCall-light-700`
@@ -46,37 +38,7 @@ const Playground = () => {
}
}, [debouncedApiEndpoint])
- const graphQLFetcher = async (graphQLParams: FetcherParams, opts?: FetcherOpts) => {
- if (apiEndpoint.toString().trim() === "") {
- return Promise.resolve({})
- }
- analyticsHandler("GraphQL", "tc_fetch_query", apiEndpoint.toString())
- sendConversionEvent(playgroundAdsConversionId)
-
- const fetcher = createGraphiQLFetcher({url: apiEndpoint.toString()})
- return fetcher(graphQLParams, opts)
- }
-
- const emptyGraphiqlStorageObject = {
- getItem: (): null => null,
- setItem: (): void => undefined,
- removeItem: (): void => undefined,
- clear: (): void => undefined,
- length: 0,
- }
-
- const graphiqlStorage = useMemo(() => {
- if (
- cookieConsent?.accepted &&
- (!cookieConsent?.preferences || cookieConsent?.preferences?.includes(CookiePreferenceCategory.PREFERENCE))
- ) {
- // Defaults to local storage
- return undefined
- }
-
- // Block storing graphiql data in local storage if user denies cookie consent
- return emptyGraphiqlStorageObject
- }, [cookieConsent])
+ const endpointUrl = apiEndpoint.toString().trim()
return (
@@ -93,11 +55,11 @@ const Playground = () => {
/>
-
-
- <>>
-
-
+ {endpointUrl !== "" && (
+
+
+
+ )}
)}
diff --git a/src/components/playground/index.tsx b/src/components/playground/index.tsx
index 846c15cf5..93ca9b63e 100644
--- a/src/components/playground/index.tsx
+++ b/src/components/playground/index.tsx
@@ -1,6 +1,5 @@
import React from "react"
import Playground from "./Playground"
-import Announcement from "@site/src/components/shared/Announcement"
const PlaygroundPage = (): JSX.Element => {
return (
diff --git a/src/pages/playground.tsx b/src/pages/playground/app.tsx
similarity index 66%
rename from src/pages/playground.tsx
rename to src/pages/playground/app.tsx
index e38dbc11c..fed5b012b 100644
--- a/src/pages/playground.tsx
+++ b/src/pages/playground/app.tsx
@@ -1,15 +1,15 @@
import React, {useEffect} from "react"
import ReactGA from "react-ga4"
import Layout from "@theme/Layout"
-import PlaygroundPage from "../components/playground"
+import PlaygroundPage from "../../components/playground"
import {useLocation} from "@docusaurus/router"
-import {PageDescription, PageTitle} from "../constants/titles"
+import {PageDescription, PageTitle} from "../../constants/titles"
-const Playground = () => {
+const PlaygroundApp = () => {
const location = useLocation()
useEffect(() => {
- ReactGA.send({hitType: "pageview", page: location.pathname, title: "Playground Page"})
+ ReactGA.send({hitType: "pageview", page: location.pathname, title: "Playground App Page"})
}, [])
return (
@@ -19,4 +19,4 @@ const Playground = () => {
)
}
-export default Playground
+export default PlaygroundApp
diff --git a/static/playground/index.html b/static/playground/index.html
new file mode 100644
index 000000000..8f08ec0f2
--- /dev/null
+++ b/static/playground/index.html
@@ -0,0 +1,204 @@
+
+
+
+
+
+
+ Tailcall Playground
+
+
+
+
+
+
+
+ >
+ Tailcall
+
+ GraphQL Playground
+
+ Connect to a GraphQL endpoint without loading the full editor until you are ready.
+
+
+ Open empty playground
+
+
+
+
+