Skip to content

Commit a9b389e

Browse files
committed
Fix various empty states
1 parent a1a21fb commit a9b389e

File tree

4 files changed

+44
-14
lines changed

4 files changed

+44
-14
lines changed

app/components/HeaderNotifications/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BadgeIcon, LoadingIndicator } from '@webkom/lego-bricks';
22
import { usePreparedEffect } from '@webkom/react-prepare';
33
import cx from 'classnames';
4-
import { Bell, BellRing } from 'lucide-react';
4+
import { Bell, BellOff, BellRing } from 'lucide-react';
55
import { useState } from 'react';
66
import { Link } from 'react-router-dom';
77
import { fetchNotificationFeed } from 'app/actions/FeedActions';
@@ -71,7 +71,9 @@ const HeaderNotificationsContent = () => {
7171
}
7272

7373
if (!fetchingNotifications && notifications.length === 0) {
74-
return <EmptyState body="Ingen varslinger å vise" />;
74+
return (
75+
<EmptyState iconNode={<BellOff />} body="Du har ingen varslinger ..." />
76+
);
7577
}
7678

7779
return (

app/routes/forum/components/ForumList.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { Flex, LinkButton, LoadingIndicator, Page } from '@webkom/lego-bricks';
22
import { usePreparedEffect } from '@webkom/react-prepare';
3+
import { MessageSquare, MessageSquareDashed } from 'lucide-react';
4+
import { Helmet } from 'react-helmet-async';
35
import { fetchForums } from 'app/actions/ForumActions';
6+
import EmptyState from 'app/components/EmptyState';
47
import { Tag } from 'app/components/Tags';
58
import { selectAllForums } from 'app/reducers/forums';
69
import { useAppDispatch, useAppSelector } from 'app/store/hooks';
@@ -30,11 +33,21 @@ const ForumList = () => {
3033
)
3134
}
3235
>
33-
<Flex column>
34-
{forums?.map((f: PublicForum) => (
35-
<ForumListEntry forum={f} key={f.id} />
36-
))}
37-
</Flex>
36+
<Helmet title="Forum" />
37+
{!forums.length && (
38+
<EmptyState
39+
iconNode={<MessageSquareDashed />}
40+
header="Her var det tomt ..."
41+
body="Opprett et nytt forum da vel!"
42+
/>
43+
)}
44+
{forums.length > 0 && (
45+
<Flex column>
46+
{forums?.map((f: PublicForum) => (
47+
<ForumListEntry forum={f} key={f.id} />
48+
))}
49+
</Flex>
50+
)}
3851
<LoadingIndicator loading={fetching} />
3952
</Page>
4053
);

app/routes/meetings/components/MeetingList.module.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@
1616
.meetingTime {
1717
color: var(--secondary-font-color);
1818
}
19-
20-
.noDataMessage {
21-
color: var(--secondary-font-color);
22-
text-align: center;
23-
}

app/routes/meetings/components/MeetingList.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import {
77
Page,
88
} from '@webkom/lego-bricks';
99
import { usePreparedEffect } from '@webkom/react-prepare';
10+
import { CalendarOff } from 'lucide-react';
1011
import moment from 'moment-timezone';
1112
import { useCallback, useEffect, useMemo, useState } from 'react';
1213
import { Helmet } from 'react-helmet-async';
1314
import { Link } from 'react-router-dom';
1415
import { fetchAll } from 'app/actions/MeetingActions';
16+
import EmptyState from 'app/components/EmptyState';
1517
import { Tag } from 'app/components/Tags';
1618
import Time from 'app/components/Time';
1719
import { useCurrentUser } from 'app/reducers/auth';
@@ -27,6 +29,7 @@ import styles from './MeetingList.module.css';
2729
import type { EntityId } from '@reduxjs/toolkit';
2830
import type { ListMeeting } from 'app/store/models/Meeting';
2931
import type { CurrentUser } from 'app/store/models/User';
32+
import type { Pagination } from 'app/utils/legoAdapter/buildPaginationReducer';
3033

3134
function MeetingListItem({
3235
meeting,
@@ -77,9 +80,13 @@ function MeetingListItem({
7780
const MeetingListView = ({
7881
sections,
7982
currentUser,
83+
fetchMorePagination,
84+
fetchOlderPagination,
8085
}: {
8186
sections: MeetingSection[];
8287
currentUser: CurrentUser;
88+
fetchMorePagination: Pagination;
89+
fetchOlderPagination: Pagination;
8390
}) => (
8491
<div>
8592
{sections.map((item, key) => (
@@ -91,7 +98,15 @@ const MeetingListView = ({
9198
</div>
9299
))}
93100
{!sections.length && (
94-
<h3 className={styles.noDataMessage}>Ingen møter å vise</h3>
101+
<EmptyState
102+
iconNode={<CalendarOff />}
103+
header={`Du har ingen ${
104+
!fetchMorePagination.hasMore && fetchOlderPagination.hasMore
105+
? 'kommende'
106+
: ''
107+
} møter`}
108+
body="Opprett et nytt et da vel!"
109+
/>
95110
)}
96111
</div>
97112
);
@@ -187,7 +202,12 @@ const MeetingList = () => {
187202
>
188203
<Helmet title="Dine møter" />
189204
{meetingSections && currentUser && (
190-
<MeetingListView currentUser={currentUser} sections={meetingSections} />
205+
<MeetingListView
206+
currentUser={currentUser}
207+
sections={meetingSections}
208+
fetchMorePagination={fetchMorePagination}
209+
fetchOlderPagination={fetchOlderPagination}
210+
/>
191211
)}
192212
<LoadingIndicator
193213
loading={fetchMorePagination.fetching || fetchOlderPagination.fetching}

0 commit comments

Comments
 (0)