11import { FC } from 'react'
2- import { Layer , RuntimeEvent , RuntimeTransaction , useGetRuntimeEvents } from '../../../oasis-nexus/api'
3- import { AppErrors } from '../../../types/errors'
4- import { TransactionLogEvent } from './LogEvent'
5- import { TextSkeleton } from '../../components/Skeleton'
2+ import { SearchScope } from '../../../types/searchScope'
3+ import { RuntimeEvent } from '../../../oasis-nexus/api'
64import { AddressSwitchOption } from '../AddressSwitch'
7- import { CardEmptyState } from '../../pages/AccountDetailsPage/CardEmptyState'
85import { useTranslation } from 'react-i18next'
9- import { SearchScope } from '../../../types/searchScope'
6+ import { CardEmptyState } from '../../pages/AccountDetailsPage/CardEmptyState'
7+ import { TextSkeleton } from '../Skeleton'
8+ import { RuntimeEventDetails } from './RuntimeEventDetails'
9+ import Divider from '@mui/material/Divider'
1010
11- export const TransactionLogs : FC < {
12- transaction : RuntimeTransaction
11+ const RuntimeEventDetailsWithSeparator : FC < {
12+ scope : SearchScope
13+ event : RuntimeEvent
14+ isFirst : boolean
1315 addressSwitchOption : AddressSwitchOption
14- } > = ( { transaction, addressSwitchOption } ) => {
15- const { network, layer } = transaction
16- if ( layer === Layer . consensus ) {
17- throw AppErrors . UnsupportedLayer
18- }
19- const eventsQuery = useGetRuntimeEvents ( network , layer , {
20- tx_hash : transaction . hash ,
21- limit : 100 , // We want to avoid pagination here, if possible
22- } )
23- const { isLoading, data, isError } = eventsQuery
16+ } > = ( { scope, event, isFirst, addressSwitchOption } ) => {
2417 return (
25- < TransactionLogsView
26- scope = { transaction }
27- events = { data ?. data ?. events }
28- isLoading = { isLoading }
29- isError = { isError }
30- addressSwitchOption = { addressSwitchOption }
31- />
18+ < >
19+ { ! isFirst && < Divider variant = "card" /> }
20+ < RuntimeEventDetails scope = { scope } event = { event } addressSwitchOption = { addressSwitchOption } />
21+ </ >
3222 )
3323}
3424
35- export const TransactionLogsView : FC < {
25+ export const RuntimeEventsDetailedList : FC < {
3626 scope : SearchScope
3727 events : RuntimeEvent [ ] | undefined
3828 isLoading : boolean
@@ -46,7 +36,7 @@ export const TransactionLogsView: FC<{
4636 { isLoading && < TextSkeleton numberOfRows = { 10 } /> }
4737 { events &&
4838 events . map ( ( event , index ) => (
49- < TransactionLogEvent
39+ < RuntimeEventDetailsWithSeparator
5040 key = { `event-${ index } ` }
5141 scope = { scope }
5242 isFirst = { ! index }
0 commit comments