/
dashboardPane.tsx
53 lines (47 loc) · 1.49 KB
/
dashboardPane.tsx
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
import React from 'react'
import ReactDOM from 'react-dom'
import $rdf from 'rdflib'
import UI from 'solid-ui'
import panes from 'pane-registry'
import { Wrapper } from './wrapper'
import { PaneDefinition } from '../types'
const HomePane: PaneDefinition = {
icon: UI.icons.iconBase + 'noun_547570.svg', // noun_25830
name: 'dashboard',
label: function () {
if (`${location.origin}/` === location.href) {
return 'Dashboard'
}
return null
},
render: function (subject, dom) {
const container = document.createElement('div')
const shadow = document.createElement('div')
container.appendChild(shadow)
const wrapper = document.createElement('div')
shadow.appendChild(wrapper)
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = 'https://design.inrupt.com/css/main.css'
shadow.appendChild(link)
const loadResource = (resourcePath: string) => {
panes.getOutliner(dom).GotoSubject($rdf.sym(resourcePath), true, undefined, true)
}
// TODO: Update the value of WebID when the user logs in/out:
UI.authn.solidAuthClient.currentSession().then((session: any) => {
ReactDOM.render(
<Wrapper
store={UI.store}
fetcher={UI.store.fetcher}
updater={UI.store.updater}
loadResource={loadResource}
webId={session ? session.webId : undefined}
/>,
wrapper
)
})
return container
}
} // pane object
// ends
export default HomePane