Mercurial > code > home > repos > front-door-display
comparison src/FdCountdown.ts @ 20:e8c90d893919
layout and sorting
author | drewp@bigasterisk.com |
---|---|
date | Mon, 26 Aug 2024 16:17:49 -0700 |
parents | 472003015880 |
children | a90cb6927c7d |
comparison
equal
deleted
inserted
replaced
19:6960c172f1a9 | 20:e8c90d893919 |
---|---|
1 import { LitElement, css, html } from "lit"; | 1 import { LitElement, css, html } from "lit"; |
2 import { customElement, property } from "lit/decorators.js"; | 2 import { customElement, property } from "lit/decorators.js"; |
3 import { sortBy } from "lodash"; | 3 import { sortBy, sortedUniqBy, uniqBy } from "lodash"; |
4 import { DataFactory, Quad_Subject, Store } from "n3"; | 4 import { DataFactory, Quad_Subject, Store } from "n3"; |
5 import { shared } from "./shared"; | 5 import { shared } from "./shared"; |
6 import { EV, fetchGraph, parseGraph, RDF } from "./parseRdf"; | 6 import { EV, fetchGraph, parseGraph, RDF } from "./parseRdf"; |
7 import { DisplayEvent } from "./DisplayEvent"; | 7 import { DisplayEvent } from "./DisplayEvent"; |
8 | 8 |
11 @customElement("fd-countdown") | 11 @customElement("fd-countdown") |
12 export class FdCountdown extends LitElement { | 12 export class FdCountdown extends LitElement { |
13 static styles = [ | 13 static styles = [ |
14 shared, | 14 shared, |
15 css` | 15 css` |
16 :host { | |
17 overflow: hidden; | |
18 } | |
16 ol { | 19 ol { |
17 list-style: none; | 20 list-style: none; |
18 font-size: 16px; | 21 font-size: 16px; |
19 } | 22 } |
20 span.d { | 23 span.d { |
63 this.evs = []; | 66 this.evs = []; |
64 store.getSubjects(namedNode(RDF + "type"), namedNode(EV + "Event"), graph).forEach((ev: Quad_Subject) => { | 67 store.getSubjects(namedNode(RDF + "type"), namedNode(EV + "Event"), graph).forEach((ev: Quad_Subject) => { |
65 const de = new DisplayEvent(store, graph, ev); | 68 const de = new DisplayEvent(store, graph, ev); |
66 this.evs = [...this.evs, de]; | 69 this.evs = [...this.evs, de]; |
67 }); | 70 }); |
68 this.evs = sortBy(this.evs, "start"); | 71 this.evs = sortedUniqBy(sortBy(this.evs, "start"), (de) => de.start + de.title); |
69 }); | 72 }); |
70 } | 73 } |
71 render() { | 74 render() { |
72 return html`<h1>Coming Soon</h1> | 75 return html`<h1>Coming Soon</h1> |
73 <ol> | 76 <ol> |