Skip to content

Commit 4912154

Browse files
committed
added the cache pages
Signed-off-by: Fortune Ikechi <[email protected]>
1 parent 38db0a7 commit 4912154

11 files changed

+584
-35
lines changed

docs/sidebars.js

+244
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
/**
2+
* Creating a sidebar enables you to:
3+
- create an ordered group of docs
4+
- render a sidebar for each doc of that group
5+
- provide next/previous navigation
6+
7+
The sidebars can be generated from the filesystem, or explicitly defined here.
8+
9+
Create as many sidebars as you want.
10+
*/
11+
12+
// @ts-check
13+
14+
// /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
15+
const sidebars = {
16+
docs: [
17+
"Overview",
18+
"cli",
19+
{
20+
type: "category",
21+
label: "Platformatic Composer",
22+
collapsed: true,
23+
items: [
24+
"composer/overview",
25+
"composer/configuration",
26+
"composer/programmatic",
27+
"composer/api-modification",
28+
"composer/plugin",
29+
],
30+
},
31+
{
32+
type: "category",
33+
label: "Platformatic DB",
34+
collapsed: true,
35+
items: [
36+
"db/overview",
37+
"db/configuration",
38+
"db/migrations",
39+
{
40+
type: "category",
41+
label: "Authorization",
42+
collapsed: true,
43+
items: [
44+
"db/authorization/overview",
45+
"db/authorization/strategies",
46+
"db/authorization/user-roles-metadata",
47+
"db/authorization/rules",
48+
],
49+
},
50+
"db/plugin",
51+
"db/logging",
52+
"db/programmatic",
53+
"db/schema-support",
54+
],
55+
},
56+
{
57+
type: "category",
58+
label: "Platformatic Runtime",
59+
collapsed: true,
60+
items: [
61+
"runtime/overview",
62+
"runtime/configuration",
63+
"runtime/programmatic",
64+
],
65+
},
66+
{
67+
type: "category",
68+
label: "Watt",
69+
collapsed: true,
70+
items: ["watt/overview", "watt/configuration", "watt/reference"],
71+
},
72+
{
73+
type: "category",
74+
label: "Platformatic Service",
75+
collapsed: true,
76+
items: [
77+
"service/overview",
78+
"service/configuration",
79+
"service/plugin",
80+
"service/programmatic",
81+
],
82+
},
83+
{
84+
type: "category",
85+
label: "Client",
86+
collapsed: true,
87+
items: ["client/overview", "client/programmatic", "client/frontend"],
88+
},
89+
{
90+
type: "category",
91+
label: "Packages",
92+
collapsed: true,
93+
items: [
94+
{
95+
type: "category",
96+
label: "Node",
97+
collapsed: true,
98+
items: ["packages/node/overview", "packages/node/configuration"],
99+
},
100+
{
101+
type: "category",
102+
label: "Astro",
103+
collapsed: true,
104+
items: ["packages/astro/overview", "packages/astro/configuration"],
105+
},
106+
{
107+
type: "category",
108+
label: "Next",
109+
collapsed: true,
110+
items: ["packages/next/overview", "packages/next/configuration"],
111+
},
112+
{
113+
type: "category",
114+
label: "Remix",
115+
collapsed: true,
116+
items: ["packages/remix/overview", "packages/remix/configuration"],
117+
},
118+
{
119+
type: "category",
120+
label: "Vite",
121+
collapsed: true,
122+
items: ["packages/vite/overview", "packages/vite/configuration"],
123+
},
124+
{
125+
type: "category",
126+
label: "SQL-to-OpenAPI",
127+
collapsed: true,
128+
items: [
129+
"packages/sql-openapi/overview",
130+
"packages/sql-openapi/api",
131+
"packages/sql-openapi/ignore",
132+
"packages/sql-openapi/explicit-include",
133+
],
134+
},
135+
{
136+
type: "category",
137+
label: "SQL-to-GraphQL",
138+
collapsed: true,
139+
items: [
140+
"packages/sql-graphql/overview",
141+
"packages/sql-graphql/queries",
142+
"packages/sql-graphql/mutations",
143+
"packages/sql-graphql/many-to-many",
144+
"packages/sql-graphql/ignore",
145+
],
146+
},
147+
{
148+
type: "category",
149+
label: "SQL-Mapper",
150+
collapsed: true,
151+
items: [
152+
"packages/sql-mapper/overview",
153+
"packages/sql-mapper/fastify-plugin",
154+
{
155+
type: "category",
156+
label: "Entities",
157+
collapsed: true,
158+
items: [
159+
"packages/sql-mapper/entities/overview",
160+
"packages/sql-mapper/entities/fields",
161+
"packages/sql-mapper/entities/api",
162+
"packages/sql-mapper/entities/example",
163+
"packages/sql-mapper/entities/hooks",
164+
"packages/sql-mapper/entities/relations",
165+
"packages/sql-mapper/entities/transactions",
166+
],
167+
},
168+
],
169+
},
170+
{
171+
type: "category",
172+
label: "SQL-Events",
173+
collapsed: true,
174+
items: [
175+
"packages/sql-events/overview",
176+
"packages/sql-events/fastify-plugin",
177+
],
178+
},
179+
],
180+
},
181+
182+
"FAQs",
183+
],
184+
Learn: [
185+
"learn/overview",
186+
"getting-started/quick-start-watt",
187+
"getting-started/quick-start-guide",
188+
{
189+
type: "category",
190+
label: "Beginner Tutorials",
191+
collapsed: true,
192+
items: ["learn/beginner/crud-application"],
193+
},
194+
{
195+
type: "category",
196+
label: "Advanced Guides",
197+
collapsed: true,
198+
items: [
199+
{
200+
type: "category",
201+
label: "Deployment",
202+
collapsed: true,
203+
items: [
204+
"guides/deployment/overview",
205+
"guides/deployment/dockerize-a-watt-app",
206+
"guides/deployment/deploy-to-fly-io-with-sqlite",
207+
"guides/deployment/advanced-fly-io-deployment",
208+
"guides/deployment/deploying-on-lambda",
209+
],
210+
},
211+
"guides/seed-a-database",
212+
{
213+
type: "category",
214+
label: "Add Custom Functionality",
215+
collapsed: true,
216+
items: [
217+
"guides/add-custom-functionality/overview",
218+
"guides/add-custom-functionality/prerequisites",
219+
"guides/add-custom-functionality/extend-graphql",
220+
"guides/add-custom-functionality/extend-rest",
221+
],
222+
},
223+
"guides/securing-platformatic-db",
224+
"guides/jwt-auth0",
225+
"guides/monitoring",
226+
"guides/debug-platformatic-db",
227+
"guides/environment-variables",
228+
"guides/prisma",
229+
"guides/generate-frontend-code-to-consume-platformatic-rest-api",
230+
"guides/migrating-fastify-app-to-platformatic-service",
231+
"guides/migrating-express-app-to-platformatic-service",
232+
"guides/telemetry",
233+
"guides/build-modular-monolith",
234+
"guides/logging-to-elasticsearch",
235+
"guides/jwt-keycloak",
236+
"guides/use-env-with-platformatic",
237+
],
238+
},
239+
"learn/glossary",
240+
"FAQs",
241+
],
242+
};
243+
244+
module.exports = sidebars;

docusaurus.config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const config = {
4141
locales: ["en"],
4242
},
4343

44-
4544
presets: [
4645
[
4746
"classic",
@@ -202,7 +201,7 @@ const config = {
202201
to: "/composer",
203202
label: "Composer",
204203
},
205-
204+
206205
{
207206
to: "/aiwarp",
208207
label: "AI-Warp",
@@ -219,6 +218,10 @@ const config = {
219218
to: "/watt",
220219
label: "Watt",
221220
},
221+
{
222+
to: "/caching",
223+
label: "Caching",
224+
},
222225
],
223226
},
224227
{

sidebars.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,4 @@
249249
"learn/glossary",
250250
"FAQs"
251251
]
252-
}
252+
}

src/components/HubSpotForm.js

+44-30
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import React, { useEffect } from 'react'
1+
import React, { useEffect, useState } from "react";
22

33
const HubSpotForm = ({
44
portalId,
55
formId,
66
targetId,
7-
region = 'na1',
8-
cssClass = 'light-mode'
7+
region = "na1",
8+
cssClass = "light-mode",
99
}) => {
10+
const [loading, setLoading] = useState(true);
11+
1012
useEffect(() => {
11-
const script = document.createElement('script')
12-
script.src = 'https://js.hsforms.net/forms/v2.js'
13-
document.body.appendChild(script)
13+
const script = document.createElement("script");
14+
script.src = "https://js.hsforms.net/forms/v2.js";
15+
document.body.appendChild(script);
1416

15-
script.addEventListener('load', () => {
17+
script.addEventListener("load", () => {
18+
setLoading(false);
1619
if (window.hbspt) {
1720
window.hbspt.forms.create({
1821
portalId,
@@ -21,53 +24,64 @@ const HubSpotForm = ({
2124
region,
2225
cssClass,
2326
onFormReady: function ($form) {
24-
const iframe = document.querySelector('iframe')
27+
const iframe = document.querySelector("iframe");
2528
if (iframe) {
2629
const observer = new MutationObserver(
2730
(mutationsList, observer) => {
2831
for (const mutation of mutationsList) {
2932
if (
30-
mutation.type === 'childList' &&
33+
mutation.type === "childList" &&
3134
iframe.contentDocument
3235
) {
3336
const doc =
3437
iframe.contentDocument ||
35-
iframe.contentWindow?.document
38+
iframe.contentWindow?.document;
3639
if (doc) {
3740
// Set the background color of the iframe's body
38-
doc.body.style.backgroundColor = '#040607'
41+
doc.body.style.backgroundColor = "#040607";
3942

40-
const labels = doc.querySelectorAll('label')
43+
const labels = doc.querySelectorAll("label");
4144
labels.forEach((label) => {
42-
label.style.color = '#ffffff'
43-
})
44-
observer.disconnect() // Stop observing after labels and background are adjusted
45+
label.style.color = "#ffffff";
46+
});
47+
observer.disconnect(); // Stop observing after labels and background are adjusted
4548
}
4649
}
4750
}
4851
}
49-
)
52+
);
5053

5154
observer.observe(iframe.contentDocument, {
5255
childList: true,
53-
subtree: true
54-
})
56+
subtree: true,
57+
});
5558
} else {
56-
console.error('Iframe not found.')
59+
console.error("Iframe not found.");
5760
}
58-
}
59-
})
61+
},
62+
});
6063
} else {
61-
console.error('hbspt not available.')
64+
console.error("hbspt not available.");
6265
}
63-
})
66+
});
67+
68+
script.addEventListener("error", () => {
69+
setLoading(false);
70+
console.error("Failed to load the script.");
71+
});
72+
}, [portalId, formId, targetId, region, cssClass]);
6473

65-
script.addEventListener('error', () => {
66-
console.error('Failed to load the script.')
67-
})
68-
}, [portalId, formId, targetId, region, cssClass])
74+
if (loading) {
75+
return (
76+
<div className="d-flex justify-content-center">
77+
<div className="spinner-border" role="status">
78+
<span className="visually-hidden">Loading...</span>
79+
</div>
80+
</div>
81+
);
82+
}
6983

70-
return <div id={targetId} />
71-
}
84+
return <div id={targetId} />;
85+
};
7286

73-
export default HubSpotForm
87+
export default HubSpotForm;

0 commit comments

Comments
 (0)