diff --git a/lib/rich-text.tsx b/lib/rich-text.tsx
index 5ade7cc3..43461662 100644
--- a/lib/rich-text.tsx
+++ b/lib/rich-text.tsx
@@ -5,6 +5,7 @@ import { Asset, Entry, Content } from "../types/shared";
import Link from "next/link";
import { ArticleShowPreview } from "../components/showPreview";
import Pill from "../components/pill";
+import { useEffect, useState } from "react";
interface EmbeddedAssetBlock extends Block {
data: {
target: {
@@ -21,7 +22,15 @@ const getAssetById = (id: string, assets: Asset[]) =>
const getEntryById = (id: string, assets: Entry[]) =>
assets.filter((asset) => asset.sys.id === id).pop();
-export function renderRichTextWithImages(content: Content) {
+export function RenderRichTextWithImages(content: Content) {
+ const [loaded, setLoaded] = useState(false);
+ useEffect(() => {
+ const scriptTag = document.createElement("script");
+ scriptTag.src = "https://tally.so/widgets/embed.js";
+ scriptTag.addEventListener("load", () => setLoaded(true));
+ document.body.appendChild(scriptTag);
+ }, []);
+
if (content.links) {
const blockAssets = content.links.assets.block;
const blockEntries = content.links?.entries?.block;
@@ -58,11 +67,10 @@ export function renderRichTextWithImages(content: Content) {
return (
);
diff --git a/pages/about.tsx b/pages/about.tsx
index 3e5cbe53..48ce34fc 100644
--- a/pages/about.tsx
+++ b/pages/about.tsx
@@ -3,7 +3,7 @@ import Layout from "../components/layout";
import Prose from "../components/Prose";
import PageMeta from "../components/seo/page";
import { getAboutPage } from "../lib/contentful/pages/about";
-import { renderRichTextWithImages } from "../lib/rich-text";
+import { RenderRichTextWithImages } from "../lib/rich-text";
import SinglePage from "../views/singlePage";
export async function getStaticProps({ preview = false }) {
@@ -28,7 +28,7 @@ export default function AboutPage({
-
{renderRichTextWithImages(content)}
+
{RenderRichTextWithImages(content)}
diff --git a/pages/access.tsx b/pages/access.tsx
index 7694ceb5..5287e924 100644
--- a/pages/access.tsx
+++ b/pages/access.tsx
@@ -3,7 +3,7 @@ import Layout from "../components/layout";
import Prose from "../components/Prose";
import PageMeta from "../components/seo/page";
import { getAccessPage } from "../lib/contentful/pages/access";
-import { renderRichTextWithImages } from "../lib/rich-text";
+import { RenderRichTextWithImages } from "../lib/rich-text";
import SinglePage from "../views/singlePage";
export async function getStaticProps({ preview = false }) {
@@ -28,7 +28,7 @@ export default function AccessPage({
-
{renderRichTextWithImages(content)}
+
{RenderRichTextWithImages(content)}
diff --git a/pages/imprint.tsx b/pages/imprint.tsx
index 54d21ed2..474ae0e9 100644
--- a/pages/imprint.tsx
+++ b/pages/imprint.tsx
@@ -3,7 +3,7 @@ import Layout from "../components/layout";
import Prose from "../components/Prose";
import PageMeta from "../components/seo/page";
import { getImprintPage } from "../lib/contentful/pages/imprint";
-import { renderRichTextWithImages } from "../lib/rich-text";
+import { RenderRichTextWithImages } from "../lib/rich-text";
import SinglePage from "../views/singlePage";
export async function getStaticProps({ preview = false }) {
@@ -28,7 +28,7 @@ export default function AccessPage({
-
{renderRichTextWithImages(content)}
+
{RenderRichTextWithImages(content)}
diff --git a/pages/values.tsx b/pages/values.tsx
index ce081a72..ed37491b 100644
--- a/pages/values.tsx
+++ b/pages/values.tsx
@@ -3,7 +3,7 @@ import Layout from "../components/layout";
import Prose from "../components/Prose";
import PageMeta from "../components/seo/page";
import { getValuesPage } from "../lib/contentful/pages/values";
-import { renderRichTextWithImages } from "../lib/rich-text";
+import { RenderRichTextWithImages } from "../lib/rich-text";
import SinglePage from "../views/singlePage";
export async function getStaticProps({ preview = false }) {
@@ -28,7 +28,7 @@ export default function ValuesPage({
-
{renderRichTextWithImages(content)}
+
{RenderRichTextWithImages(content)}
diff --git a/pages/workshops/[slug].tsx b/pages/workshops/[slug].tsx
index a5cb8319..e952b9c1 100644
--- a/pages/workshops/[slug].tsx
+++ b/pages/workshops/[slug].tsx
@@ -4,7 +4,7 @@ import Prose from "../../components/Prose";
import WorkshopMeta from "../../components/seo/workshop";
import { getWorkshopPageSingle } from "../../lib/contentful/pages/workshops";
import { getWorkshopPathsToPreRender } from "../../lib/contentful/paths";
-import { renderRichTextWithImages } from "../../lib/rich-text";
+import { RenderRichTextWithImages } from "../../lib/rich-text";
import SinglePage from "../../views/singlePage";
import Script from "next/script";
@@ -28,7 +28,7 @@ export default function Workshop({
-
{renderRichTextWithImages(workshop.content)}
+
{RenderRichTextWithImages(workshop.content)}