Files
explore/ui/operation/tac/TacOperationDetails.tsx
tom goriunovandGitHub 28b9b27e8b Update styles for detailed views on mobile and more (#2875)
* update styles of tx details

* common color for text separator

* remove bold fontWeight from some details items

* address, block, token, pool, user ops details pages

* refactor chain-specific views

* unify grid column template for detailed views

* remove TODO

* update margins for text separator

* update screenshots

* update margin between icon and text for mobile

* rename prop

* update layout of decoded input data

* update screenshots

* fix tac operation and zilliqa quorum snippets
2025-08-12 22:56:03 +02:00

86 lines
2.7 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import React from 'react';
import type * as tac from '@blockscout/tac-operation-lifecycle-types';
import { sortStatusHistory } from 'lib/operations/tac';
import * as DetailedInfo from 'ui/shared/DetailedInfo/DetailedInfo';
import DetailedInfoTimestamp from 'ui/shared/DetailedInfo/DetailedInfoTimestamp';
import AddressEntityTacTon from 'ui/shared/entities/address/AddressEntityTacTon';
import TacOperationStatus from 'ui/shared/statusTag/TacOperationStatus';
import TacOperationLifecycleAccordion from './TacOperationLifecycleAccordion';
interface Props {
isLoading?: boolean;
data: tac.OperationDetails;
}
const TacOperationDetails = ({ isLoading, data }: Props) => {
const statusHistory = data.status_history.filter((item) => item.is_exist).sort(sortStatusHistory);
return (
<DetailedInfo.Container
templateColumns={{ base: 'minmax(0, 1fr)', lg: '210px minmax(728px, auto)' }}
>
{ data?.sender && (
<>
<DetailedInfo.ItemLabel
hint="The address on the source chain that starts a cross‑chain operation"
isLoading={ isLoading }
>
Sender
</DetailedInfo.ItemLabel>
<DetailedInfo.ItemValue>
<AddressEntityTacTon
address={{ hash: data.sender.address }}
chainType={ data.sender.blockchain }
isLoading={ isLoading }
/>
</DetailedInfo.ItemValue>
</>
) }
<DetailedInfo.ItemLabel
hint="The status of the operation"
isLoading={ isLoading }
>
Status
</DetailedInfo.ItemLabel>
<DetailedInfo.ItemValue>
<TacOperationStatus status={ data.type } isLoading={ isLoading }/>
</DetailedInfo.ItemValue>
{ data.timestamp && (
<>
<DetailedInfo.ItemLabel
hint="Block time on the source chain when a cross‑chain operation is formed and sent"
isLoading={ isLoading }
>
Timestamp
</DetailedInfo.ItemLabel>
<DetailedInfo.ItemValue>
<DetailedInfoTimestamp timestamp={ data.timestamp } isLoading={ isLoading }/>
</DetailedInfo.ItemValue>
</>
) }
{ statusHistory.length > 0 && (
<>
<DetailedInfo.ItemLabel
hint="Stages of a cross‑chain operation"
isLoading={ isLoading }
>
Lifecycle
</DetailedInfo.ItemLabel>
<DetailedInfo.ItemValue mt={ 1 }>
<TacOperationLifecycleAccordion data={ statusHistory } isLoading={ isLoading } type={ data.type }/>
</DetailedInfo.ItemValue>
</>
) }
</DetailedInfo.Container>
);
};
export default React.memo(TacOperationDetails);