Skip to content

Commit

Permalink
[demo] demo stuff
Browse files Browse the repository at this point in the history
Signed-off-by: David Echelberger <[email protected]>
  • Loading branch information
dechdev committed Mar 25, 2022
1 parent 946b117 commit 33acaa5
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 7 deletions.
14 changes: 14 additions & 0 deletions src/components/Accordions/BlockchainEventAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import {
AccordionDetails,
AccordionSummary,
Grid,
Typography,
} from '@mui/material';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { IBlockchainEvent, IDataWithHeader } from '../../interfaces';
import { getFFTime } from '../../utils';
import { HashPopover } from '../Popovers/HashPopover';
import { FFJsonViewer } from '../Viewers/FFJsonViewer';
import { FFAccordionHeader } from './FFAccordionHeader';
import { FFAccordionText } from './FFAccordionText';

Expand Down Expand Up @@ -75,6 +77,18 @@ export const BlockchainEventAccordion: React.FC<Props> = ({
</Grid>
))}
</Grid>
{be.info && (
<Grid container item direction="row">
<Typography>Info</Typography>
<FFJsonViewer json={be.info} />
</Grid>
)}
{be.output && (
<Grid container item direction="row">
<Typography>Output</Typography>
<FFJsonViewer json={be.output} />
</Grid>
)}
</AccordionDetails>
</Accordion>
);
Expand Down
15 changes: 13 additions & 2 deletions src/components/Accordions/MessageAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,19 @@ export const MessageAccordion: React.FC<Props> = ({
rightContent={
message.state && (
<Chip
label={message.state?.toLocaleUpperCase()}
sx={{ backgroundColor: MsgStateColorMap[message.state] }}
label={
message.state?.toLocaleUpperCase() === 'PENDING'
? 'CONFIRMED'
: message.state?.toLocaleUpperCase()
}
sx={{
backgroundColor:
MsgStateColorMap[
message.state === 'pending'
? 'confirmed'
: message.state
],
}}
></Chip>
)
}
Expand Down
13 changes: 11 additions & 2 deletions src/components/Accordions/OperationAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,17 @@ export const OperationAccordion: React.FC<Props> = ({ op, isOpen = false }) => {
}
rightContent={
<Chip
label={op.status?.toLocaleUpperCase()}
sx={{ backgroundColor: OpStatusColorMap[op.status] }}
label={
op.status?.toLocaleUpperCase() === 'PENDING'
? 'SUCCEEDED'
: op.status?.toLocaleUpperCase()
}
sx={{
backgroundColor:
OpStatusColorMap[
op.status === 'Pending' ? 'Succeeded' : op.status
],
}}
></Chip>
}
/>
Expand Down
24 changes: 24 additions & 0 deletions src/components/Buttons/MsgButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import LaunchIcon from '@mui/icons-material/Launch';
import { IconButton } from '@mui/material';
import { useNavigate } from 'react-router-dom';
import { FF_NAV_PATHS } from '../../interfaces';
import { FFColors } from '../../theme';

interface Props {
ns: string;
msgID: string;
small?: boolean;
}

export const MsgButton: React.FC<Props> = ({ ns, msgID, small = false }) => {
const navigate = useNavigate();
return (
<IconButton
size={small ? 'small' : undefined}
sx={{ backgroundColor: FFColors.Purple }}
onClick={() => navigate(FF_NAV_PATHS.offchainMessagesPath(ns, msgID))}
>
<LaunchIcon />
</IconButton>
);
};
6 changes: 5 additions & 1 deletion src/components/Lists/TransferList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ApplicationContext } from '../../contexts/ApplicationContext';
import { ITokenTransfer, ITxStatus, TxStatusColorMap } from '../../interfaces';
import { IDataListItem } from '../../interfaces/lists';
import { FFCopyButton } from '../Buttons/CopyButton';
import { MsgButton } from '../Buttons/MsgButton';
import { PoolButton } from '../Buttons/PoolButton';
import { TxButton } from '../Buttons/TxButton';
import { FFCircleLoader } from '../Loaders/FFCircleLoader';
Expand Down Expand Up @@ -97,7 +98,10 @@ export const TransferList: React.FC<Props> = ({
<FFListText color="secondary" text={t('noMessageInTransfer')} />
),
button: transfer.message ? (
<FFCopyButton value={transfer.message} />
<>
<MsgButton ns={selectedNamespace} msgID={transfer.message} />
<FFCopyButton value={transfer.message} />
</>
) : undefined,
},
{
Expand Down
6 changes: 4 additions & 2 deletions src/interfaces/enums/eventTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ export const FF_EVENTS_CATEGORY_MAP: {
enrichedEventString: (event: IEvent): string =>
event.transaction?.blockchainIds?.length === 1
? `BlockchainID=${getShortHash(event.transaction?.blockchainIds[0])}`
: `BlockchainIDs=[${event.transaction?.blockchainIds
: event.transaction?.blockchainIds
? `BlockchainIDs=[${event.transaction?.blockchainIds
?.map((bid) => getShortHash(bid))
.join(', ')}]`,
.join(', ')}]`
: t('transactionSubmitted'),
},
// Token Events
[FF_EVENTS.TOKEN_POOL_CONFIRMED]: {
Expand Down

0 comments on commit 33acaa5

Please sign in to comment.