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

Function defaultHtmlContent

pages/photos.ts:53–89  ·  view source on GitHub ↗
({ userDirectories, userPhotos, currentPath }: {
  userDirectories: Directory[];
  userPhotos: DirectoryFile[];
  currentPath: string;
})

Source from the content-addressed store, hash-verified

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

Callers 1

getFunction · 0.70

Calls 1

LoadingFunction · 0.50

Tested by

no test coverage detected