-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
64 additions
and
73 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
44 changes: 44 additions & 0 deletions
44
client/src/app/components/stardust/history/TransactionId.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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { useContext } from "react"; | ||
import NetworkContext from "~/app/context/NetworkContext"; | ||
import { STARDUST_SUPPLY_INCREASE_TRANSACTION_ID, TransactionsHelper } from "~/helpers/stardust/transactionsHelper"; | ||
import { CHRYSALIS_MAINNET } from "~/models/config/networkType"; | ||
import TruncatedId from "../TruncatedId"; | ||
import Tooltip from "../../Tooltip"; | ||
|
||
export interface ITransactionIdProps { | ||
transactionId: string; | ||
milestoneIndex: number; | ||
} | ||
|
||
const TransactionId: React.FC<ITransactionIdProps> = ({ milestoneIndex, transactionId }) => { | ||
const { name: network } = useContext(NetworkContext); | ||
|
||
const isTransactionFromStardustGenesis = | ||
milestoneIndex && TransactionsHelper.isTransactionFromIotaStardustGenesis(network, milestoneIndex); | ||
|
||
const transactionLink = | ||
isTransactionFromStardustGenesis && !transactionId.includes(STARDUST_SUPPLY_INCREASE_TRANSACTION_ID) | ||
? `/${CHRYSALIS_MAINNET}/search/${transactionId}` | ||
: `/${network}/transaction/${transactionId}`; | ||
|
||
return ( | ||
<> | ||
{isTransactionFromStardustGenesis && transactionId.includes(STARDUST_SUPPLY_INCREASE_TRANSACTION_ID) ? ( | ||
<span>Stardust Genesis</span> | ||
) : ( | ||
<> | ||
<TruncatedId id={transactionId} link={transactionLink} /> | ||
{isTransactionFromStardustGenesis && ( | ||
<Tooltip tooltipContent="This link opens the transaction on Chrysalis Mainnet" childrenClass="row middle"> | ||
<span className="material-icons" style={{ fontSize: "14px" }}> | ||
warning | ||
</span> | ||
</Tooltip> | ||
)} | ||
</> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default TransactionId; |
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
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