Skip to content

Commit 4cb042d

Browse files
committed
Update empty lists component to CardEmptyState
1 parent a4ac7bd commit 4cb042d

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

.changelog/1932.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use EmptyState instead of CardEmptyState for empty lists.

src/app/components/RuntimeEvents/RuntimeEventsDetailedList.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,21 @@ export const RuntimeEventsDetailedList: FC<{
1818
showTxHash: boolean
1919
}> = ({ scope, events, isLoading, isError, pagination, showTxHash }) => {
2020
const { t } = useTranslation()
21+
22+
if (isError) {
23+
return <CardEmptyState label={t('event.cantLoadEvents')} />
24+
}
25+
26+
if (isLoading) {
27+
return <TextSkeleton numberOfRows={10} />
28+
}
29+
30+
if (!events?.length) {
31+
return <CardEmptyState label={t('event.cantFindMatchingEvents')} />
32+
}
33+
2134
return (
2235
<>
23-
{isError && <CardEmptyState label={t('event.cantLoadEvents')} />}
24-
{isLoading && <TextSkeleton numberOfRows={10} />}
2536
{events &&
2637
events.map((event, index) => (
2738
<div key={`event-${index}`}>

src/app/components/Transactions/ConsensusTransactionEvents.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AppErrors } from '../../../types/errors'
55
import { NUMBER_OF_ITEMS_ON_SEPARATE_PAGE as limit } from '../../config'
66
import { ConsensusEventsList } from '../ConsensusEvents/ConsensusEventsList'
77
import { useSearchParamsPagination } from '../Table/useSearchParamsPagination'
8-
import { EmptyState } from '../EmptyState'
8+
import { CardEmptyState } from '../CardEmptyState'
99

1010
export const ConsensusTransactionEvents: FC<{
1111
transaction: Transaction
@@ -25,9 +25,7 @@ export const ConsensusTransactionEvents: FC<{
2525
}
2626

2727
if (!events?.length && isFetched) {
28-
return (
29-
<EmptyState description={t('event.cantFindMatchingEvents')} title={t('event.noEvents')} light={true} />
30-
)
28+
return <CardEmptyState label={t('event.cantFindMatchingEvents')} />
3129
}
3230

3331
return (

src/app/pages/ConsensusAccountDetailsPage/ConsensusAccountEventsCard.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { ConsensusAccountDetailsContext } from './hooks'
77
import { NUMBER_OF_ITEMS_ON_SEPARATE_PAGE as limit } from '../../config'
88
import { LinkableCardLayout } from '../../components/LinkableCardLayout'
99
import { useSearchParamsPagination } from '../..//components/Table/useSearchParamsPagination'
10-
import { EmptyState } from '../../components/EmptyState'
1110
import { eventsContainerId } from '../../utils/tabAnchors'
11+
import { CardEmptyState } from 'app/components/CardEmptyState'
1212

1313
const ConsensusAccountEventsList: FC<ConsensusAccountDetailsContext> = ({ scope, address }) => {
1414
const { t } = useTranslation()
@@ -26,9 +26,7 @@ const ConsensusAccountEventsList: FC<ConsensusAccountDetailsContext> = ({ scope,
2626
}
2727

2828
if (!events?.length && isFetched) {
29-
return (
30-
<EmptyState description={t('event.cantFindMatchingEvents')} title={t('event.noEvents')} light={true} />
31-
)
29+
return <CardEmptyState label={t('event.cantFindMatchingEvents')} />
3230
}
3331

3432
return (

src/app/pages/ConsensusBlockDetailPage/ConsensusBlockEventsCard.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { AppErrors } from '../../../types/errors'
55
import { NUMBER_OF_ITEMS_ON_SEPARATE_PAGE as limit } from '../../config'
66
import { LinkableCardLayout } from '../../components/LinkableCardLayout'
77
import { useSearchParamsPagination } from '../../components/Table/useSearchParamsPagination'
8-
import { EmptyState } from '../../components/EmptyState'
98
import { ConsensusBlockDetailsContext } from '.'
109
import { ConsensusEventsList } from '../../components/ConsensusEvents/ConsensusEventsList'
1110
import { eventsContainerId } from '../../utils/tabAnchors'
11+
import { CardEmptyState } from 'app/components/CardEmptyState'
1212

1313
const ConsensusBlockEventsList: FC<ConsensusBlockDetailsContext> = ({ scope, blockHeight }) => {
1414
const { t } = useTranslation()
@@ -26,9 +26,7 @@ const ConsensusBlockEventsList: FC<ConsensusBlockDetailsContext> = ({ scope, blo
2626
}
2727

2828
if (!events?.length && isFetched) {
29-
return (
30-
<EmptyState description={t('event.cantFindMatchingEvents')} title={t('event.noEvents')} light={true} />
31-
)
29+
return <CardEmptyState label={t('event.cantFindMatchingEvents')} />
3230
}
3331

3432
return (

src/app/pages/RuntimeBlockDetailPage/RuntimeBlockEventsCard.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { LinkableCardLayout } from '../../components/LinkableCardLayout'
66
import { useSearchParamsPagination } from '../../components/Table/useSearchParamsPagination'
77
import { AppErrors } from '../../../types/errors'
88
import { RuntimeEventsDetailedList } from '../../components/RuntimeEvents/RuntimeEventsDetailedList'
9-
import { EmptyState } from '../../components/EmptyState'
109
import { RuntimeBlockDetailsContext } from '.'
1110
import { eventsContainerId } from '../../utils/tabAnchors'
11+
import { CardEmptyState } from 'app/components/CardEmptyState'
1212

1313
const EventsList: FC<RuntimeBlockDetailsContext> = ({ scope, blockHeight }) => {
1414
const { t } = useTranslation()
@@ -31,9 +31,7 @@ const EventsList: FC<RuntimeBlockDetailsContext> = ({ scope, blockHeight }) => {
3131
const events = data?.data.events
3232

3333
if (!events?.length && !isLoading) {
34-
return (
35-
<EmptyState description={t('event.cantFindMatchingEvents')} title={t('event.noEvents')} light={true} />
36-
)
34+
return <CardEmptyState label={t('event.cantFindMatchingEvents')} />
3735
}
3836

3937
return (

0 commit comments

Comments
 (0)