Skip to content

Commit c99e3d1

Browse files
committed
feat: replace graphiql with laboratory
1 parent 5f7eb2e commit c99e3d1

2 files changed

Lines changed: 27 additions & 19 deletions

File tree

bin/router/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use ntex::{
5050
};
5151
use tracing::{info, warn, Instrument};
5252

53-
static GRAPHIQL_HTML: &str = include_str!("../static/graphiql.html");
53+
static GRAPHIQL_HTML: &str = include_str!("../static/laboratory.html");
5454

5555
async fn graphql_endpoint_handler(
5656
request: HttpRequest,
Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
@@ -25,51 +25,59 @@
2525
type="image/x-icon"
2626
href="https://the-guild.dev/favicon.ico"
2727
/>
28-
<link
29-
crossorigin
30-
rel="stylesheet"
31-
href="https://unpkg.com/@graphql-yoga/graphiql/dist/graphiql.css"
32-
/>
28+
<style>
29+
html,
30+
body,
31+
#root {
32+
height: 100%;
33+
}
34+
35+
body {
36+
margin: 0;
37+
}
38+
</style>
3339
</head>
3440
<body id="body" class="no-focus-outline">
3541
<noscript>You need to enable JavaScript to run this app.</noscript>
36-
<div id="root">Loading GraphiQL...</div>
42+
<div id="root"></div>
3743
<script>
3844
function prepareBlob(workerContent) {
39-
const blob = new Blob([workerContent], { type: 'application/javascript' });
45+
const blob = new Blob([workerContent], {
46+
type: "application/javascript",
47+
});
4048
return URL.createObjectURL(blob);
4149
}
4250
const workers = {};
4351
const workerUrls = {
4452
editorWorkerService:
45-
'https://unpkg.com/@graphql-yoga/graphiql/dist/monacoeditorwork/editor.worker.bundle.js',
46-
json: 'https://unpkg.com/@graphql-yoga/graphiql/dist/monacoeditorwork/json.worker.bundle.js',
53+
"https://unpkg.com/@graphql-hive/laboratory@1.0.0-alpha-20260224193414-92a02da385cd5d3be81cf73fe81737e00836eacd/dist/monacoeditorwork/editor.worker.bundle.js",
54+
typescript:
55+
"https://unpkg.com/@graphql-hive/laboratory@1.0.0-alpha-20260224193414-92a02da385cd5d3be81cf73fe81737e00836eacd/dist/monacoeditorwork/ts.worker.bundle.js",
56+
json: "https://unpkg.com/@graphql-hive/laboratory@1.0.0-alpha-20260224193414-92a02da385cd5d3be81cf73fe81737e00836eacd/dist/monacoeditorwork/json.worker.bundle.js",
4757
graphql:
48-
'https://unpkg.com/@graphql-yoga/graphiql/dist/monacoeditorwork/graphql.worker..bundle.js',
58+
"https://unpkg.com/@graphql-hive/laboratory@1.0.0-alpha-20260224193414-92a02da385cd5d3be81cf73fe81737e00836eacd/dist/monacoeditorwork/graphql.worker..bundle.js",
4959
};
5060
function prepareWorkers() {
5161
return Promise.all(
5262
Object.entries(workerUrls).map(async ([label, url]) => {
5363
const res = await fetch(url);
5464
const text = await res.text();
5565
workers[label] = prepareBlob(text);
56-
}),
66+
})
5767
);
5868
}
59-
self['MonacoEnvironment'] = {
69+
self["MonacoEnvironment"] = {
6070
globalAPI: false,
6171
getWorkerUrl: function (moduleId, label) {
6272
return workers[label];
6373
},
6474
};
6575
</script>
66-
<script src="https://unpkg.com/@graphql-yoga/graphiql/dist/yoga-graphiql.umd.js"></script>
76+
<script src="https://unpkg.com/@graphql-hive/laboratory@1.0.0-alpha-20260224193414-92a02da385cd5d3be81cf73fe81737e00836eacd/dist/hive-laboratory.umd.js"></script>
6777
<script>
6878
prepareWorkers().finally(() => {
69-
YogaGraphiQL.renderYogaGraphiQL(root, {
70-
title: "Hive Router GraphiQL",
71-
});
79+
HiveLaboratory.renderLaboratory(root);
7280
});
7381
</script>
7482
</body>
75-
</html>
83+
</html>

0 commit comments

Comments
 (0)