# HG changeset patch
# User drewp@bigasterisk.com
# Date 2022-06-06 01:15:17
# Node ID 197a4ec877a752b6e37cea42475318adc8ede225
# Parent 40475b0ee0ba183461bd52090719840fedc78257
acso relayout so only the song list scrolls
diff --git a/light9/ascoltami/Light9AscoltamiUi.ts b/light9/ascoltami/Light9AscoltamiUi.ts
--- a/light9/ascoltami/Light9AscoltamiUi.ts
+++ b/light9/ascoltami/Light9AscoltamiUi.ts
@@ -9,7 +9,6 @@ import { PlainViewState } from "../web/L
import { getTopGraph } from "../web/RdfdbSyncedGraph";
import { SyncedGraph } from "../web/SyncedGraph";
import { TimingUpdate } from "./main";
-import { ResourceDisplay } from '../web/ResourceDisplay';
export { Light9TimelineAudio } from "../web/light9-timeline-audio";
export { Light9CursorCanvas } from "../web/Light9CursorCanvas";
export { RdfdbSyncedGraph } from "../web/RdfdbSyncedGraph";
@@ -37,13 +36,17 @@ export class Light9AscoltamiUi extends L
@property() isPlaying: boolean = false;
@property() show: NamedNode | null = null;
@property() song: NamedNode | null = null;
- @property() requestedSong: NamedNode | null = null;
+ @property() selectedSong: NamedNode | null = null;
@property() currentDuration: number = 0;
@property() zoom: Zoom;
@property() overviewZoom: Zoom;
@property() viewState: PlainViewState | null = null;
static styles = [
css`
+ :host {
+ display: flex;
+ flex-direction: column;
+ }
.timeRow {
margin: 14px;
position: relative;
@@ -62,52 +65,158 @@ export class Light9AscoltamiUi extends L
width: 100%;
height: 100%;
}
+ #grow {
+
+ flex: 1 1 auto;
+ display: flex;
+
+ }
+ #grow > span {
+ display: flex;
+ position: relative;
+ width:50%;
+ }
+ #playSelected {
+ height:100px;
+ }
+ #songList {
+ overflow-y: scroll;
+ position: absolute;
+ left:0;top:0;right:0;bottom:0;
+ }
+ #songList .row {
+ width: 60%;
+ min-height: 40px;
+ text-align: left;
+ position: relative;
+ }
+ #songList .row:nth-child(even) {background: #333;}
+ #songList .row:nth-child(odd) {background: #444;}
+ #songList button {
+ min-height: 40px;
+ margin-bottom: 10px;
+ }
+ #songList .row.playing {
+ box-shadow: 0 0 30px red;
+ background-color: #de5050;
+ }
`,
];
render() {
return html`
-
-
-
-
-
+
-
-
-
-
-
-
-
`;
+
+
+
+
+
+
+ ${this.songList.map(
+ (song) => html`
+
+ |
+
+
+ |
+
+ `
+ )}
+
+
+
+
+
+
+ Selected:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`;
+ }
+
+ onSelectSong(song: NamedNode, ev: MouseEvent) {
+ if (this.selectedSong && song.equals(this.selectedSong)) {
+ this.selectedSong = null;
+ } else {
+ this.selectedSong = song;
+ }
+ }
+ async onPlaySelected(ev: Event) {
+ if (!this.selectedSong) {
+ return;
+ }
+ await fetch("api/song", { method: "POST", body: this.selectedSong.value });
}
onCmdStop(ev?: MouseEvent): void {
@@ -120,7 +229,10 @@ export class Light9AscoltamiUi extends L
postJson("api/time", { t: this.times.intro, resume: true });
}
onCmdPost(ev?: MouseEvent): void {
- postJson("api/time", { t: this.currentDuration - this.times.post, resume: true });
+ postJson("api/time", {
+ t: this.currentDuration - this.times.post,
+ resume: true,
+ });
}
onCmdGo(ev?: MouseEvent): void {
postJson("api/go", {});
@@ -162,9 +274,7 @@ export class Light9AscoltamiUi extends L
try {
const h1 = document.querySelector("h1")!;
h1.innerText = h1.innerText.replace("{{host}}", config.host);
- } catch (e) {
-
- }
+ } catch (e) {}
byId("nav").innerText = navigator.userAgent;
var updateFreq = navigator.userAgent.indexOf("Linux") != -1 ? 10 : 2;
if (navigator.userAgent.match(/Windows NT/)) {
@@ -173,31 +283,40 @@ export class Light9AscoltamiUi extends L
}
byId("updateReq").innerText = "" + updateFreq;
- (window as any).finishOldStyleSetup(this.times, updateFreq, (data: TimingUpdate) => {
- this.nextText = data.next;
- this.isPlaying = data.playing;
- this.currentDuration = data.duration;
- this.song = new NamedNode(data.song);
- this.overviewZoom = { duration: data.duration, t1: 0, t2: data.duration };
- const t1 = data.t - 2,
- t2 = data.t + 20;
- this.zoom = { duration: data.duration, t1, t2 };
- const timeRow = this.shadowRoot!.querySelector(".timeRow") as HTMLDivElement;
- const w = timeRow.offsetWidth;
- this.viewState = {
- zoomSpec: { t1: () => t1, t2: () => t2 },
- cursor: { t: () => data.t },
- audioY: () => 0,
- audioH: () => 60,
- zoomedTimeY: () => 60,
- zoomedTimeH: () => 40,
- fullZoomX: (sec: number) => (sec / data.duration) * w,
- zoomInX: (sec: number) => ((sec - t1) / (t2 - t1)) * w,
- mouse: { pos: () => $V([0, 0]) },
- };
- });
+ (window as any).finishOldStyleSetup(
+ this.times,
+ updateFreq,
+ this.onOldStyleUpdate.bind(this)
+ );
}
- @property() songList: NamedNode[] = []
+
+ onOldStyleUpdate(data: TimingUpdate) {
+ this.nextText = data.next;
+ this.isPlaying = data.playing;
+ this.currentDuration = data.duration;
+ this.song = new NamedNode(data.song);
+ this.overviewZoom = { duration: data.duration, t1: 0, t2: data.duration };
+ const t1 = data.t - 2,
+ t2 = data.t + 20;
+ this.zoom = { duration: data.duration, t1, t2 };
+ const timeRow = this.shadowRoot!.querySelector(
+ ".timeRow"
+ ) as HTMLDivElement;
+ const w = timeRow.offsetWidth;
+ this.viewState = {
+ zoomSpec: { t1: () => t1, t2: () => t2 },
+ cursor: { t: () => data.t },
+ audioY: () => 0,
+ audioH: () => 60,
+ zoomedTimeY: () => 60,
+ zoomedTimeH: () => 40,
+ fullZoomX: (sec: number) => (sec / data.duration) * w,
+ zoomInX: (sec: number) => ((sec - t1) / (t2 - t1)) * w,
+ mouse: { pos: () => $V([0, 0]) },
+ };
+ }
+
+ @property() songList: NamedNode[] = [];
constructor() {
super();
this.bindKeys();
@@ -206,21 +325,22 @@ export class Light9AscoltamiUi extends L
getTopGraph().then((g) => {
this.graph = g;
this.musicSetup(); // async
- this.graph.runHandler(this.graphChanged.bind(this), 'loadsongs');
+ this.graph.runHandler(this.graphChanged.bind(this), "loadsongs");
});
}
graphChanged() {
- this.songList = []
+ this.songList = [];
try {
- const playList = this.graph.uriValue(//
- this.graph.Uri('http://light9.bigasterisk.com/show/dance2022'),
- this.graph.Uri(':playList'));
- log(playList)
+ const playList = this.graph.uriValue(
+ //
+ this.graph.Uri("http://light9.bigasterisk.com/show/dance2022"),
+ this.graph.Uri(":playList")
+ );
+ log(playList);
this.songList = this.graph.items(playList) as NamedNode[];
} catch (e) {
- log('no playlist yet')
+ log("no playlist yet");
}
log(this.songList.length);
-
}
}
diff --git a/light9/ascoltami/index.html b/light9/ascoltami/index.html
--- a/light9/ascoltami/index.html
+++ b/light9/ascoltami/index.html
@@ -11,47 +11,77 @@
padding-left: 0.4em;
}
.dimStalled #currentTime {
- font-size:70px;
+ font-size: 40px;
+ background: green;
+ color: black;
+ padding: 3px;
}
.dimStalled {
- font-size:70%
+ font-size: 90%;
+ }
+ body {
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ min-height: 100vh;
+ }
+ #page {
+ width: 100%;
+ height: 90vh; /* my phone was losing the bottom :( */
+ display: flex;
+ flex-direction: column;
+ }
+ #page > div,
+ #page > p {
+ flex: 0 1 auto;
+ margin: 0;
+ }
+ light9-ascoltami-ui {
+ flex: 1 1 auto;
}
-
+
ascoltami on {{host}}
-
+
+
-
-
-
- Song: |
-
-
- Time: |
- Left: |
- Until autostop: |
-
-
-
- Update freq: requested , actual States:
-
- |
-
-
+
+
+
+
+ Song:
+ |
+
+
+ Time: |
+ Left: |
+
+ Until autostop:
+
+ |
+
+
+
+ Update freq: requested
+ , actual
+ States:
+
+ |
+
+
+
+
+
+
Running on
+
reload
-
-
- new ui is here
-
-
-
-
Running on
-
reload
-