mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Fixed: Don't Show NoArtist on Calendar if Artists are Loading
This commit is contained in:
parent
3e937bd8e5
commit
2639374243
3 changed files with 25 additions and 6 deletions
|
@ -9,6 +9,7 @@ import PageToolbar from 'Components/Page/Toolbar/PageToolbar';
|
||||||
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
import PageToolbarSection from 'Components/Page/Toolbar/PageToolbarSection';
|
||||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||||
import FilterMenu from 'Components/Menu/FilterMenu';
|
import FilterMenu from 'Components/Menu/FilterMenu';
|
||||||
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import NoArtist from 'Artist/NoArtist';
|
import NoArtist from 'Artist/NoArtist';
|
||||||
import CalendarLinkModal from './iCal/CalendarLinkModal';
|
import CalendarLinkModal from './iCal/CalendarLinkModal';
|
||||||
import CalendarOptionsModal from './Options/CalendarOptionsModal';
|
import CalendarOptionsModal from './Options/CalendarOptionsModal';
|
||||||
|
@ -77,6 +78,8 @@ class CalendarPage extends Component {
|
||||||
filters,
|
filters,
|
||||||
hasArtist,
|
hasArtist,
|
||||||
artistError,
|
artistError,
|
||||||
|
artistIsFetching,
|
||||||
|
artistIsPopulated,
|
||||||
missingAlbumIds,
|
missingAlbumIds,
|
||||||
isSearchingForMissing,
|
isSearchingForMissing,
|
||||||
useCurrentPage,
|
useCurrentPage,
|
||||||
|
@ -90,8 +93,6 @@ class CalendarPage extends Component {
|
||||||
|
|
||||||
const isMeasured = this.state.width > 0;
|
const isMeasured = this.state.width > 0;
|
||||||
|
|
||||||
const PageComponent = hasArtist ? CalendarConnector : NoArtist;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContent title="Calendar">
|
<PageContent title="Calendar">
|
||||||
<PageToolbar>
|
<PageToolbar>
|
||||||
|
@ -133,6 +134,11 @@ class CalendarPage extends Component {
|
||||||
className={styles.calendarPageBody}
|
className={styles.calendarPageBody}
|
||||||
innerClassName={styles.calendarInnerPageBody}
|
innerClassName={styles.calendarInnerPageBody}
|
||||||
>
|
>
|
||||||
|
{
|
||||||
|
artistIsFetching && !artistIsPopulated &&
|
||||||
|
<LoadingIndicator />
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
artistError &&
|
artistError &&
|
||||||
<div className={styles.errorMessage}>
|
<div className={styles.errorMessage}>
|
||||||
|
@ -141,14 +147,14 @@ class CalendarPage extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
!artistError &&
|
!artistError && artistIsPopulated && hasArtist &&
|
||||||
<Measure
|
<Measure
|
||||||
whitelist={['width']}
|
whitelist={['width']}
|
||||||
onMeasure={this.onMeasure}
|
onMeasure={this.onMeasure}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
isMeasured ?
|
isMeasured ?
|
||||||
<PageComponent
|
<CalendarConnector
|
||||||
useCurrentPage={useCurrentPage}
|
useCurrentPage={useCurrentPage}
|
||||||
/> :
|
/> :
|
||||||
<div />
|
<div />
|
||||||
|
@ -156,6 +162,11 @@ class CalendarPage extends Component {
|
||||||
</Measure>
|
</Measure>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
!artistError && artistIsPopulated && !hasArtist &&
|
||||||
|
<NoArtist />
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
hasArtist && !!artistError &&
|
hasArtist && !!artistError &&
|
||||||
<LegendConnector />
|
<LegendConnector />
|
||||||
|
@ -182,6 +193,8 @@ CalendarPage.propTypes = {
|
||||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
hasArtist: PropTypes.bool.isRequired,
|
hasArtist: PropTypes.bool.isRequired,
|
||||||
artistError: PropTypes.object,
|
artistError: PropTypes.object,
|
||||||
|
artistIsFetching: PropTypes.bool.isRequired,
|
||||||
|
artistIsPopulated: PropTypes.bool.isRequired,
|
||||||
missingAlbumIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
missingAlbumIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||||
isSearchingForMissing: PropTypes.bool.isRequired,
|
isSearchingForMissing: PropTypes.bool.isRequired,
|
||||||
useCurrentPage: PropTypes.bool.isRequired,
|
useCurrentPage: PropTypes.bool.isRequired,
|
||||||
|
|
|
@ -74,6 +74,8 @@ function createMapStateToProps() {
|
||||||
colorImpairedMode: uiSettings.enableColorImpairedMode,
|
colorImpairedMode: uiSettings.enableColorImpairedMode,
|
||||||
hasArtist: !!artistCount.count,
|
hasArtist: !!artistCount.count,
|
||||||
artistError: artistCount.error,
|
artistError: artistCount.error,
|
||||||
|
artistIsFetching: artistCount.isFetching,
|
||||||
|
artistIsPopulated: artistCount.isPopulated,
|
||||||
missingAlbumIds,
|
missingAlbumIds,
|
||||||
isSearchingForMissing
|
isSearchingForMissing
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,10 +5,14 @@ function createArtistCountSelector() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
createAllArtistSelector(),
|
createAllArtistSelector(),
|
||||||
(state) => state.artist.error,
|
(state) => state.artist.error,
|
||||||
(artists, error) => {
|
(state) => state.artist.isFetching,
|
||||||
|
(state) => state.artist.isPopulated,
|
||||||
|
(artists, error, isFetching, isPopulated) => {
|
||||||
return {
|
return {
|
||||||
count: artists.length,
|
count: artists.length,
|
||||||
error
|
error,
|
||||||
|
isFetching,
|
||||||
|
isPopulated
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue