docs: add sanity bearing additions

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9423
GitOrigin-RevId: 7ba96b5fb1431267530673f86ac6685d4a408b0d
This commit is contained in:
Rob Dominguez 2023-06-12 07:18:05 -05:00 committed by hasura-bot
parent a53ab33330
commit 9e3c813b7e
2 changed files with 13 additions and 12 deletions

View File

@ -53,8 +53,10 @@ export const Feedback = ({ metadata }: { metadata: any }) => {
.catch(error => console.error('error', error));
};
if (window.location.hostname === 'localhost') {
alert('Testing feedback (not) sent!');
if (window.location.hostname != 'hasura.io' || window.location.hostname != 'stage.hasura.io') {
alert(
'Hey! We like that you like our docs and chose to use them 🎉\n\nHowever, you might want to remove the feedback component or modify the route you hit, lest you want us reading what people think of your site ✌️'
);
setRating(null);
setNotes(null);
setIsSubmitSuccess(true);

View File

@ -1,13 +1,18 @@
import React from 'react';
import GraphiQL from 'graphiql';
import useIsBrowser from '@docusaurus/useIsBrowser';
import cslx from 'clsx';
import { createGraphiQLFetcher } from '@graphiql/toolkit';
import 'graphiql/graphiql.min.css';
import './styles.scss';
const GraphiQLIDE = ({ query, variables, response, viewOnly = true }) => {
const isBrowser = useIsBrowser();
const notReal = async ({ query }) => {
return {
data: {
easterEgg: `This query and response is for demo purposes only. Running it doesn't actually hit an API. Refresh the page to see the original response.`,
},
};
};
return (
<div
className={`graphiql ${cslx({
@ -19,13 +24,7 @@ const GraphiQLIDE = ({ query, variables, response, viewOnly = true }) => {
readOnly={false}
editorTheme={'dracula'}
schema={null}
fetcher={
isBrowser
? createGraphiQLFetcher({
url: 'https://hasura.io/graphql', // TODO: update later
})
: () => null
}
fetcher={notReal}
query={query}
variables={variables}
response={response}