diff --git a/src/navbar/navbar.scss b/src/navbar/navbar.scss index 53eb353..e673199 100644 --- a/src/navbar/navbar.scss +++ b/src/navbar/navbar.scss @@ -43,6 +43,10 @@ margin: 0; } +.btn { + max-height: 45px; +} + .navbar-main { background-color: #2d425f; border-color: #2d425f; diff --git a/src/navbar/timelord.scss b/src/navbar/timelord.scss index 0f55f7b..a1a8415 100644 --- a/src/navbar/timelord.scss +++ b/src/navbar/timelord.scss @@ -2,15 +2,52 @@ background: black; border: red 1px solid; color: white; - min-width: 85px; -} + padding: 0 1em; + font-size: 1.1em; -#timelord a { - text-decoration: none; - color: white; -} + a { + text-decoration: none; + color: white; + } -#timelord time { - font-weight: bold; - font-size: 1.2em; + time { + font-weight: bold; + font-size: 1.1em; + font-variant-numeric: tabular-nums; // Make the text monospace so it stops jumping. + } + + .source { + margin-left: 1em; + border-left: 2px solid gray; + padding-left: 1em; + } + + .studio { + color: #2cdfff; + font-weight: bold; + + &.studio1 { + color: red; + } + + &.studio2 { + color: #246ee6; + } + + &.studio3 { + color: #0f0; + } + + &.studio4 { + color: #bb00dc; + } + + &.studio5 { + color: #b5009b; + } + + &.studio8 { + color: orange; + } + } } diff --git a/src/navbar/timelord.tsx b/src/navbar/timelord.tsx index b3ab05c..af609ef 100644 --- a/src/navbar/timelord.tsx +++ b/src/navbar/timelord.tsx @@ -1,8 +1,38 @@ -import React from "react"; +import React, { useState } from "react"; import LiveClock from "react-live-clock"; +import { myradioApiRequest } from "../api"; +import { useInterval } from "../lib/utils"; import "./timelord.scss"; export function Timelord() { + async function getSource() { + let studio = await myradioApiRequest("/selector/studioattime", "GET", null); + + const sourceNames = [ + "Studio Red", + "Studio Blue", + "Jukebox", + "OB", + "WebStudio", + "Unknown", + "Sine Wave", + "Off Air", + ]; + + let sourceName = "Unknown"; + if (sourceNames[studio - 1]) { + sourceName = sourceNames[studio - 1]; + } + + return { id: studio, name: sourceName }; + } + + const [source, setSource] = useState({ id: 0, name: "Unknown" }); + + useInterval(async () => { + setSource(await getSource()); + }, 3000); + return (
+ + {source.name} is On + Air + ); }