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)} +

+