UNPKG

solid-panes

Version:

Solid-compatible Panes: applets and views for the mashlib and databrowser

42 lines (41 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateHomepage = generateHomepage; var _ownerProfile = require("../profileUtils/ownerProfile"); async function generateHomepage(uri, store, fetcher) { const ownersProfile = await (0, _ownerProfile.loadProfileFromURI)(uri, store, fetcher); const name = (0, _ownerProfile.getName)(store, ownersProfile); const wrapper = document.createElement('div'); wrapper.classList.add('container'); wrapper.appendChild(createTitle(ownersProfile.uri, name)); wrapper.appendChild(createDataSection(name)); return wrapper; } function createDataSection(name) { const dataSection = document.createElement('section'); const title = document.createElement('h2'); title.innerText = 'Data'; dataSection.appendChild(title); const listGroup = document.createElement('div'); listGroup.classList.add('list-group'); dataSection.appendChild(listGroup); const publicDataLink = document.createElement('a'); publicDataLink.classList.add('list-group-item'); publicDataLink.href = window.document.location.href + 'public/'; publicDataLink.innerText = `View ${name}'s files`; listGroup.appendChild(publicDataLink); return dataSection; } function createTitle(uri, name) { const profileLink = document.createElement('a'); profileLink.href = uri; profileLink.innerText = name; const profileLinkPost = document.createElement('span'); profileLinkPost.innerText = '\'s Profile'; const title = document.createElement('h1'); title.appendChild(profileLink); title.appendChild(profileLinkPost); return title; }