-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
70 lines (63 loc) · 2.26 KB
/
Copy pathindex.js
File metadata and controls
70 lines (63 loc) · 2.26 KB
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
import { sym } from 'rdflib'
import pane from '../src/folderPane.ts'
import './dev-global.css' // Import after src to override component styles
import { context, fetcher } from './context.js'
import { authn, authSession } from 'solid-logic'
import * as UI from 'solid-ui'
const loginBanner = document.getElementById('loginBanner')
const webId = document.getElementById('webId')
loginBanner.appendChild(UI.login.loginStatusBox(document, null, {}))
async function finishLogin () {
await authn.checkUser()
const session = authSession
const isLoggedIn = session?.info?.isLoggedIn ?? session?.isActive ?? Boolean(session?.webId)
if (isLoggedIn) {
// Update the page with the status.
webId.textContent = 'Logged in as: ' + authn.currentUser().uri
} else {
webId.textContent = ''
}
}
finishLogin()
const targetURIToShow = "https://testingsolidos.solidcommunity.net/"
// Dev fallback: folderPane expects an outliner implementation from tabulator.
// The full outliner is not wired in this standalone harness, so provide a
// minimal adapter with just the members folderPane uses.
context.getOutliner = () => ({
VIEWAS_boring_default: null,
propertyTR: (dom) => {
const tr = dom.createElement('tr')
tr.appendChild(dom.createElement('td'))
return tr
},
outlineObjectTD: (obj, _view, _unused, _st) => {
const td = document.createElement('td')
const a = document.createElement('a')
a.href = obj.uri
a.textContent = UI.utils.label(obj)
a.target = '_blank'
td.appendChild(a)
return td
},
GotoSubject: (subject, _expand, _pane, _solo, _referrer, table) => {
const tr = document.createElement('tr')
const td = document.createElement('td')
const a = document.createElement('a')
a.href = subject.uri
a.textContent = UI.utils.label(subject)
a.target = '_blank'
td.appendChild(a)
tr.appendChild(td)
table.appendChild(tr)
}
})
fetcher.load(targetURIToShow).then(() => {
const app = pane.render(sym(targetURIToShow), context)
document.getElementById('app').replaceWith(app)
}).catch(error => {
console.error('Error loading target URI:', error)
const appElement = document.getElementById('app')
if (appElement) {
appElement.textContent = 'Error loading data. Please check the console for details.'
}
})