-
Notifications
You must be signed in to change notification settings - Fork 42
/
homePane.source.ts
82 lines (71 loc) · 2.4 KB
/
homePane.source.ts
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Home Pane
**
** The home pane is avaiable everywhere and allows a user
** to
** - keep track of their stuff
** - make new things, and possibly
** - keep track of accounts and workspaces etc
**
*/
import { authn, create, icons } from 'solid-ui'
import { PaneDefinition } from 'pane-registry'
const HomePaneSource: PaneDefinition = {
icon: icons.iconBase + 'noun_547570.svg', // noun_25830
global: true,
name: 'home',
// Does the subject deserve an home pane?
//
// yes, always!
//
label: function () {
return 'home'
},
render: function (subject, context) {
const dom = context.dom
var showContent = async function () {
var homePaneContext = { div: div, dom: dom, statusArea: div, me: me }
/*
div.appendChild(dom.createElement('h4')).textContent = 'Login status'
var loginStatusDiv = div.appendChild(context.dom.createElement('div'))
// TODO: Find out what the actual type is:
type UriType = unknown;
loginStatusDiv.appendChild(UI.authn.loginStatusBox(context.dom, () => {
// Here we know new log in status
}))
*/
div.appendChild(dom.createElement('h4')).textContent =
'Create new thing somewhere'
var creationDiv = div.appendChild(dom.createElement('div'))
var creationContext = {
div: creationDiv,
dom: dom,
statusArea: div,
me: me
}
const relevantPanes = await authn.filterAvailablePanes(
context.session.paneRegistry.list
)
create.newThingUI(creationContext, context, relevantPanes) // newUI Have to pass panes down
div.appendChild(dom.createElement('h4')).textContent = 'Private things'
// TODO: Replace by a common, representative interface
authn
.registrationList(homePaneContext, { private: true })
.then(function (authContext) {
div.appendChild(dom.createElement('h4')).textContent = 'Public things'
div.appendChild(dom.createElement('p')).textContent =
'Things in this list are visible to others.'
authn
.registrationList(authContext, { public: true })
.then(function () {
// done
})
})
}
var div = dom.createElement('div')
var me = authn.currentUser()
showContent()
return div
}
} // pane object
// ends
export default HomePaneSource