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

Function defaultHtmlContent

pages/notes.ts:48–86  ·  view source on GitHub ↗
({ userDirectories, userNotes, currentPath }: {
  userDirectories: Directory[];
  userNotes: DirectoryFile[];
  currentPath: string;
})

Source from the content-addressed store, hash-verified

46}
47
48function defaultHtmlContent({ userDirectories, userNotes, currentPath }: {
49 userDirectories: Directory[];
50 userNotes: DirectoryFile[];
51 currentPath: string;
52}) {
53 const htmlContent = html`
54 <main id="main">
55 <section id="main-notes">
56 ${Loading()}
57 </section>
58 </main>
59
60 <script type="module">
61 import { h, render, Fragment } from 'preact';
62
63 // Imported files need some preact globals to work
64 window.h = h;
65 window.Fragment = Fragment;
66
67 import MainNotes from '/public/components/notes/MainNotes.js';
68
69 const mainNotesElement = document.getElementById('main-notes');
70
71 if (mainNotesElement) {
72 const mainNotesApp = h(MainNotes, {
73 initialDirectories: ${JSON.stringify(userDirectories || [])},
74 initialFiles: ${JSON.stringify(userNotes || [])},
75 initialPath: ${JSON.stringify(currentPath)},
76 });
77
78 render(mainNotesApp, mainNotesElement);
79
80 document.getElementById('loading')?.remove();
81 }
82 </script>
83 `;
84
85 return htmlContent;
86}
87
88export default page({
89 get,

Callers 1

getFunction · 0.70

Calls 1

LoadingFunction · 0.50

Tested by

no test coverage detected