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: Minor design and sdk bugs #2626

Merged
merged 3 commits into from
Jul 19, 2023
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
3 changes: 3 additions & 0 deletions packages/app/src/assets/svg/app/docs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/app/src/assets/svg/app/support.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ const CurrencyCard: FC<CurrencyCardProps> = memo(
const hasCurrencySelectCallback = !!onCurrencySelect

const tokenName = useMemo(() => {
return currencyKey && currencyKey[0] === 's'
? t('common.currency.synthetic-currency-name', { currencyName })
: currencyName || t('exchange.currency-card.synth-name')
}, [currencyKey, currencyName, t])
return currencyName || t('exchange.currency-card.synth-name')
}, [currencyName, t])

return (
<CardContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ const HoursToggle: React.FC = () => {
</ToggleContainer>
)
}

// solid ${(props) => props.theme.colors.selectedTheme.newTheme.pill['gray'].border};
const ToggleTableRow = styled.div`
margin: auto;
padding: 1.5px 6px;
height: ${HOURS_TOGGLE_HEIGHT};
background: ${(props) => props.theme.colors.selectedTheme.newTheme.pill['gray'].background};
border: 1px solid ${(props) => props.theme.colors.selectedTheme.newTheme.pill['gray'].border};
border-width: 0px;

:last-child {
border-radius: 0px 0px 9px 9px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@
dataKey={MarketDataKey.dailyChange}
value={
indexPriceWei.gt(0) && pastPrice?.rate
? formatPercent(indexPriceWei.sub(pastPrice.rate).div(indexPriceWei) ?? ZERO_WEI)
? formatPercent(indexPriceWei.sub(pastPrice.rate).div(indexPriceWei) ?? ZERO_WEI, {
maxDecimals: 2,
})
: NO_VALUE
}
color={
Expand Down Expand Up @@ -147,7 +149,11 @@
return (
<MarketDetail
dataKey={t('futures.market.info.hourly-funding')}
value={fundingValue ? formatPercent(fundingValue ?? ZERO_WEI, { minDecimals: 6 }) : NO_VALUE}
value={
fundingValue
? formatPercent(fundingValue ?? ZERO_WEI, { suggestDecimals: true, maxDecimals: 6 })
: NO_VALUE

Check warning on line 155 in packages/app/src/sections/futures/MarketDetails/MarketDetails.tsx

View check run for this annotation

Codecov / codecov/patch

packages/app/src/sections/futures/MarketDetails/MarketDetails.tsx#L155

Added line #L155 was not covered by tests
}
color={fundingValue?.gt(ZERO_WEI) ? 'green' : fundingValue?.lt(ZERO_WEI) ? 'red' : undefined}
mobile={mobile}
extra={<HoursToggle />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'

import UploadIcon from 'assets/svg/futures/upload-icon.svg'
import Currency from 'components/Currency'
import { FlexDiv, FlexDivRow, FlexDivRowCentered } from 'components/layout/flex'
import Pill from 'components/Pill'
Expand Down Expand Up @@ -137,10 +136,7 @@ const PositionsTab = () => {
Close
</Pill>
<Pill size="medium" onClick={() => handleOpenShareModal(row.share)}>
<FlexDivRowCentered>
<UploadIcon width={6} style={{ marginRight: '2px', marginBottom: '1px' }} />
Share
</FlexDivRowCentered>
<FlexDivRowCentered>Share</FlexDivRowCentered>
</Pill>
</FlexDivRowCentered>
</PositionMeta>
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/sections/futures/Trade/TradeBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const TradeBalance: React.FC<TradeBalanceProps> = memo(({ isMobile = false }) =>
<>
{isMobile ? (
<FlexDivCol rowGap="5px">
<FlexDivRow style={{ width: '200px' }}>
<FlexDivRow style={{ width: '170px' }}>
<Body size={'medium'} color="secondary">
{t('futures.market.trade.trade-balance.available-margin')}:
</Body>
Expand All @@ -97,7 +97,7 @@ const TradeBalance: React.FC<TradeBalanceProps> = memo(({ isMobile = false }) =>
</NumericValue>
</FlexDivRow>
{accountType === 'cross_margin' && lockedMargin.gt(0) && (
<FlexDivRow style={{ width: '200px' }}>
<FlexDivRow style={{ width: '170px' }}>
<Body size={'medium'} color="secondary">
{t('futures.market.trade.trade-balance.locked-margin')}:
</Body>
Expand Down
7 changes: 4 additions & 3 deletions packages/app/src/sections/futures/UserInfo/PositionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@
&:nth-child(odd) {
background-color: ${(props) => props.theme.colors.selectedTheme.table.fill};
}
:not(:last-child) {
border-bottom: ${(props) => props.theme.colors.selectedTheme.border};
}
border-bottom: ${(props) => props.theme.colors.selectedTheme.border};

Check warning on line 315 in packages/app/src/sections/futures/UserInfo/PositionsTable.tsx

View check run for this annotation

Codecov / codecov/patch

packages/app/src/sections/futures/UserInfo/PositionsTable.tsx#L315

Added line #L315 was not covered by tests
`

const HeadersRow = styled(PositionRowDesktop)`
Expand All @@ -325,6 +323,9 @@
:not(:last-child) {
border-bottom: 0;
}
&:first-child {
background-color: transparent;
}
`

const PositionCell = styled.div`
Expand Down
13 changes: 12 additions & 1 deletion packages/app/src/sections/shared/Layout/AppLayout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import router from 'next/router'
import styled from 'styled-components'

import DocsIcon from 'assets/svg/app/docs.svg'
import SupportIcon from 'assets/svg/app/support.svg'
import { FlexDivRow } from 'components/layout/flex'
import { Body } from 'components/Text'
import { EXTERNAL_LINKS } from 'constants/links'
import ROUTES from 'constants/routes'
Expand All @@ -19,9 +22,11 @@ const Footer = () => {
<Body color="secondary">Stats</Body>
</FooterLinkInternal>
<FooterLink href={EXTERNAL_LINKS.Docs.DocsRoot}>
<DocsIcon />
<Body color="secondary">Docs</Body>
</FooterLink>
<FooterLink href={EXTERNAL_LINKS.Social.Discord}>
<SupportIcon />
<Body color="secondary">Support</Body>
</FooterLink>
</RightContainer>
Expand Down Expand Up @@ -50,11 +55,17 @@ const FooterLink = styled.a.attrs({ target: '_blank', rel: '_noreferrer' })`
&:not(:last-of-type) {
margin-right: 18px;
}
display: flex;
flex-direction: row;
align-items: center;
column-gap: 5px;
`

const FooterLinkInternal = styled.div`
const FooterLinkInternal = styled(FlexDivRow)`
margin-right: 18px;
cursor: pointer;
align-items: center;
column-gap: 5px;
`

export default Footer
2 changes: 1 addition & 1 deletion packages/sdk/src/utils/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const formatPercent = (
value: WeiSource,
options?: { minDecimals?: number; suggestDecimals?: boolean; maxDecimals?: number }
) => {
let decimals = suggestedDecimals ? suggestedDecimals(value) : options?.minDecimals ?? 2
let decimals = options?.suggestDecimals ? suggestedDecimals(value) : options?.minDecimals ?? 2
avclarke marked this conversation as resolved.
Show resolved Hide resolved
if (options?.maxDecimals) {
decimals = Math.min(decimals, options.maxDecimals)
}
Expand Down
Loading