diff --git a/src/assets/links/kycLinks.json b/src/assets/links/kycLinks.json new file mode 100644 index 000000000..b74295c37 --- /dev/null +++ b/src/assets/links/kycLinks.json @@ -0,0 +1,3 @@ +{ +"0x0C033bb39e67eB598D399C06A8A519498dA1Cec9": "https://qualify.swarm.markets" +} \ No newline at end of file diff --git a/src/components/auction/AuctionDetails/index.tsx b/src/components/auction/AuctionDetails/index.tsx index 9f0efb810..f25aea131 100644 --- a/src/components/auction/AuctionDetails/index.tsx +++ b/src/components/auction/AuctionDetails/index.tsx @@ -14,7 +14,7 @@ import { } from '../../../state/orderPlacement/hooks' import { AuctionIdentifier } from '../../../state/orderPlacement/reducer' import { useOrderbookState } from '../../../state/orderbook/hooks' -import { getExplorerLink, getTokenDisplay } from '../../../utils' +import { getExplorerLink, getTokenDisplay, shortenAddress } from '../../../utils' import { abbreviation } from '../../../utils/numeral' import { showChartsInverted } from '../../../utils/prices' import { KeyValue } from '../../common/KeyValue' @@ -330,6 +330,7 @@ const AuctionDetails = (props: Props) => { const toggleExtraDetails = () => { setShowMoreDetails(!showMoreDetails) } + const zeroAddress = '0x0000000000000000000000000000000000000000' const tokenSold = useMemo( () => @@ -429,20 +430,20 @@ const AuctionDetails = (props: Props) => { { title: 'Allow List Contract', tooltip: 'Address of the contract managing the allow-list for participation', - url: `https://etherscan.io/address/${auctionDetails?.allowListManager}`, + url: getExplorerLink(chainId, auctionDetails?.allowListManager, 'address'), value: `${ - auctionDetails && auctionDetails.allowListManager == '' - ? auctionDetails.allowListManager.substr(0, 6).concat('...') + auctionDetails && auctionDetails.allowListManager !== zeroAddress + ? shortenAddress(auctionDetails.allowListManager) : 'None' }`, }, { title: 'Signer Address', tooltip: 'Signer Address', - url: `https://etherscan.io/address/${auctionDetails?.allowListSigner}`, + url: getExplorerLink(chainId, auctionDetails?.allowListSigner, 'address'), value: `${ - auctionDetails && auctionDetails.allowListSigner == '' - ? auctionDetails.allowListSigner.substr(0, 6).concat('...') + auctionDetails && auctionDetails.allowListSigner !== zeroAddress + ? shortenAddress(auctionDetails.allowListSigner) : 'None' }`, }, diff --git a/src/components/auction/OrderPlacement/index.tsx b/src/components/auction/OrderPlacement/index.tsx index 9193a3e78..a8f8d66c8 100644 --- a/src/components/auction/OrderPlacement/index.tsx +++ b/src/components/auction/OrderPlacement/index.tsx @@ -1,7 +1,8 @@ import React, { useEffect, useMemo, useState } from 'react' -import styled from 'styled-components' +import styled, { css } from 'styled-components' import { Fraction, TokenAmount } from 'uniswap-xdai-sdk' +import kycLinks from '../../../assets/links/kycLinks.json' import { NUMBER_OF_DIGITS_FOR_INVERSION } from '../../../constants/config' import { useActiveWeb3React } from '../../../hooks' import { ApprovalState, useApproveCallback } from '../../../hooks/useApproveCallback' @@ -44,6 +45,22 @@ import { BaseCard } from '../../pureStyledComponents/BaseCard' import { EmptyContentText } from '../../pureStyledComponents/EmptyContent' import { InfoType } from '../../pureStyledComponents/FieldRow' +const LinkCSS = css` + color: ${({ theme }) => theme.text1}; + text-decoration: none; + transition: color 0.05s linear; + font-size: 1.5em; + font-weight: bold; + + &:hover { + color: ${({ theme }) => theme.primary2}; + } +` + +const ExternalLink = styled.a` + ${LinkCSS} +` + const Wrapper = styled(BaseCard)` max-width: 100%; min-height: 392px; @@ -326,19 +343,35 @@ const OrderPlacement: React.FC = (props) => { !!account && !!biddingToken.address + const auctioningTokenAddress = auctioningToken && auctioningToken?.address + const linkForKYC = auctioningTokenAddress ? kycLinks[auctioningTokenAddress] : null return ( <> {auctionInfoLoading && } {!auctionInfoLoading && isPrivate && !signatureAvailable && ( - - - Private auction - - You are not allowed to place an order. - - Ask the auctioneer to get allow-listed. - + <> + + + Private auction + {account !== null && ( + + You need to get allowed to participate. + + )} + + {account == null ? ( + Connect Wallet + ) : ( + + {linkForKYC ? ( + Get Allowed ↗ + ) : ( + <>Ask the auctioneer to get allow-listed. + )}{' '} + + )} + )} {!auctionInfoLoading && (!isPrivate || signatureAvailable) && ( <> diff --git a/src/components/auction/OrdersTable/index.tsx b/src/components/auction/OrdersTable/index.tsx index f7608fb71..1e3a885a5 100644 --- a/src/components/auction/OrdersTable/index.tsx +++ b/src/components/auction/OrdersTable/index.tsx @@ -1,6 +1,8 @@ import React, { useCallback, useState } from 'react' import styled from 'styled-components' +import * as CSS from 'csstype' + import { NUMBER_OF_DIGITS_FOR_INVERSION } from '../../../constants/config' import { useCancelOrderCallback } from '../../../hooks/useCancelOrderCallback' import { @@ -16,7 +18,6 @@ import { abbreviation } from '../../../utils/numeral' import { getInverse } from '../../../utils/prices' import { getChainName } from '../../../utils/tools' import { Button } from '../../buttons/Button' -import { KeyValue } from '../../common/KeyValue' import { Tooltip } from '../../common/Tooltip' import { InfoIcon } from '../../icons/InfoIcon' import { OrderPending } from '../../icons/OrderPending' @@ -39,13 +40,41 @@ const Title = styled(PageTitle)` margin-bottom: 16px; margin-top: 0; ` +interface RowProps { + hiddenMd?: boolean +} -const Row = styled(CellRow)` +const Row = styled(CellRow)>` grid-template-columns: 1fr 1fr; row-gap: 15px; + color: ${({ theme }) => theme.dropdown.item.color}; + ${(props) => props.hiddenMd && 'display : none'}; + align-items: center; + font-size: 16px; + p { + display: flex; + margin: 0; + align-items: center; + } + p + span { + display: flex; + svg { + margin-left: 6px; + } + } + .tooltipComponent { + margin-left: 6px; + } @media (min-width: ${({ theme }) => theme.themeBreakPoints.md}) { grid-template-columns: ${(props) => getColumns(props.columns)}; + ${(props) => props.hiddenMd && 'display : grid'}; + > span { + line-height: 1; + } + p { + display: none; + } } ` @@ -78,6 +107,16 @@ const ActionButton = styled(Button)` } ` +const StyledCell = styled.div` + display: flex; + align-items: center; + color: ${({ theme }) => theme.dropdown.item.color}; + font-size: 14px; + > *:first-child { + padding-right: 6px; + } +` + interface OrdersTableProps { auctionIdentifier: AuctionIdentifier derivedAuctionInfo: DerivedAuctionInfo @@ -171,58 +210,54 @@ const OrdersTable: React.FC = (props) => { )} {!ordersEmpty && ( + + +
Amount
+ +
+ +
Limit Price
+ +
+ +
Status
+
+ +
Network
+
+
{ordersSortered.map((order) => ( - - Amount - - - } - itemValue={abbreviation(order.sellAmount)} - /> +

+ Amount + +

+ {abbreviation(order.sellAmount)}
- - Limit Price - - - } - itemValue={abbreviation( +

+ Limit Price + +

+ + {abbreviation( showPriceInverted ? getInverse(order.price, NUMBER_OF_DIGITS_FOR_INVERSION) : order.price, )} - /> +
- Status} - itemValue={ - <> - {orderStatusText[order.status]} - {order.status === OrderStatus.PLACED ? : } - - } - /> +

Status

+ + {orderStatusText[order.status]} + {order.status === OrderStatus.PLACED ? : } +
- Network} - itemValue={ - <> - {getChainName(order.chainId)} - - } - /> +

Network

+ {getChainName(order.chainId)}
{!hideCancelButton && ( diff --git a/src/components/auctions/AllAuctions/index.tsx b/src/components/auctions/AllAuctions/index.tsx index 350fc418b..1d1556312 100644 --- a/src/components/auctions/AllAuctions/index.tsx +++ b/src/components/auctions/AllAuctions/index.tsx @@ -1,12 +1,12 @@ -import React, { useMemo, useState } from 'react' +import React, { useMemo, useRef, useState } from 'react' import { NavLink } from 'react-router-dom' import styled, { css } from 'styled-components' +import * as CSS from 'csstype' import { useFilters, useGlobalFilter, usePagination, useTable } from 'react-table' import { ButtonSelect } from '../../buttons/ButtonSelect' import { Dropdown, DropdownDirection, DropdownItem, DropdownPosition } from '../../common/Dropdown' -import { KeyValue } from '../../common/KeyValue' import { ChevronRight } from '../../icons/ChevronRight' import { Delete } from '../../icons/Delete' import { InfoIcon } from '../../icons/InfoIcon' @@ -28,8 +28,7 @@ const SectionTitle = styled(PageTitle)` font-size: 22px; margin-bottom: 14px; ` - -const RowLink = styled(NavLink)` +const rowCss = css` ${CellRowCSS} column-gap: 6px; cursor: pointer; @@ -44,7 +43,7 @@ const RowLink = styled(NavLink)` @media (min-width: ${({ theme }) => theme.themeBreakPoints.md}) { column-gap: 10px; - grid-template-columns: 1fr 1fr 1fr 1fr 1fr; + grid-template-columns: 1fr 80px 1fr 1fr 1fr 1fr 100px 1fr 100px 20px; padding-left: 15px; padding-right: 15px; } @@ -54,7 +53,33 @@ const RowLink = styled(NavLink)` } ` -const TableCell = styled(Cell)` +const RowLink = styled(NavLink)` + ${rowCss} +` + +const RowHead = styled.div` + ${rowCss} + pointer-events: none; + font-size: 14px; + display: none; + @media (min-width: ${({ theme }) => theme.themeBreakPoints.md}) { + display: grid; + grid-template-columns: 1fr 80px 1fr 1fr 1fr 1fr 100px 1fr 100px 20px; + } + @media (min-width: ${({ theme }) => theme.themeBreakPoints.xl}) { + grid-template-columns: ${(props) => getColumns(props.columns)}; + } +` + +interface CellProps { + fs?: string +} +const TableCell = styled(Cell)>` + color: ${({ theme }) => theme.textField.color}; + display: flex; + justify-content: center; + flex-direction: column; + font-size: ${(props) => props.fs || '16px'}; &:last-child { position: absolute; right: 15px; @@ -62,6 +87,21 @@ const TableCell = styled(Cell)` transform: translateY(-50%); } + > span { + display: flex; + align-items: center; + > *:not(:last-child) { + margin-right: 6px; + } + &:last-child { + font-size: 16px; + font-weight: bold; + @media (min-width: ${({ theme }) => theme.themeBreakPoints.md}) { + display: none; + } + } + } + @media (min-width: ${({ theme }) => theme.themeBreakPoints.xl}) { &:last-child { position: unset; @@ -72,13 +112,6 @@ const TableCell = styled(Cell)` } ` -const KeyValueStyled = styled(KeyValue)` - .itemKey, - .itemValue { - white-space: nowrap; - } -` - const TableControls = styled.div` margin-bottom: 28px; @@ -260,6 +293,18 @@ const PaginationItem = styled.div` } ` +const TBody = styled.div` + min-height: 266px; + @media (max-width: ${({ theme }) => theme.themeBreakPoints.md}) { + > div:first-child { + position: relative !important; + } + > div:not(:first-child) { + display: none !important; + } + } +` + interface Props { tableData: any[] } @@ -422,6 +467,8 @@ const AllAuctions = (props: Props) => { usePagination, ) + const sectionHead = useRef(null) + const updateFilter = (column?: string | undefined, value?: string | undefined) => { setAllFilters([]) if (column && value) { @@ -477,8 +524,18 @@ const AllAuctions = (props: Props) => { const noAuctionsFound = page.length === 0 const noData = noAuctions || noAuctionsFound + function handleNextPage() { + nextPage() + sectionHead.current.scrollIntoView() + } + + function handlePrevPage() { + previousPage() + sectionHead.current.scrollIntoView() + } + return ( - + Auctions @@ -534,30 +591,39 @@ const AllAuctions = (props: Props) => { ) : ( <> - {page.map((row, i) => { - prepareRow(row) - return ( - - {row.cells.map( - (cell, j) => - cell.render('show') && ( - - - - ), - )} - - ) - })} + + {prepareRow(page[0])} + {page[0].cells.map( + (cell, i) => + cell.render('show') && ( + + {cell.render('Header')} + + ), + )} + + + {page.map((row, i) => { + prepareRow(row) + return ( + + {row.cells.map( + (cell, j) => + cell.render('show') && ( + + {cell.render('Cell')} + {cell.render('Header')} + + ), + )} + + ) + })} + Items per page{' '} @@ -588,10 +654,10 @@ const AllAuctions = (props: Props) => { : (pageIndex + 1) * pageSize}{' '} of {rows.length} auctions {' '} - previousPage()}> + handlePrevPage()}> - nextPage()}> + handleNextPage()}> diff --git a/src/components/common/TopDisclaimer/index.tsx b/src/components/common/TopDisclaimer/index.tsx index fdbf6e0df..1bc1e5fea 100644 --- a/src/components/common/TopDisclaimer/index.tsx +++ b/src/components/common/TopDisclaimer/index.tsx @@ -9,6 +9,7 @@ const Wrapper = styled.div` flex-shrink: 0; min-height: 30px; padding: 5px 0; + width: 100%; ` const Inner = styled(InnerContainer)` diff --git a/src/components/form/AmountInputPanel/index.tsx b/src/components/form/AmountInputPanel/index.tsx index 079384211..e53062b04 100644 --- a/src/components/form/AmountInputPanel/index.tsx +++ b/src/components/form/AmountInputPanel/index.tsx @@ -78,6 +78,12 @@ const Balance = styled.div<{ disabled?: boolean }>` ${(props) => props.disabled && 'opacity: 0.7;'} ` +const Wrap = styled.div` + display: flex; + flex-grow: 1; + align-items: center; +` + Balance.defaultProps = { disabled: false, } @@ -138,7 +144,7 @@ const AmountInputPanel: React.FC = (props) => { -
+ {token && ( {token.address && ( @@ -197,7 +203,7 @@ const AmountInputPanel: React.FC = (props) => { Unwrap )} -
+