mirror of
https://github.com/Readarr/Readarr
synced 2026-05-08 12:42:51 +02:00
Fixed: Don't show NoAuthor on calendar if authors are loading
This commit is contained in:
parent
f9af5e2502
commit
cc0fea2aab
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 NoAuthor from 'Author/NoAuthor';
|
import NoAuthor from 'Author/NoAuthor';
|
||||||
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,
|
||||||
hasAuthor,
|
hasAuthor,
|
||||||
authorError,
|
authorError,
|
||||||
|
authorIsFetching,
|
||||||
|
authorIsPopulated,
|
||||||
missingBookIds,
|
missingBookIds,
|
||||||
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 = hasAuthor ? CalendarConnector : NoAuthor;
|
|
||||||
|
|
||||||
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}
|
||||||
>
|
>
|
||||||
|
{
|
||||||
|
authorIsFetching && !authorIsPopulated &&
|
||||||
|
<LoadingIndicator />
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
authorError &&
|
authorError &&
|
||||||
<div className={styles.errorMessage}>
|
<div className={styles.errorMessage}>
|
||||||
|
|
@ -141,14 +147,14 @@ class CalendarPage extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
!authorError &&
|
!authorError && authorIsPopulated && hasAuthor &&
|
||||||
<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>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
!authorError && authorIsPopulated && !hasAuthor &&
|
||||||
|
<NoAuthor />
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
hasAuthor && !!authorError &&
|
hasAuthor && !!authorError &&
|
||||||
<LegendConnector />
|
<LegendConnector />
|
||||||
|
|
@ -182,6 +193,8 @@ CalendarPage.propTypes = {
|
||||||
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
hasAuthor: PropTypes.bool.isRequired,
|
hasAuthor: PropTypes.bool.isRequired,
|
||||||
authorError: PropTypes.object,
|
authorError: PropTypes.object,
|
||||||
|
authorIsFetching: PropTypes.bool.isRequired,
|
||||||
|
authorIsPopulated: PropTypes.bool.isRequired,
|
||||||
missingBookIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
missingBookIds: 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,
|
||||||
hasAuthor: !!authorCount.count,
|
hasAuthor: !!authorCount.count,
|
||||||
authorError: authorCount.error,
|
authorError: authorCount.error,
|
||||||
|
authorIsFetching: authorCount.isFetching,
|
||||||
|
authorIsPopulated: authorCount.isPopulated,
|
||||||
missingBookIds,
|
missingBookIds,
|
||||||
isSearchingForMissing
|
isSearchingForMissing
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,14 @@ function createAuthorCountSelector() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
createAllAuthorsSelector(),
|
createAllAuthorsSelector(),
|
||||||
(state) => state.authors.error,
|
(state) => state.authors.error,
|
||||||
(authors, error) => {
|
(state) => state.authors.isFetching,
|
||||||
|
(state) => state.authors.isPopulated,
|
||||||
|
(authors, error, isFetching, isPopulated) => {
|
||||||
return {
|
return {
|
||||||
count: authors.length,
|
count: authors.length,
|
||||||
error
|
error,
|
||||||
|
isFetching,
|
||||||
|
isPopulated
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue