MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / defaultHtmlContent

Function defaultHtmlContent

pages/news.ts:32–62  ·  view source on GitHub ↗
({ userArticles }: { userArticles: NewsFeedArticle[] })

Source from the content-addressed store, hash-verified

30}
31
32function defaultHtmlContent({ userArticles }: { userArticles: NewsFeedArticle[] }) {
33 return html`
34 <main id="main">
35 <section id="articles">
36 ${Loading()}
37 </section>
38 </main>
39
40 <script type="module">
41 import { h, render, Fragment } from 'preact';
42
43 // Imported files need some preact globals to work
44 window.h = h;
45 window.Fragment = Fragment;
46
47 import Articles from '/public/components/news/Articles.js';
48
49 const articlesElement = document.getElementById('articles');
50
51 if (articlesElement) {
52 const articlesApp = h(Articles, {
53 initialArticles: ${serializeForInlineScript(userArticles || [])},
54 });
55
56 render(articlesApp, articlesElement);
57
58 document.getElementById('loading')?.remove();
59 }
60 </script>
61 `;
62}
63
64export default page({
65 get,

Callers 1

getFunction · 0.70

Calls 2

serializeForInlineScriptFunction · 0.90
LoadingFunction · 0.50

Tested by

no test coverage detected