From 74b497aa76b683f7caaa4d7d17dc757392750550 Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Mon, 30 Oct 2023 12:35:04 +0100 Subject: [PATCH] Support slider_server_url in pluto_export.json (#2667) --- frontend/components/welcome/Featured.js | 5 +++-- frontend/components/welcome/FeaturedCard.js | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/components/welcome/Featured.js b/frontend/components/welcome/Featured.js index 08f9a4e84b..e9970001c3 100644 --- a/frontend/components/welcome/Featured.js +++ b/frontend/components/welcome/Featured.js @@ -35,6 +35,8 @@ import { FeaturedCard } from "./FeaturedCard.js" * source_url?: String, * title?: String, * description?: String, + * binder_url?: String, + * slider_server_url?: String, * }} */ @@ -197,8 +199,7 @@ export const Featured = ({ sources, direct_html_links }) => {

${coll.description}

${collection(Object.values(data.notebooks), coll.tags ?? []).map( - (entry) => - html`<${FeaturedCard} entry=${entry} source_url=${data.source_url} direct_html_links=${direct_html_links} />` + (entry) => html`<${FeaturedCard} entry=${entry} source_manifest=${data} direct_html_links=${direct_html_links} />` )}
diff --git a/frontend/components/welcome/FeaturedCard.js b/frontend/components/welcome/FeaturedCard.js index b0d05c9192..00a33d9efd 100644 --- a/frontend/components/welcome/FeaturedCard.js +++ b/frontend/components/welcome/FeaturedCard.js @@ -9,14 +9,16 @@ const str_to_degree = (s) => ([...s].reduce((a, b) => a + b.charCodeAt(0), 0) * /** * @param {{ + * source_manifest: import("./Featured.js").SourceManifest, * entry: import("./Featured.js").SourceManifestNotebookEntry, - * source_url?: string, * direct_html_links: boolean, * }} props */ -export const FeaturedCard = ({ entry, source_url, direct_html_links }) => { +export const FeaturedCard = ({ entry, source_manifest, direct_html_links }) => { const title = entry.frontmatter?.title + const { source_url } = source_manifest + const u = (/** @type {string | null | undefined} */ x) => source_url == null ? x @@ -37,8 +39,9 @@ export const FeaturedCard = ({ entry, source_url, direct_html_links }) => { notebookfile: u(entry.notebookfile_path), notebookfile_integrity: `sha256-${base64url_to_base64(entry.hash)}`, disable_ui: `true`, - pluto_server_url: `.`, name: title == null ? null : `sample ${title}`, + pluto_server_url: `.`, + slider_server_url: u(source_manifest.slider_server_url), }) const author = author_info(entry.frontmatter)