Skip to content

Commit

Permalink
Merge pull request #3550 from webkom/events-loading
Browse files Browse the repository at this point in the history
  • Loading branch information
ivarnakken committed Feb 10, 2023
2 parents 833d574 + ee3506f commit d392904
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 2 additions & 3 deletions app/routes/events/EventListRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const mapStateToProps = (state, ownProps) => {
actionGrant,
})(state, ownProps),
icalToken,
notLoading: !state.events.fetching,
fetching: state.events.fetching,
};
};

Expand Down Expand Up @@ -63,6 +63,5 @@ export default compose(
withPreparedDispatch('fetchEventList', (props, dispatch) =>
dispatch(fetchData())
),
connect(mapStateToProps, mapDispatchToProps),
loadingIndicator(['notLoading'])
connect(mapStateToProps, mapDispatchToProps)
)(EventList);
8 changes: 6 additions & 2 deletions app/routes/events/components/EventList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import EventItem from 'app/components/EventItem';
import { CheckBox } from 'app/components/Form/';
import { selectTheme, selectStyles } from 'app/components/Form/SelectInput';
import Icon from 'app/components/Icon';
import LoadingIndicator from 'app/components/LoadingIndicator';
import type { Event, ActionGrant, IcalToken } from 'app/models';
import { EventTime } from 'app/models';
import EventFooter from './EventFooter';
Expand Down Expand Up @@ -81,6 +82,7 @@ type EventListProps = {
fetchMore: () => Promise<any>;
loggedIn: boolean;
location: Record<string, any>;
fetching: boolean;
};
type Option = {
filterRegDateFunc: (arg0: Event) => boolean;
Expand Down Expand Up @@ -149,8 +151,9 @@ class EventList extends Component<EventListProps, State> {
};

render() {
const { icalToken, showFetchMore, fetchMore, events, loggedIn } =
const { icalToken, showFetchMore, fetchMore, events, loggedIn, fetching } =
this.props;

const { field, filterRegDateFunc } = this.state.selectedOption;
const { showCompanyPresentation, showCourse, showSocial, showOther } =
this.state.filterEventTypesSettings;
Expand Down Expand Up @@ -261,7 +264,8 @@ class EventList extends Component<EventListProps, State> {
field={field}
loggedIn={loggedIn}
/>
{isEmpty(this.props.events) && (
{isEmpty(events) && fetching && <LoadingIndicator loading />}
{isEmpty(events) && !fetching && (
<EmptyState icon="book-outline" size={40}>
<h2 className={styles.noEvents}>Ingen kommende arrangementer</h2>
</EmptyState>
Expand Down

0 comments on commit d392904

Please sign in to comment.