fix: fallback to first endpoint
This commit is contained in:
parent
86f13c171d
commit
855a87aadc
@ -49,7 +49,8 @@ export function DashboardForLink({ link }: { link: NostrLink }) {
|
|||||||
|
|
||||||
const provider = useMemo(() => (service ? new NostrStreamProvider("", service) : DefaultProvider), [service]);
|
const provider = useMemo(() => (service ? new NostrStreamProvider("", service) : DefaultProvider), [service]);
|
||||||
const defaultEndpoint = useMemo(() => {
|
const defaultEndpoint = useMemo(() => {
|
||||||
return info?.endpoints.find(a => a.name == (recording ? "Best" : "Good"));
|
return info?.endpoints.find(a => a.name == (recording ? "Best" : "Good"))
|
||||||
|
?? info?.endpoints[0];
|
||||||
}, [info, recording]);
|
}, [info, recording]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -98,9 +99,8 @@ export function DashboardForLink({ link }: { link: NostrLink }) {
|
|||||||
</h3>
|
</h3>
|
||||||
<div className="uppercase font-semibold flex items-center gap-2">
|
<div className="uppercase font-semibold flex items-center gap-2">
|
||||||
<div
|
<div
|
||||||
className={`w-3 h-3 rounded-full ${
|
className={`w-3 h-3 rounded-full ${status === StreamState.Live ? "animate-pulse bg-green-500" : "bg-red-500"
|
||||||
status === StreamState.Live ? "animate-pulse bg-green-500" : "bg-red-500"
|
}`}></div>
|
||||||
}`}></div>
|
|
||||||
{status === StreamState.Live ? (
|
{status === StreamState.Live ? (
|
||||||
<FormattedMessage defaultMessage="Started" />
|
<FormattedMessage defaultMessage="Started" />
|
||||||
) : (
|
) : (
|
||||||
|
@ -12,7 +12,8 @@ export default function DashboardIntroFinal() {
|
|||||||
const [info, setInfo] = useState<StreamProviderInfo>();
|
const [info, setInfo] = useState<StreamProviderInfo>();
|
||||||
|
|
||||||
const defaultEndpoint = useMemo(() => {
|
const defaultEndpoint = useMemo(() => {
|
||||||
return info?.endpoints.find(a => a.name == "Best");
|
return info?.endpoints.find(a => a.name == "Best")
|
||||||
|
?? info?.endpoints[0];
|
||||||
}, [info]);
|
}, [info]);
|
||||||
|
|
||||||
async function loadInfo() {
|
async function loadInfo() {
|
||||||
|
@ -16,7 +16,8 @@ export default function DashboardIntro() {
|
|||||||
const exampleHours = 4;
|
const exampleHours = 4;
|
||||||
|
|
||||||
const defaultEndpoint = useMemo(() => {
|
const defaultEndpoint = useMemo(() => {
|
||||||
return info?.endpoints.find(a => a.name == "Best");
|
return info?.endpoints.find(a => a.name == "Best")
|
||||||
|
?? info?.endpoints[0];
|
||||||
}, [info]);
|
}, [info]);
|
||||||
const rate = useRates("BTCUSD");
|
const rate = useRates("BTCUSD");
|
||||||
const exampleCost = rate.ask * (exampleHours * (defaultEndpoint?.rate ?? 0) * 60) * 1e-8;
|
const exampleCost = rate.ask * (exampleHours * (defaultEndpoint?.rate ?? 0) * 60) * 1e-8;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user