Skip to content

Commit

Permalink
mobile tx modal
Browse files Browse the repository at this point in the history
  • Loading branch information
namgold committed Jul 17, 2023
1 parent c90cb60 commit bc6def8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 27 deletions.
65 changes: 40 additions & 25 deletions src/pages/KyberDAO/KNCUtility/EligibleTxModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Trans } from '@lingui/macro'
import { useState } from 'react'
import { useMedia } from 'react-use'
import { Flex, Text } from 'rebass'
import styled from 'styled-components'

Expand All @@ -10,7 +11,7 @@ import { NativeCurrencies } from 'constants/tokens'
import { useActiveWeb3React } from 'hooks'
import { useEligibleTransactions } from 'hooks/kyberdao'
import useTheme from 'hooks/useTheme'
import { ExternalLinkIcon } from 'theme'
import { ExternalLinkIcon, MEDIA_WIDTHS } from 'theme'
import { formattedNum, getEtherscanLink } from 'utils'

import { HeaderCell, Table, TableHeader, TableRow } from './TxTable'
Expand All @@ -21,6 +22,9 @@ const Wrapper = styled.div`
padding: 24px 24px 30px;
background-color: ${({ theme }) => theme.tableHeader};
min-width: 550px;
${({ theme }) => theme.mediaWidth.upToExtraSmall`
min-width: unset;
`}
`

const IconWrapper = styled.div`
Expand All @@ -44,6 +48,8 @@ export default function EligibleTxModal({ isOpen, closeModal }: { isOpen: boolea
const [currentPage, setCurrentPage] = useState(1)
const eligibleTxs = useEligibleTransactions(currentPage, 10)
const theme = useTheme()
const upToExtraSmall = useMedia(`(max-width: ${MEDIA_WIDTHS.upToExtraSmall}px)`)
const upToMedium = useMedia(`(max-width: ${MEDIA_WIDTHS.upToMedium}px)`)

Check warning on line 52 in src/pages/KyberDAO/KNCUtility/EligibleTxModal.tsx

View workflow job for this annotation

GitHub Actions / cypress-test

'upToMedium' is assigned a value but never used

return (
<Modal isOpen={isOpen} onDismiss={closeModal} maxWidth="800px" width="70vw">
Expand All @@ -58,12 +64,16 @@ export default function EligibleTxModal({ isOpen, closeModal }: { isOpen: boolea
<HeaderCell>
<Trans>TXN HASH</Trans>
</HeaderCell>
<HeaderCell>
<Trans>LOCAL TIME</Trans>
</HeaderCell>
<HeaderCell>
<Trans>GAS FEE</Trans>
</HeaderCell>
{upToExtraSmall ? null : (
<>
<HeaderCell>
<Trans>LOCAL TIME</Trans>
</HeaderCell>
<HeaderCell>
<Trans>GAS FEE</Trans>
</HeaderCell>
</>
)}
<HeaderCell textAlign="right">
<Trans>GAS REFUND REWARDS</Trans>
</HeaderCell>
Expand All @@ -87,24 +97,29 @@ export default function EligibleTxModal({ isOpen, closeModal }: { isOpen: boolea
/>
</Flex>
</HeaderCell>
<HeaderCell>
<Flex flexDirection="column" sx={{ gap: '4px' }}>
<Text>{time.toLocaleDateString()}</Text>
<Text fontWeight={400} color={theme.subText}>
{time.toLocaleTimeString()}
</Text>
</Flex>
</HeaderCell>
<HeaderCell>
<Flex flexDirection="column" sx={{ gap: '4px' }}>
<Text>
{formattedNum(tx.gasFeeInNativeToken)} {NativeCurrencies[chainId].symbol}
</Text>
<Text fontWeight={400} color={theme.subText}>
{formattedNum(tx.gasFeeInUSD, true)}
</Text>
</Flex>
</HeaderCell>
{upToExtraSmall ? null : (
<>
<HeaderCell>
<Flex flexDirection="column" sx={{ gap: '4px' }}>
<Text>{time.toLocaleDateString()}</Text>
<Text fontWeight={400} color={theme.subText}>
{time.toLocaleTimeString()}
</Text>
</Flex>
</HeaderCell>
<HeaderCell>
<Flex flexDirection="column" sx={{ gap: '4px' }}>
<Text>
{formattedNum(tx.gasFeeInNativeToken)} {NativeCurrencies[chainId].symbol}
</Text>
<Text fontWeight={400} color={theme.subText}>
{formattedNum(tx.gasFeeInUSD, true)}
</Text>
</Flex>
</HeaderCell>
</>
)}

<HeaderCell textAlign="right">
<Flex flexDirection="column" sx={{ gap: '4px' }}>
<Text>{formattedNum(tx.gasRefundInKNC)} KNC</Text>
Expand Down
9 changes: 7 additions & 2 deletions src/pages/KyberDAO/KNCUtility/TxTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@ export const Row = styled.div<{ $background?: string }>`
display: grid;
align-items: center;
grid-template-columns: 2fr 1fr 1fr 2fr;
grid-template-columns: 2fr 1fr 1fr 1.5fr;
column-gap: 16px;
border-top: 1px solid ${({ theme }) => theme.border};
${({ theme }) => theme.mediaWidth.upToExtraSmall`
${({ theme }) => theme.mediaWidth.upToMedium`
grid-template-columns: 2fr 1fr 1fr 1fr;
column-gap: 8px;
`}
${({ theme }) => theme.mediaWidth.upToExtraSmall`
grid-template-columns: 1fr 1fr;
`}
&[role="button"] {
cursor: pointer;
}
Expand Down

0 comments on commit bc6def8

Please sign in to comment.