Use loading indicators

This commit is contained in:
Craig Alexander 2025-08-03 23:33:36 -04:00
parent bcf924a204
commit 92dcdcb362
6 changed files with 27 additions and 15 deletions

View File

@ -7,6 +7,7 @@ import FormattedNumber from './FormattedNumber';
import Button from './Button';
import ChannelIcon from './ChannelIcon';
import ChannelBanner from './ChannelBanner';
import LoadingIndicator from './LoadingIndicator';
import { useUserConfigStore } from '../stores/UserConfigStore';
type ChannelListProps = {
@ -18,7 +19,10 @@ const ChannelList = ({ channelList, refreshChannelList }: ChannelListProps) => {
const { userConfig } = useUserConfigStore();
const viewStyle = userConfig.view_style_channel;
if (!channelList || channelList.length === 0) {
if (!channelList) {
return <LoadingIndicator />;
}
if (channelList.length === 0) {
return <h2>No channels found...</h2>;
}

View File

@ -4,6 +4,7 @@ import updatePlaylistSubscription from '../api/actions/updatePlaylistSubscriptio
import formatDate from '../functions/formatDates';
import Button from './Button';
import PlaylistThumbnail from './PlaylistThumbnail';
import LoadingIndicator from './LoadingIndicator';
import { useUserConfigStore } from '../stores/UserConfigStore';
import { PlaylistType } from '../api/loader/loadPlaylistById';
@ -16,7 +17,10 @@ const PlaylistList = ({ playlistList, setRefresh }: PlaylistListProps) => {
const { userConfig } = useUserConfigStore();
const viewStyle = userConfig.view_style_playlist;
if (!playlistList || playlistList.length === 0) {
if (!playlistList) {
return <LoadingIndicator />;
}
if (playlistList.length === 0) {
return <h2>No playlists found...</h2>;
}

View File

@ -2,6 +2,7 @@ import { ViewStylesEnum, ViewStylesType } from '../configuration/constants/ViewS
import { VideoType } from '../pages/Home';
import VideoListItem from './VideoListItem';
import VideoListItemTable from './VideoListItemTable';
import LoadingIndicator from './LoadingIndicator';
type VideoListProps = {
videoList: VideoType[] | undefined;
@ -18,7 +19,10 @@ const VideoList = ({
showReorderButton = false,
refreshVideoList,
}: VideoListProps) => {
if (!videoList || videoList.length === 0) {
if (!videoList) {
return <LoadingIndicator />;
}
if (videoList.length === 0) {
return <h2>No videos found...</h2>;
}

View File

@ -171,8 +171,8 @@ const ChannelVideo = ({ videoType }: ChannelVideoProps) => {
<VideoList videoList={videoList} viewStyle={viewStyle} refreshVideoList={setRefresh} />
{!hasVideos && (
<p>
Try going to the <Link to={Routes.Downloads}>downloads page</Link> to start the
scan and download tasks.
Try going to the <Link to={Routes.Downloads}>downloads page</Link> to start the scan
and download tasks.
</p>
)}
</div>

View File

@ -198,10 +198,10 @@ const Home = () => {
<div className={`boxed-content ${gridView}`}>
<div className={`video-list ${userConfig.view_style_home} ${gridViewGrid}`}>
<VideoList
videoList={videoList}
viewStyle={userConfig.view_style_home}
refreshVideoList={setRefreshVideoList}
/>
videoList={videoList}
viewStyle={userConfig.view_style_home}
refreshVideoList={setRefreshVideoList}
/>
{!hasVideos && (
<p>
If you've already added a channel or playlist, try going to the{' '}

View File

@ -350,12 +350,12 @@ const Playlist = () => {
<div className={`boxed-content ${gridView}`}>
<div className={`video-list ${viewStyle} ${gridViewGrid}`}>
<VideoList
videoList={videos}
viewStyle={viewStyle}
playlistId={playlistId}
showReorderButton={isCustomPlaylist}
refreshVideoList={setRefresh}
/>
videoList={videos}
viewStyle={viewStyle}
playlistId={playlistId}
showReorderButton={isCustomPlaylist}
refreshVideoList={setRefresh}
/>
{videoInPlaylistCount === 0 && (
<>
{isCustomPlaylist && (