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

Function defaultHtmlContent

pages/dashboard.ts:36–76  ·  view source on GitHub ↗
({ userDashboard }: { userDashboard: Dashboard })

Source from the content-addressed store, hash-verified

34}
35
36function defaultHtmlContent({ userDashboard }: { userDashboard: Dashboard }) {
37 const initialNotes = userDashboard?.data?.notes || 'Jot down some notes here.';
38
39 return html`
40 <main id="main">
41 ${Loading()}
42 <section id="links"></section>
43 <section id="notes"></section>
44 </main>
45
46 <script type="module">
47 import { h, render, Fragment } from 'preact';
48
49 // Imported files need some preact globals to work
50 window.h = h;
51 window.Fragment = Fragment;
52
53 import Links from '/public/components/dashboard/Links.js';
54 import Notes from '/public/components/dashboard/Notes.js';
55
56 const linksElement = document.getElementById('links');
57 const notesElement = document.getElementById('notes');
58
59 if (linksElement) {
60 const linksApp = h(Links, { initialLinks: ${JSON.stringify(userDashboard?.data?.links || [])} });
61
62 render(linksApp, linksElement);
63 }
64
65 if (notesElement) {
66 const notesApp = h(Notes, { initialNotes: ${JSON.stringify(initialNotes)} });
67
68 render(notesApp, notesElement);
69 }
70
71 if (linksElement && notesElement) {
72 document.getElementById('loading')?.remove();
73 }
74 </script>
75 `;
76}
77
78export default page({
79 get,

Callers 1

getFunction · 0.70

Calls 1

LoadingFunction · 0.50

Tested by

no test coverage detected