From 550608cdb5db91de57d79bc8c1b2080fc12b1b6c Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 2 Jun 2025 04:29:59 -0400 Subject: [PATCH] Fix loading indicator in popup --- src/popup/PopupComponent.tsx | 77 +++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/src/popup/PopupComponent.tsx b/src/popup/PopupComponent.tsx index d33b7952..6e3760c6 100644 --- a/src/popup/PopupComponent.tsx +++ b/src/popup/PopupComponent.tsx @@ -14,13 +14,23 @@ import { SegmentSubmissionComponent } from "./SegmentSubmissionComponent"; export enum LoadingStatus { Loading, SegmentsFound, - NoSegmentsFound + NoSegmentsFound, + ConnectionError, + StillLoading, + NoVideo +} + +export interface LoadingData { + status: LoadingStatus; + code?: number; } let loadRetryCount = 0; export const PopupComponent = () => { - const [status, setStatus] = React.useState(LoadingStatus.Loading); + const [status, setStatus] = React.useState({ + status: LoadingStatus.Loading + }); const [extensionEnabled, setExtensionEnabled] = React.useState(!Config.config!.disableSkipping); const [channelWhitelisted, setChannelWhitelisted] = React.useState(null); const [showForceChannelCheckWarning, setShowForceChannelCheckWarning] = React.useState(false); @@ -84,20 +94,11 @@ export const PopupComponent = () => {

- {/* Loading text */} - {status === LoadingStatus.Loading && ( -

- {chrome.i18n.getMessage("noVideoID")} -

- )} - {/* If the video was found in the database */} - {status !== LoadingStatus.Loading && ( -

- {status === LoadingStatus.SegmentsFound ? chrome.i18n.getMessage("sponsorFound") : chrome.i18n.getMessage("sponsor404")} -

- )} +

+ {getVideoStatusText(status)} +

+