This commit is contained in:
nicolas 2020-04-24 09:32:19 -03:00 committed by GitHub
parent 9d784922f2
commit 162ff84108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 13 deletions

View File

@ -31,26 +31,30 @@ const typeToLabel = {
}
const TxType = ({ origin, txType }: { txType: TransactionType, origin: string | null }) => {
const isThirdPartyApp = txType === 'third-party-app'
const [loading, setLoading] = useState(true)
const [appInfo, setAppInfo] = useState()
const [forceCustom, setForceCustom] = useState(false)
useEffect(() => {
const getAppInfo = async () => {
const parsedOrigin = getAppInfoFromOrigin(origin)
if (!parsedOrigin) {
setForceCustom(true)
return
}
const appInfo = await getAppInfoFromUrl(parsedOrigin.url)
setAppInfo(appInfo)
setLoading(false)
}
if (!isThirdPartyApp) {
if (!origin) {
return
}
getAppInfo()
}, [txType])
if (!isThirdPartyApp) {
if (forceCustom || !origin) {
return <IconText iconUrl={typeToIcon[txType]} text={typeToLabel[txType]} />
}

View File

@ -75,7 +75,7 @@ const getTransactionTableData = (tx: Transaction, cancelTx: ?Transaction): Trans
} else if (tx.cancellationTx) {
txType = 'cancellation'
} else if (tx.customTx) {
txType = tx.origin ? 'third-party-app' : 'custom'
txType = 'custom'
} else if (tx.creationTx) {
txType = 'creation'
} else if (tx.upgradeTx) {

View File

@ -7,14 +7,7 @@ import { type Confirmation } from '~/routes/safe/store/models/confirmation'
export const OUTGOING_TX_TYPE = 'outgoing'
export type TransactionType =
| 'incoming'
| 'outgoing'
| 'settings'
| 'custom'
| 'creation'
| 'cancellation'
| 'third-party-app'
export type TransactionType = 'incoming' | 'outgoing' | 'settings' | 'custom' | 'creation' | 'cancellation'
export type TransactionStatus =
| 'awaiting_your_confirmation'
@ -24,7 +17,6 @@ export type TransactionStatus =
| 'cancelled'
| 'awaiting_execution'
| 'pending'
| 'third-party-app'
export type TransactionProps = {
nonce: ?number,