-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move events to tabs in runtime account details
- Loading branch information
Showing
4 changed files
with
36 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Move events cards to tabs |
45 changes: 26 additions & 19 deletions
45
src/app/pages/RuntimeAccountDetailsPage/AccountEventsCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
import { FC } from 'react' | ||
import { RuntimeEvent } from '../../../oasis-nexus/api' | ||
import { SubPageCard } from 'app/components/SubPageCard' | ||
import Card from '@mui/material/Card' | ||
import CardHeader from '@mui/material/CardHeader' | ||
import CardContent from '@mui/material/CardContent' | ||
import { useTranslation } from 'react-i18next' | ||
import { RuntimeEventsDetailedList } from '../../components/RuntimeEvents/RuntimeEventsDetailedList' | ||
import { SearchScope } from '../../../types/searchScope' | ||
import { AddressSwitchOption } from '../../components/AddressSwitch' | ||
import { ErrorBoundary } from '../../components/ErrorBoundary' | ||
import { LinkableDiv } from '../../components/PageLayout/LinkableDiv' | ||
import { useAccountEvents } from './hook' | ||
import { RuntimeAccountDetailsContext } from '.' | ||
|
||
type AccountEventProps = { | ||
scope: SearchScope | ||
isLoading: boolean | ||
isError: boolean | ||
events: RuntimeEvent[] | undefined | ||
} | ||
export const eventsContainerId = 'events' | ||
|
||
export const AccountEventsCard: FC<AccountEventProps> = ({ scope, isLoading, isError, events }) => { | ||
export const AccountEventsCard: FC<RuntimeAccountDetailsContext> = ({ scope, address }) => { | ||
const { t } = useTranslation() | ||
const { isLoading, isError, events } = useAccountEvents(scope, address) | ||
|
||
return ( | ||
<SubPageCard title={t('common.events')}> | ||
<RuntimeEventsDetailedList | ||
scope={scope} | ||
events={events} | ||
isLoading={isLoading} | ||
isError={isError} | ||
addressSwitchOption={AddressSwitchOption.ETH} // TODO | ||
/> | ||
</SubPageCard> | ||
<Card> | ||
<LinkableDiv id={eventsContainerId}> | ||
<CardHeader disableTypography component="h3" title={t('common.events')} /> | ||
</LinkableDiv> | ||
<CardContent> | ||
<ErrorBoundary light={true}> | ||
<RuntimeEventsDetailedList | ||
scope={scope} | ||
events={events} | ||
isLoading={isLoading} | ||
isError={isError} | ||
addressSwitchOption={AddressSwitchOption.ETH} // TODO | ||
/> | ||
</ErrorBoundary> | ||
</CardContent> | ||
</Card> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters