Skip to content

Commit

Permalink
Support slider_server_url in pluto_export.json (#2667)
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored Oct 30, 2023
1 parent 3b3d56c commit 74b497a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions frontend/components/welcome/Featured.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import { FeaturedCard } from "./FeaturedCard.js"
* source_url?: String,
* title?: String,
* description?: String,
* binder_url?: String,
* slider_server_url?: String,
* }}
*/

Expand Down Expand Up @@ -197,8 +199,7 @@ export const Featured = ({ sources, direct_html_links }) => {
<p>${coll.description}</p>
<div class="card-list">
${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} />`
)}
</div>
</div>
Expand Down
9 changes: 6 additions & 3 deletions frontend/components/welcome/FeaturedCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 74b497a

Please sign in to comment.