diff --git a/package-lock.json b/package-lock.json
index 875827e..bd3eec5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,6 +15,7 @@
"@tabler/icons-react": "^3.22.0",
"astro": "^4.16.13",
"luxon": "^3.5.0",
+ "minisearch": "7.1.0",
"rehype-prism-plus": "2.0.0",
"rehype-stringify": "10.0.1",
"remark": "15.0.1",
@@ -5832,6 +5833,12 @@
"node": ">=16.13"
}
},
+ "node_modules/minisearch": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-7.1.0.tgz",
+ "integrity": "sha512-tv7c/uefWdEhcu6hvrfTihflgeEi2tN6VV7HJnCjK6VxM75QQJh4t9FwJCsA2EsRS8LCnu3W87CuGPWMocOLCA==",
+ "license": "MIT"
+ },
"node_modules/mri": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
diff --git a/package.json b/package.json
index 5f08242..f6bb2ab 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
"@tabler/icons-react": "^3.22.0",
"astro": "^4.16.13",
"luxon": "^3.5.0",
+ "minisearch": "7.1.0",
"rehype-prism-plus": "2.0.0",
"rehype-stringify": "10.0.1",
"remark": "15.0.1",
diff --git a/src/components/blocks/BlockRenderer.astro b/src/components/blocks/BlockRenderer.astro
index 2ac4255..6f445bb 100644
--- a/src/components/blocks/BlockRenderer.astro
+++ b/src/components/blocks/BlockRenderer.astro
@@ -15,33 +15,65 @@ import YouTubePlayer from "@components/blocks//YouTubePlayer.astro";
import { md } from "@utils/helpers/general.js";
import { getPopularPosts } from "@utils/getPopularPosts.js";
-const analytics = await fetchAnalyticsData();
-const links = await fetchLinks();
-const posts = await fetchAllPosts();
+const [analytics, links, posts] = await Promise.all([
+ fetchAnalyticsData(),
+ fetchLinks(),
+ fetchAllPosts(),
+]);
const popularPosts = getPopularPosts(posts, analytics);
-const { block } = Astro.props;
+const { blocks } = Astro.props;
+const processedBlocks = await Promise.all(
+ blocks.map(async (block) => {
+ if (block.type === "markdown") {
+ return {
+ ...block,
+ html: await md(block.text),
+ };
+ }
+ if (block.type === "divider") {
+ return {
+ ...block,
+ html: await md(block.markup),
+ };
+ }
+ return block;
+ })
+);
+
---
-{
- block.type === "addon_links" && (
-
- )
-}
+
+ {
+ processedBlocks.map((block) => (
+ <>
+ {block.type === "addon_links" && (
+
+ )}
-{block.type === "associated_media" &&
}
+ {block.type === "associated_media" && (
+
+ )}
-{block.type === "divider" &&
}
+ {block.type === "divider" &&
}
-{block.type === "github_banner" &&
}
+ {block.type === "github_banner" &&
}
-{block.type === "hero" &&
}
+ {block.type === "hero" &&
}
-{block.type === "markdown" &&
}
+ {block.type === "markdown" &&
}
-{block.type === "npm_banner" &&
}
+ {block.type === "npm_banner" && (
+
+ )}
-{block.type === "modal" &&
}
+ {block.type === "modal" &&
}
-{block.type === "rss_banner" &&
}
+ {block.type === "rss_banner" && (
+
+ )}
-{block.type === "youtube_player" &&
}
+ {block.type === "youtube_player" &&
}
+ >
+ ))
+ }
+
diff --git a/src/components/home/RecentActivity.astro b/src/components/home/RecentActivity.astro
index 0884455..c9b873c 100644
--- a/src/components/home/RecentActivity.astro
+++ b/src/components/home/RecentActivity.astro
@@ -8,12 +8,13 @@ import { IconActivity } from "@tabler/icons-react";
import Rss from "@components/blocks/banners/Rss.astro";
-const music = await fetchMusicData();
-const tv = await fetchShows();
-const movies = await fetchMovies();
-const books = await fetchBooks();
-const links = await fetchLinks();
-
+const [music, tv, movies, books, links] = await Promise.all([
+ fetchMusicData(),
+ fetchShows(),
+ fetchMovies(),
+ fetchBooks(),
+ fetchLinks(),
+]);
const track = music.week?.tracks[0];
const show = tv.recentlyWatched[0];
const movie = movies.recentlyWatched[0];
@@ -34,7 +35,8 @@ const link = links[0];