Compare commits
No commits in common. "d3e7e3152f0707ba1b94b7c0e76ee8105eba3a47" and "18a02d74908e937d1a16097750cccebba527612c" have entirely different histories.
d3e7e3152f
...
18a02d7490
31
app.js
31
app.js
@ -7,8 +7,7 @@ import { useReducer, useState, useEffect, useLayoutEffect, useMemo, useRef } fro
|
|||||||
import State01 from "./testdata-01.json" assert { type: "json" };
|
import State01 from "./testdata-01.json" assert { type: "json" };
|
||||||
import State02 from "./testdata-02.json" assert { type: "json" };
|
import State02 from "./testdata-02.json" assert { type: "json" };
|
||||||
|
|
||||||
const Styles =
|
const Styles = {
|
||||||
{
|
|
||||||
Broadcast:
|
Broadcast:
|
||||||
{
|
{
|
||||||
position: "relative",
|
position: "relative",
|
||||||
@ -51,11 +50,11 @@ const App = props =>
|
|||||||
/** @type {Boxcast.StateBinding<Array<Boxcast.Broadcast>>} */
|
/** @type {Boxcast.StateBinding<Array<Boxcast.Broadcast>>} */
|
||||||
const [ListGet, ListSet] = useState([]);
|
const [ListGet, ListSet] = useState([]);
|
||||||
|
|
||||||
/** @type {Boxcast.StateBinding<Boxcast.Broadcast|null>} */
|
/** @type {Boxcast.StateBinding<string>} */
|
||||||
const [SelectedGet, SelectedSet] = useState(null);
|
const [SelectedGet, SelectedSet] = useState("");
|
||||||
|
|
||||||
/** @type {Boxcast.StateBinding<Boxcast.Broadcast|null>} */
|
/** @type {Boxcast.StateBinding<string>} */
|
||||||
const [LiveGet, LiveSet] = useState(null);
|
const [LiveGet, LiveSet] = useState("");
|
||||||
|
|
||||||
/** @type {(inList:Array<Boxcast.Broadcast>)=>Array<Boxcast.Broadcast>} */
|
/** @type {(inList:Array<Boxcast.Broadcast>)=>Array<Boxcast.Broadcast>} */
|
||||||
const SortStart = (inList) => {
|
const SortStart = (inList) => {
|
||||||
@ -105,20 +104,20 @@ const App = props =>
|
|||||||
// on new list
|
// on new list
|
||||||
useEffect(()=>
|
useEffect(()=>
|
||||||
{
|
{
|
||||||
let live;
|
let live = "";
|
||||||
for(let i=0; i<ListGet.length; i++)
|
for(let i=0; i<ListGet.length; i++)
|
||||||
{
|
{
|
||||||
if(ListGet[i].timeframe != "past")
|
if(ListGet[i].timeframe != "past")
|
||||||
{
|
{
|
||||||
live = ListGet[i];
|
live = ListGet[i].id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(LiveGet?.id != live?.id)
|
if(LiveGet != live)
|
||||||
{
|
{
|
||||||
console.log("new video starting")
|
console.log("new video starting")
|
||||||
}
|
}
|
||||||
if(SelectedGet?.id != live?.id)
|
if(SelectedGet != live)
|
||||||
{
|
{
|
||||||
console.log("would you like to switch?");
|
console.log("would you like to switch?");
|
||||||
}
|
}
|
||||||
@ -139,7 +138,7 @@ const App = props =>
|
|||||||
{
|
{
|
||||||
Player.current.loadChannel(props.channel,
|
Player.current.loadChannel(props.channel,
|
||||||
{
|
{
|
||||||
selectedBroadcastId: SelectedGet?.id,
|
selectedBroadcastId: SelectedGet,
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
showDescription: true,
|
showDescription: true,
|
||||||
showCountdown: true,
|
showCountdown: true,
|
||||||
@ -164,9 +163,9 @@ const App = props =>
|
|||||||
{
|
{
|
||||||
item: item,
|
item: item,
|
||||||
previous: ListGet[index-1],
|
previous: ListGet[index-1],
|
||||||
priority: item.id == LiveGet?.id,
|
priority: item.id == LiveGet,
|
||||||
selected: item.id == SelectedGet?.id,
|
selected: item.id == SelectedGet,
|
||||||
select: ()=>SelectedSet(item)
|
select: ()=>SelectedSet(item.id)
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@ -246,7 +245,6 @@ const DateParse = (inDateString) =>
|
|||||||
Date: date.getDate(),
|
Date: date.getDate(),
|
||||||
Hours: date.getHours(),
|
Hours: date.getHours(),
|
||||||
Minutes: date.getMinutes(),
|
Minutes: date.getMinutes(),
|
||||||
Epoch: date.valueOf()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
obj.Zone = obj.Zone ? obj.Zone[1] : "local time";
|
obj.Zone = obj.Zone ? obj.Zone[1] : "local time";
|
||||||
@ -257,5 +255,4 @@ const DateParse = (inDateString) =>
|
|||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @type {(inChannel:string, inSelector:string)=>void} */
|
export default App;
|
||||||
export default (inChannel, inSelector) => render(h(App, {channel:inChannel, interval:50000}), document.querySelector(inSelector));
|
|
22
index.html
22
index.html
@ -2,15 +2,25 @@
|
|||||||
<html>
|
<html>
|
||||||
<head></head>
|
<head></head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div style="max-width:500px; margin: 0 auto;">
|
<div style="max-width:500px; margin: 0 auto;">
|
||||||
<div id="boxcast"></div>
|
<div id="boxcast"></div>
|
||||||
<script type="module">
|
|
||||||
import Init from "./app.js";
|
|
||||||
const Channel = { Basics: "sfz7ja3rlpoous6usu8a", Sunday: "gzahmhugrzogttfdtbjj", Dev: "r3os2zfdnhlquhuypgtp" };
|
|
||||||
Init(Channel.Basics, "#boxcast");
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
|
<script type="module">
|
||||||
|
|
||||||
|
const Channel = {
|
||||||
|
Basics: "sfz7ja3rlpoous6usu8a",
|
||||||
|
Sunday: "gzahmhugrzogttfdtbjj",
|
||||||
|
Dev: "r3os2zfdnhlquhuypgtp"
|
||||||
|
};
|
||||||
|
|
||||||
|
import { h, render } from "https://esm.sh/preact";
|
||||||
|
import App from "./app.js";
|
||||||
|
|
||||||
|
render(
|
||||||
|
h(App, {channel:Channel.Basics, interval:50000}),
|
||||||
|
document.querySelector("#boxcast")
|
||||||
|
);
|
||||||
|
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
3
types.d.ts
vendored
3
types.d.ts
vendored
@ -25,8 +25,7 @@ namespace Boxcast
|
|||||||
Date: number
|
Date: number
|
||||||
Hours: number
|
Hours: number
|
||||||
Minutes: string | number
|
Minutes: string | number
|
||||||
M?: "AM" | "PM",
|
M?: "AM" | "PM"
|
||||||
Epoch: number
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type StateBinding<T> = [T, (item:T)=>void];
|
type StateBinding<T> = [T, (item:T)=>void];
|
||||||
|
Loading…
Reference in New Issue
Block a user