Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Hide Expired status in tx history #3659

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/transactions/TxDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const TxDetailsBlock = ({ txSummary, txDetails }: TxDetailsProps): ReactElement
</Box>
)}

{expiredSwap && (
{isQueue && expiredSwap && (
<Typography color="text.secondary" mt={2}>
This order has expired. Reject this transaction and try again.
</Typography>
Expand Down
2 changes: 1 addition & 1 deletion src/components/transactions/TxSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const TxSummary = ({ item, isGrouped }: TxSummaryProps): ReactElement => {
</Box>
)}

{expiredSwap && (
{isQueue && expiredSwap && (
<Box gridArea="status" justifyContent="flex-end" display="flex" className={css.status}>
<StatusLabel status="expired" />
</Box>
Expand Down
4 changes: 2 additions & 2 deletions src/features/swap/hooks/useIsExpiredSwap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react'
import type { TransactionInfo } from '@safe-global/safe-gateway-typescript-sdk'
import useInterval from '@/hooks/useInterval'
import { isExpiredSwap as isSwapInfoExpired, isSwapTxInfo } from '@/utils/transaction-guards'
import { isSwapTxInfo } from '@/utils/transaction-guards'

const INTERVAL_IN_MS = 10_000

Expand All @@ -16,7 +16,7 @@ const useIsExpiredSwap = (txInfo: TransactionInfo) => {
const isExpiredSwap = () => {
if (!isSwapTxInfo(txInfo)) return

setIsExpired(Date.now() > txInfo.validUntil * 1000 && isSwapInfoExpired(txInfo))
setIsExpired(Date.now() > txInfo.validUntil * 1000)
}

useInterval(isExpiredSwap, INTERVAL_IN_MS)
Expand Down
4 changes: 0 additions & 4 deletions src/utils/transaction-guards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ export const isSwapConfirmationViewOrder = (
return false
}

export const isExpiredSwap = (value: TransactionInfo) => {
return isSwapTxInfo(value) && value.status === 'expired'
}

export const isCancelledSwap = (value: TransactionInfo) => {
return isSwapTxInfo(value) && value.status === 'cancelled'
}
Expand Down
Loading