-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavbar.js
43 lines (39 loc) · 1.4 KB
/
navbar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { h } from 'h'
import { identify } from './identify.js'
import { imageSpan } from './profile.js'
import { bogbot } from 'bogbot'
import { composer } from './composer.js'
const composeButton = async () => {
if (await bogbot.pubkey()) {
return h('a', {href: '#',
classList: 'material-symbols-outlined',
onclick: async (e) => {
e.preventDefault()
const compose = await composer()
const scroller = document.getElementById('scroller')
scroller.insertBefore(compose, scroller.firstChild)
}
}, ['Edit_Square'])
} else { return h('span')}
}
export const navbar = async () => {
const div = h('div',
{id: 'navbar'},
[
h('a', {href: '#', classList: 'material-symbols-outlined'}, ['Home']),
' ',
await composeButton(),
' ',
h('a', {href: '#archive', classList: 'material-symbols-outlined'}, ['Archive']),
' ',
h('a', {href: '#settings', classList: 'material-symbols-outlined', style: 'float: right; margin-right: 25px;'}, ['Settings']),
h('a', {href: 'https://github.com/evbogue/wiredove', classList: 'material-symbols-outlined', style: 'float: right; margin-right: 5px;'}, ['Folder_Data'])
]
)
if (!await bogbot.keypair()) {
div.appendChild(await identify())
} else {
div.appendChild(h('a', {href: '#' + await bogbot.pubkey(), style: 'float: left;'}, [await imageSpan()]))
}
return div
}