diff --git a/src/components/player/atoms/settings/SourceSelectingView.tsx b/src/components/player/atoms/settings/SourceSelectingView.tsx index e20bc6b2..6d15677b 100644 --- a/src/components/player/atoms/settings/SourceSelectingView.tsx +++ b/src/components/player/atoms/settings/SourceSelectingView.tsx @@ -39,19 +39,33 @@ export function EmbedOption(props: { return sourceMeta?.name ?? unknownEmbedName; }, [props.embedId, unknownEmbedName]); - const { run, errored, loading } = useEmbedScraping( + const { run, errored, loading, notFound } = useEmbedScraping( props.routerId, props.sourceId, props.url, props.embedId, ); + let rightSide; + if (loading) { + rightSide = undefined; // Let SelectableLink handle loading + } else if (notFound) { + rightSide = ( +
+
+
+
+
+ ); + } + return ( {embedName} diff --git a/src/components/player/hooks/useSourceSelection.ts b/src/components/player/hooks/useSourceSelection.ts index 4fca0775..dde82db0 100644 --- a/src/components/player/hooks/useSourceSelection.ts +++ b/src/components/player/hooks/useSourceSelection.ts @@ -124,6 +124,7 @@ export function useEmbedScraping( run, loading: request.loading, errored: !!request.error, + notFound: request.error instanceof NotFoundError, }; } diff --git a/src/components/player/internals/ContextMenu/Links.tsx b/src/components/player/internals/ContextMenu/Links.tsx index 7d53e264..a1cb459f 100644 --- a/src/components/player/internals/ContextMenu/Links.tsx +++ b/src/components/player/internals/ContextMenu/Links.tsx @@ -169,23 +169,26 @@ export function SelectableLink(props: { disabled?: boolean; error?: ReactNode; box?: boolean; + rightSide?: ReactNode; }) { - let rightContent; - if (props.selected) { - rightContent = ( - - ); + let rightContent = props.rightSide; // Use custom rightSide if provided + if (!rightContent) { + if (props.selected) { + rightContent = ( + + ); + } + if (props.error) + rightContent = ( + + + + ); + if (props.loading) rightContent = ; // should override selected and error } - if (props.error) - rightContent = ( - - - - ); - if (props.loading) rightContent = ; // should override selected and error return ( +
+
+
+
+ ); + } + return ( - + {embedName}