-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from Plex-Engineer/staging
Staging
- Loading branch information
Showing
154 changed files
with
5,852 additions
and
7,836 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,7 @@ | ||
import React from "react"; | ||
|
||
const enableModal = () => { | ||
return <div>enableModal</div>; | ||
}; | ||
|
||
export default enableModal; |
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,130 @@ | ||
import styled from "@emotion/styled"; | ||
import { OutlinedButton, Text } from "global/packages/src"; | ||
import loadingGif from "assets/loading.gif"; | ||
import completeIcon from "assets/complete.svg"; | ||
import warningIcon from "assets/warning.svg"; | ||
import { | ||
getTransactionStatusString, | ||
transactionStatusActions, | ||
} from "global/utils/utils"; | ||
import { | ||
CantoTransactionType, | ||
TransactionState, | ||
} from "global/config/transactionTypes"; | ||
import { ReactNode, useEffect, useState } from "react"; | ||
import { Mixpanel } from "mixpanel"; | ||
|
||
interface Props { | ||
transactionType: CantoTransactionType; | ||
status: TransactionState; | ||
tokenName?: string; | ||
customMessage?: string | ReactNode; | ||
additionalMessage?: string | ReactNode; | ||
txHash?: string; | ||
onClose: () => void; | ||
//used for mix panel | ||
mixPanelEventInfo?: object; | ||
} | ||
|
||
const LoadingModal = (props: Props) => { | ||
const [txLogged, setTxLogged] = useState(false); | ||
const [txConfirmed, setTxConfirmed] = useState(false); | ||
const actionObj = transactionStatusActions( | ||
props.transactionType, | ||
props.tokenName | ||
); | ||
const currentStatus = getTransactionStatusString( | ||
actionObj.action, | ||
actionObj.inAction, | ||
actionObj.postAction, | ||
props.status | ||
); | ||
useEffect(() => { | ||
if (props.status == "PendingSignature" && !txLogged) { | ||
setTxLogged(true); | ||
Mixpanel.events.transactions.transactionStarted( | ||
props.transactionType, | ||
props.mixPanelEventInfo | ||
); | ||
} | ||
if (props.status == "Success" && !txConfirmed) { | ||
setTxConfirmed(true); | ||
Mixpanel.events.transactions.transactionSuccess( | ||
props.transactionType, | ||
props.txHash, | ||
props.mixPanelEventInfo | ||
); | ||
} | ||
if ( | ||
(props.status == "Fail" || props.status == "Exception") && | ||
!txConfirmed | ||
) { | ||
setTxConfirmed(true); | ||
Mixpanel.events.transactions.transactionFailed( | ||
props.transactionType, | ||
props.txHash, | ||
currentStatus, | ||
props.mixPanelEventInfo | ||
); | ||
} | ||
}, [props.status]); | ||
|
||
return ( | ||
<Styled> | ||
<img | ||
src={ | ||
props.status == "Success" | ||
? completeIcon | ||
: props.status == "Fail" || props.status == "Exception" | ||
? warningIcon | ||
: loadingGif | ||
} | ||
style={{ | ||
marginBottom: "1rem", | ||
}} | ||
height={80} | ||
width={80} | ||
/> | ||
<Text size="title2" type="title" style={{ marginBottom: "2rem" }}> | ||
{props.tokenName} | ||
</Text> | ||
<Text size="text1" type="text"> | ||
{props.customMessage ?? currentStatus} | ||
</Text> | ||
<br /> | ||
<Text size="text1" type="text"> | ||
{props.additionalMessage} | ||
</Text> | ||
{props.txHash ? ( | ||
<OutlinedButton | ||
className="btn" | ||
onClick={() => { | ||
Mixpanel.events.loadingModal.blockExplorerOpened(props.txHash); | ||
window.open( | ||
"https://evm.explorer.canto.io/tx/" + props.txHash, | ||
"_blank" | ||
); | ||
}} | ||
> | ||
open in block explorer | ||
</OutlinedButton> | ||
) : null} | ||
</Styled> | ||
); | ||
}; | ||
|
||
const Styled = styled.div` | ||
display: flex; | ||
background-color: black; | ||
height: 100%; | ||
width: 100%; | ||
z-index: 10; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 0 2rem; | ||
.btn { | ||
margin-top: 2rem; | ||
} | ||
`; | ||
export default LoadingModal; |
Oops, something went wrong.