${list.title}
${list.desc}
-
${this.curatedPages[list.id] ? this.curatedPages[list.id].map((p) => html`
-
`) : html``}
import { LitElement, html, css } from 'lit-element'; import { wrapCss } from './misc'; import { unsafeHTML } from 'lit-html/directives/unsafe-html'; import marked from 'marked'; import { getTS } from './pageutils'; // =========================================================================== class CuratedLists extends LitElement { constructor() { super(); this.active = false; this.collInfo = null; this.query = ""; this.currList = "pages"; this.lists = []; this.curatedPages = {}; this.offset = 0; this.lastST = 0; this.clickTime = 0; this.hasNarrative = false; } static get properties() { return { active: { type: Boolean }, collInfo: { type: Object }, query: { type: String }, lists: { type: Array }, curatedPages: { type: Object }, currList: { type: String }, hasNarrative: { type: Boolean }, } } firstUpdated() { //this.doLoadCurated(); } updated(changedProperties) { if (changedProperties.has("collInfo")) { this.doLoadCurated(); } if (changedProperties.has("currList") || changedProperties.has("query")) { this.sendChangeEvent({ currList: this.currList, query: this.query }); } } async doLoadCurated() { this.hasNarrative = this.collInfo.desc || this.collInfo.numLists; if (!this.collInfo.numLists) { this.total = 0; this.curatedPages = {}; this.lists = []; this.currList = "pages"; return; } const resp = await fetch(`${this.collInfo.apiPrefix}/curatedPages?offset=${this.offset}&count=10000`); const json = await resp.json(); this.total = json.total; this.curatedPages = {}; this.lists = json.lists; for (const curated of json.curatedPages) { if (!this.curatedPages[curated.list]) { this.curatedPages[curated.list] = []; } this.curatedPages[curated.list].push(curated); } this.scrollToList(); } static get styles() { return wrapCss(css` :host { justify-content: flex-start; align-items: center; } .columns { width: 100%; justify-self: stretch; } .column.main-content { margin: 12px 0px 0px 0px; padding: 0px; max-height: calc(100% - 0.75em); display: flex; flex-direction: column; height: min-content; padding-left: 0.75em; } .column.main-content.main-scroll { padding-right: 0.75em; word-break: break-all; } .column.main-content.pages { height: calc(100% - 1.2em); } ul.menu-list a.is-active { background-color: #55be6f; } @media screen and (min-width: 768px) { .columns { max-height: 100%; height: 100%; margin-top: 0.75em; } .column.sidebar { max-height: 100%; overflow-y: auto; } } @media screen and (max-width: 767px) { .columns { position: relative; max-height: 100%; height: 100%; } .column.sidebar { max-height: 150px; overflow-y: auto; margin-top: 0.75em; } .column.main-content { position: relative; overflow-y: auto; border-top: 1px solid black; width: 100%; height: 100%; max-height: calc(100% - 150px - 0.75em); } .menu { font-size: 0.80rem; } } `); } render() { const currListNum = Number(this.currList); return html`
${list.desc}