Fix not found message showing as API is loading (#995)

This commit is contained in:
Craig Alexander 2025-06-15 05:19:14 -04:00 committed by GitHub
parent ff94c324b3
commit bb4e5ecb50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 85 additions and 90 deletions

2
.gitignore vendored
View File

@ -12,3 +12,5 @@ backend/.env
# JavaScript stuff # JavaScript stuff
node_modules node_modules
.editorconfig

View File

@ -97,104 +97,97 @@ const ChannelVideo = ({ videoType }: ChannelVideoProps) => {
videoId, videoId,
]); ]);
if (!channel) {
return (
<div className="boxed-content">
<br />
<h2>Channel {channelId} not found!</h2>
</div>
);
}
return ( return (
<> channel && (
<title>{`TA | Channel: ${channel.channel_name}`}</title> <>
<ScrollToTopOnNavigate /> <title>{`TA | Channel: ${channel.channel_name}`}</title>
<div className="boxed-content"> <ScrollToTopOnNavigate />
<div className="info-box info-box-2"> <div className="boxed-content">
<ChannelOverview <div className="info-box info-box-2">
channelId={channel.channel_id} <ChannelOverview
channelname={channel.channel_name} channelId={channel.channel_id}
channelSubs={channel.channel_subs} channelname={channel.channel_name}
channelSubscribed={channel.channel_subscribed} channelSubs={channel.channel_subs}
channelThumbUrl={channel.channel_thumb_url} channelSubscribed={channel.channel_subscribed}
setRefresh={setRefresh} channelThumbUrl={channel.channel_thumb_url}
/> setRefresh={setRefresh}
<div className="info-box-item"> />
{videoAggs && ( <div className="info-box-item">
<> {videoAggs && (
<p> <>
{videoAggs.total_items.value} videos <span className="space-carrot">|</span>{' '} <p>
{videoAggs.total_duration.value_str} playback{' '} {videoAggs.total_items.value} videos <span className="space-carrot">|</span>{' '}
<span className="space-carrot">|</span> Total size{' '} {videoAggs.total_duration.value_str} playback{' '}
{humanFileSize(videoAggs.total_size.value, useSiUnits)} <span className="space-carrot">|</span> Total size{' '}
</p> {humanFileSize(videoAggs.total_size.value, useSiUnits)}
<div className="button-box"> </p>
<Button <div className="button-box">
label="Mark as watched" <Button
id="watched-button" label="Mark as watched"
type="button" id="watched-button"
title={`Mark all videos from ${channel.channel_name} as watched`} type="button"
onClick={async () => { title={`Mark all videos from ${channel.channel_name} as watched`}
await updateWatchedState({ onClick={async () => {
id: channel.channel_id, await updateWatchedState({
is_watched: true, id: channel.channel_id,
}); is_watched: true,
});
setRefresh(true); setRefresh(true);
}} }}
/>{' '} />{' '}
<Button <Button
label="Mark as unwatched" label="Mark as unwatched"
id="unwatched-button" id="unwatched-button"
type="button" type="button"
title={`Mark all videos from ${channel.channel_name} as unwatched`} title={`Mark all videos from ${channel.channel_name} as unwatched`}
onClick={async () => { onClick={async () => {
await updateWatchedState({ await updateWatchedState({
id: channel.channel_id, id: channel.channel_id,
is_watched: false, is_watched: false,
}); });
setRefresh(true); setRefresh(true);
}} }}
/> />
</div> </div>
</> </>
)} )}
</div>
</div> </div>
</div> </div>
</div>
<div className={`boxed-content ${gridView}`}> <div className={`boxed-content ${gridView}`}>
<Filterbar <Filterbar
hideToggleText={'Hide watched videos:'} hideToggleText={'Hide watched videos:'}
viewStyle={ViewStyleNames.Home as ViewStyleNamesType} viewStyle={ViewStyleNames.Home as ViewStyleNamesType}
/> />
</div>
<EmbeddableVideoPlayer videoId={videoId} />
<div className={`boxed-content ${gridView}`}>
<div className={`video-list ${viewStyle} ${gridViewGrid}`}>
{!hasVideos && (
<>
<h2>No videos found...</h2>
<p>
Try going to the <Link to={Routes.Downloads}>downloads page</Link> to start the scan
and download tasks.
</p>
</>
)}
<VideoList videoList={videoList} viewStyle={viewStyle} refreshVideoList={setRefresh} />
</div> </div>
</div>
{pagination && ( <EmbeddableVideoPlayer videoId={videoId} />
<div className="boxed-content">
<Pagination pagination={pagination} setPage={setCurrentPage} /> <div className={`boxed-content ${gridView}`}>
<div className={`video-list ${viewStyle} ${gridViewGrid}`}>
{!hasVideos && (
<>
<h2>No videos found...</h2>
<p>
Try going to the <Link to={Routes.Downloads}>downloads page</Link> to start the
scan and download tasks.
</p>
</>
)}
<VideoList videoList={videoList} viewStyle={viewStyle} refreshVideoList={setRefresh} />
</div>
</div> </div>
)} {pagination && (
</> <div className="boxed-content">
<Pagination pagination={pagination} setPage={setCurrentPage} />
</div>
)}
</>
)
); );
}; };