From 5b145e17079cd2f48bc5b78c2d923a9f673aa38d Mon Sep 17 00:00:00 2001 From: mrjvs Date: Fri, 20 Oct 2023 17:57:20 +0200 Subject: [PATCH] error states in sources and episodes empty state --- src/components/player/atoms/Episodes.tsx | 5 +++ src/components/player/atoms/Settings.tsx | 8 ++-- .../atoms/settings/SourceSelectingView.tsx | 37 ++++++++++++++++--- .../player/internals/ContextMenu/Misc.tsx | 22 +++++++++++ 4 files changed, 63 insertions(+), 9 deletions(-) diff --git a/src/components/player/atoms/Episodes.tsx b/src/components/player/atoms/Episodes.tsx index a26010e6..822a1463 100644 --- a/src/components/player/atoms/Episodes.tsx +++ b/src/components/player/atoms/Episodes.tsx @@ -118,6 +118,11 @@ function EpisodesView({ else if (loadingState.value) { content = ( + {loadingState.value.season.episodes.length === 0 ? ( + + There are no episodes in this season, check back later! + + ) : null} {loadingState.value.season.episodes.map((ep) => { return ( - + - + - + - + diff --git a/src/components/player/atoms/settings/SourceSelectingView.tsx b/src/components/player/atoms/settings/SourceSelectingView.tsx index 196930a0..ac5135c1 100644 --- a/src/components/player/atoms/settings/SourceSelectingView.tsx +++ b/src/components/player/atoms/settings/SourceSelectingView.tsx @@ -1,6 +1,7 @@ import { ReactNode, useEffect, useMemo, useRef } from "react"; import { useAsyncFn } from "react-use"; +import { Loading } from "@/components/layout/Loading"; import { Menu } from "@/components/player/internals/ContextMenu"; import { SelectableLink } from "@/components/player/internals/ContextMenu/Links"; import { convertRunoutputToSource } from "@/components/player/utils/convertRunoutputToSource"; @@ -46,8 +47,19 @@ export function EmbedOption(props: { }, [props.embedId, props.sourceId, meta, router]); let content: ReactNode = null; - if (request.loading) content = loading...; - else if (request.error) content = Failed to scrape; + if (request.loading) + content = ( + + + + ); + else if (request.error) + content = ( + + We were unable to find any videos for this source. Don't come + bitchin' to us about it, just try another source. + + ); return ( @@ -107,10 +119,25 @@ export function EmbedSelectionView({ sourceId, id }: EmbedSelectionViewProps) { }, [run, sourceId]); let content: ReactNode = null; - if (request.loading) content =

loading...

; - else if (request.error) content =

Failed to scrape

; + if (request.loading) + content = ( + + + + ); + else if (request.error) + content = ( + + We were unable to find any videos for this source. Don't come + bitchin' to us about it, just try another source. + + ); else if (request.value && request.value.length === 0) - content =

No embeds found

; + content = ( + + We were unable to find any embeds for this source, please try another. + + ); else if (request.value) content = request.value.map((v) => ( {props.children}

; } + +export function TextDisplay(props: { + children: React.ReactNode; + title?: string; + noIcon?: boolean; +}) { + return ( +
+
+ {props.noIcon ? null : ( +
+ +
+ )} + {props.title ? ( +

{props.title}

+ ) : null} +
{props.children}
+
+
+ ); +}