From d1de8e529fcd43d4ea684489699e7dbafc8f96b2 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Thu, 28 Jan 2021 22:56:32 +0000 Subject: [PATCH] Guestimated Streaming error alert. --- src/navbar/timelord.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/navbar/timelord.tsx b/src/navbar/timelord.tsx index 55241b4..f23878e 100644 --- a/src/navbar/timelord.tsx +++ b/src/navbar/timelord.tsx @@ -1,7 +1,9 @@ import React, { useState } from "react"; import LiveClock from "react-live-clock"; +import { useSelector } from "react-redux"; import { myradioApiRequest } from "../api"; import { useInterval } from "../lib/utils"; +import { RootState } from "../rootReducer"; import "./timelord.scss"; export function Timelord() { @@ -33,6 +35,7 @@ export function Timelord() { return silence; } + const broadcastState = useSelector((state: RootState) => state.broadcast); const [source, setSource] = useState({ id: 0, name: "Unknown" }); const [isSilence, setSilence] = useState(false); @@ -62,7 +65,12 @@ export function Timelord() { ticking={true} timezone={"europe/london"} /> - {isSilence ? ( + {broadcastState.stage === "REGISTERED" && + !( + broadcastState.connectionState in ["LIVE", "CONNECTED", "NOT_CONNECTED"] + ) ? ( + Streaming Error! + ) : isSilence ? ( SILENCE DETECTED ) : (