Notes2/views/pages/notes2.gotmpl

36 lines
839 B
Go Template
Raw Permalink Normal View History

2024-11-28 18:11:14 +01:00
{{ define "page" }}
2024-12-03 06:53:31 +01:00
<div id="notes2"></div>
2024-11-29 09:15:42 +01:00
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/notes2.css">
2024-11-28 18:11:14 +01:00
<script type="module">
import { h, Component, render, createRef } from 'preact'
import htm from 'htm'
{{ if .Data._dev -}}
import 'preact/debug'
import 'preact/devtools'
{{- end }}
2024-11-30 17:10:46 +01:00
import { NodeStore } from 'node_store'
2024-12-03 22:08:45 +01:00
import { Notes2 } from "/js/{{ .VERSION }}/notes2.mjs"
2024-11-28 18:11:14 +01:00
import { API } from 'api'
2024-12-04 16:16:03 +01:00
import { Sync } from 'sync'
window.Sync = Sync
2024-11-28 18:11:14 +01:00
if (!API.hasAuthenticationToken()) {
location.href = '/login'
} else {
const html = htm.bind(h)
2024-11-30 17:10:46 +01:00
try {
window.nodeStore = new NodeStore()
window.nodeStore.initializeDB().then(() => {
window._notes2 = createRef()
2024-12-03 06:53:31 +01:00
render(html`<${Notes2} ref=${window._notes2} />`, document.getElementById('notes2'))
2024-11-30 17:10:46 +01:00
})
} catch (e) {
alert(e)
}
2024-11-28 18:11:14 +01:00
}
</script>
{{ end }}