diff --git a/.vscode/settings.json b/.vscode/settings.json index 31bfa7ea..037e03e9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,13 +2,6 @@ "npm.packageManager": "yarn", "typescript.updateImportsOnFileMove.enabled": "always", "javascript.updateImportsOnFileMove.enabled": "always", - "editor.formatOnSaveMode": "file", - "editor.tabCompletion": "on", - "editor.tabSize": 2, - "editor.inlineSuggest.enabled": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "editor.formatOnPaste": false, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, @@ -18,5 +11,10 @@ "files.eol": "\n", "eslint.enable": true, "eslint.debug": true, - "prettier.trailingComma": "none", -} + "extensions.disabled": [ + "ms-vscode.jscs", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "rvest.vs-code-prettier-eslint" + ] +} \ No newline at end of file diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index b90589f3..e9498b04 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -31,7 +31,7 @@ type BaseButtonProps = { altDisabledStyle?: boolean } & ButtonProps -export const BaseButton = styled(RebassButton)` +export const BaseButton = styled(RebassButton) ` padding: ${({ padding }) => padding ?? '16px'}; width: ${({ width }) => width ?? '100%'}; line-height: 24px; @@ -312,8 +312,7 @@ export function ButtonDropdownLight({ disabled = false, children, ...rest }: { d } const ActiveOutlined = styled(ButtonOutlined)` - border: 1px solid; - border-color: ${({ theme }) => theme.accent1}; + border: ${({ theme }) => `1px solid ${theme.jediBlue}`} !important ; `; const Circle = styled.div` @@ -353,9 +352,9 @@ export function ButtonRadioChecked({ active = false, children, ...rest }: { acti {children} - + {/* - + */} @@ -466,7 +465,7 @@ const BaseThemeButton = styled.button` } `; -interface ThemeButtonProps extends React.ComponentPropsWithoutRef<'button'>, BaseThemeButtonProps {} +interface ThemeButtonProps extends React.ComponentPropsWithoutRef<'button'>, BaseThemeButtonProps { } type ThemeButtonRef = HTMLButtonElement export const ThemeButton = forwardRef(( diff --git a/src/components/CurrencyInputPanel/index.tsx b/src/components/CurrencyInputPanel/index.tsx index 8b372bb8..e4f3fcb2 100644 --- a/src/components/CurrencyInputPanel/index.tsx +++ b/src/components/CurrencyInputPanel/index.tsx @@ -1,28 +1,28 @@ -import { Trans } from '@lingui/macro'; -import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events'; -import { Currency, CurrencyAmount } from '@uniswap/sdk-core'; -import { Pair } from '@uniswap/v2-sdk'; -import { useWeb3React } from '@web3-react/core'; -import { darken } from 'polished'; -import { ReactNode, useCallback, useState } from 'react'; -import styled, { useTheme } from 'styled-components'; +import { Trans } from '@lingui/macro' +import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events' +import { Currency, CurrencyAmount } from '@uniswap/sdk-core' +import { Pair } from '@uniswap/v2-sdk' +import { useWeb3React } from '@web3-react/core' +import { darken } from 'polished' +import { ReactNode, useCallback, useState } from 'react' +import styled, { useTheme } from 'styled-components' -import { TraceEvent } from 'analytics'; -import { LoadingOpacityContainer, loadingOpacityMixin } from 'components/Loader/styled'; -import PrefetchBalancesWrapper from 'components/PrefetchBalancesWrapper/PrefetchBalancesWrapper'; -import { isSupportedChain } from 'constants/chains'; -import { ThemedText } from 'theme/components'; -import { flexColumnNoWrap, flexRowNoWrap } from 'theme/styles'; -import { formatCurrencyAmount } from 'utils/formatCurrencyAmount'; -import { ReactComponent as DropDown } from '../../assets/images/dropdown.svg'; -import { useCurrencyBalance } from '../../state/connection/hooks'; -import { ButtonGray } from '../Button'; -import DoubleCurrencyLogo from '../DoubleLogo'; -import CurrencyLogo from '../Logo/CurrencyLogo'; -import { Input as NumericalInput } from '../NumericalInput'; -import { RowBetween, RowFixed } from '../Row'; -import CurrencySearchModal from '../SearchModal/CurrencySearchModal'; -import { FiatValue } from './FiatValue'; +import { TraceEvent } from 'analytics' +import { LoadingOpacityContainer, loadingOpacityMixin } from 'components/Loader/styled' +import PrefetchBalancesWrapper from 'components/PrefetchBalancesWrapper/PrefetchBalancesWrapper' +import { isSupportedChain } from 'constants/chains' +import { ThemedText } from 'theme/components' +import { flexColumnNoWrap, flexRowNoWrap } from 'theme/styles' +import { formatCurrencyAmount } from 'utils/formatCurrencyAmount' +import { ReactComponent as DropDown } from '../../assets/images/dropdown.svg' +import { useCurrencyBalance } from '../../state/connection/hooks' +import { ButtonGray } from '../Button' +import DoubleCurrencyLogo from '../DoubleLogo' +import CurrencyLogo from '../Logo/CurrencyLogo' +import { Input as NumericalInput } from '../NumericalInput' +import { RowBetween, RowFixed } from '../Row' +import CurrencySearchModal from '../SearchModal/CurrencySearchModal' +import { FiatValue } from './FiatValue' const InputPanel = styled.div<{ hideInput?: boolean }>` ${flexColumnNoWrap}; @@ -34,7 +34,7 @@ const InputPanel = styled.div<{ hideInput?: boolean }>` width: ${({ hideInput }) => (hideInput ? '100%' : 'initial')}; transition: height 1s ease; will-change: height; -`; +` const Container = styled.div<{ hideInput: boolean; disabled: boolean }>` border-radius: ${({ hideInput }) => (hideInput ? '8px' : '8px')}; @@ -42,16 +42,20 @@ const Container = styled.div<{ hideInput: boolean; disabled: boolean }>` // background-color: ${({ theme }) => theme.surface2}; background-color: rgba(196, 196, 196, 0.01); // background-color: #3e1371; - box-shadow: 0px 0.76977px 30.79088px 0px rgba(227, 222, 255, 0.20) inset, 0px 3.07909px 13.8559px 0px rgba(154, 146, 210, 0.30) inset, 0px 75.43767px 76.9772px -36.94907px rgba(202, 172, 255, 0.30) inset, 0px -63.12132px 52.3445px -49.26542px rgba(96, 68, 144, 0.30) inset; + box-shadow: 0px 0.76977px 30.79088px 0px rgba(227, 222, 255, 0.2) inset, + 0px 3.07909px 13.8559px 0px rgba(154, 146, 210, 0.3) inset, + 0px 75.43767px 76.9772px -36.94907px rgba(202, 172, 255, 0.3) inset, + 0px -63.12132px 52.3445px -49.26542px rgba(96, 68, 144, 0.3) inset; width: ${({ hideInput }) => (hideInput ? '90%' : 'initial')}; - ${({ theme, hideInput, disabled }) => !disabled - && ` + ${({ theme, hideInput, disabled }) => + !disabled && + ` :focus, :hover { border: 1px solid ${hideInput ? ' transparent' : theme.surface2}; } `} -`; +` const CurrencySelect = styled(ButtonGray)<{ visible: boolean @@ -62,7 +66,7 @@ const CurrencySelect = styled(ButtonGray)<{ }>` align-items: center; // background-color: ${({ selected, theme }) => (selected ? theme.surface1 : theme.accent1)}; - background-color: ${({theme}) => theme.jediNavyBlue}; + background-color: ${({ theme }) => theme.jediNavyBlue}; opacity: ${({ disabled }) => (!disabled ? 1 : 0.4)}; box-shadow: ${({ theme }) => theme.deprecated_shallowShadow}; color: ${({ selected, theme }) => (selected ? theme.neutral1 : theme.white)}; @@ -80,14 +84,14 @@ const CurrencySelect = styled(ButtonGray)<{ margin-left: ${({ hideInput }) => (hideInput ? '0' : '12px')}; visibility: ${({ visible }) => (visible ? 'visible' : 'hidden')}; ${({ pointerEvents }) => pointerEvents && 'pointer-events: none'} -`; +` const InputRow = styled.div<{ selected: boolean }>` ${flexRowNoWrap}; align-items: center; justify-content: space-between; padding: ${({ selected }) => (selected ? ' 1rem 1rem 0.75rem 0' : '1rem 1rem 1rem 0')}; -`; +` const LabelRow = styled.div` ${flexRowNoWrap}; @@ -100,13 +104,13 @@ const LabelRow = styled.div` cursor: pointer; color: ${({ theme }) => darken(0.2, theme.neutral2)}; } -`; +` const FiatRow = styled(LabelRow)` justify-content: flex-end; padding: 0px 1rem 0.75rem; height: 32px; -`; +` // note the line height 0 ensures even if we change font/font-size it doesn't break centering const Aligner = styled.span` @@ -115,7 +119,7 @@ const Aligner = styled.span` justify-content: space-between; width: 100%; line-height: 0px; -`; +` const StyledDropDown = styled(DropDown)<{ selected: boolean }>` margin: 0 0.25rem 0 0.35rem; @@ -125,12 +129,14 @@ const StyledDropDown = styled(DropDown)<{ selected: boolean }>` stroke: ${({ selected, theme }) => (selected ? theme.neutral1 : theme.white)}; stroke-width: 1.5px; } -`; +` const StyledTokenName = styled.span<{ active?: boolean }>` ${({ active }) => (active ? ' margin: 0 0.25rem 0 0.25rem;' : ' margin: 0 0.25rem 0 0.25rem;')} - font-size: 20px; -`; + font-size: 14px; + font-weight: 700; + font-family: 'DM Sans'; +` const StyledBalanceMax = styled.button<{ disabled?: boolean }>` background-color: transparent; @@ -153,16 +159,16 @@ const StyledBalanceMax = styled.button<{ disabled?: boolean }>` :focus { outline: none; } -`; +` const StyledNumericalInput = styled(NumericalInput)<{ $loading: boolean }>` ${loadingOpacityMixin}; text-align: left; -`; +` const StyledPrefetchBalancesWrapper = styled(PrefetchBalancesWrapper)<{ $fullWidth: boolean }>` width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')}; -`; +` interface CurrencyInputPanelProps { value: string @@ -183,11 +189,12 @@ interface CurrencyInputPanelProps { disableNonToken?: boolean renderBalance?: (amount: CurrencyAmount) => ReactNode locked?: boolean - loading?: boolean, - hideShadow?: boolean, + loading?: boolean + hideShadow?: boolean } -export default function CurrencyInputPanel({ value, +export default function CurrencyInputPanel({ + value, onUserInput, onMax, showMaxButton, @@ -206,19 +213,20 @@ export default function CurrencyInputPanel({ value, locked = false, loading = false, hideShadow = false, - ...rest }: CurrencyInputPanelProps) { - const [modalOpen, setModalOpen] = useState(false); - const { account, chainId } = useWeb3React(); - const selectedCurrencyBalance = useCurrencyBalance(account ?? undefined, currency ?? undefined); - const theme = useTheme(); + ...rest +}: CurrencyInputPanelProps) { + const [modalOpen, setModalOpen] = useState(false) + const { account, chainId } = useWeb3React() + const selectedCurrencyBalance = useCurrencyBalance(account ?? undefined, currency ?? undefined) + const theme = useTheme() const handleDismissSearch = useCallback(() => { - setModalOpen(false); - }, [setModalOpen]); + setModalOpen(false) + }, [setModalOpen]) - const chainAllowed = isSupportedChain(chainId); + const chainAllowed = isSupportedChain(chainId) - const containerStyles = hideShadow ? {boxShadow: 'none'} : {}; + const containerStyles = hideShadow ? { boxShadow: 'none' } : {} return ( {!locked && ( @@ -233,7 +241,7 @@ export default function CurrencyInputPanel({ value, className="open-currency-select-button" onClick={() => { if (onCurrencySelect) { - setModalOpen(true); + setModalOpen(true) } }} pointerEvents={!onCurrencySelect ? 'none' : undefined} @@ -252,14 +260,12 @@ export default function CurrencyInputPanel({ value, {pair?.token0.symbol}:{pair?.token1.symbol} ) : ( - + {(currency && currency.symbol && currency.symbol.length > 20 - ? `${currency.symbol.slice(0, 4) - }...${ - currency.symbol.slice(currency.symbol.length - 5, currency.symbol.length)}` + ? `${currency.symbol.slice(0, 4)}...${currency.symbol.slice( + currency.symbol.length - 5, + currency.symbol.length + )}` : currency?.symbol) || Select a token} )} @@ -276,7 +282,7 @@ export default function CurrencyInputPanel({ value, onUserInput={onUserInput} disabled={!chainAllowed} $loading={loading} - style={{width: 'auto', textAlign: 'right'}} + style={{ width: 'auto', textAlign: 'right' }} /> )} @@ -304,16 +310,16 @@ export default function CurrencyInputPanel({ value, fontSize={14} style={{ display: 'inline', cursor: 'pointer' }} > - {Boolean(!hideBalance && currency && selectedCurrencyBalance) - && (renderBalance?.(selectedCurrencyBalance as CurrencyAmount) || ( - Bal: {formatCurrencyAmount(selectedCurrencyBalance, 4)} - ))} + {Boolean(!hideBalance && currency && selectedCurrencyBalance) && + (renderBalance?.(selectedCurrencyBalance as CurrencyAmount) || ( + Bal: {formatCurrencyAmount(selectedCurrencyBalance, 4)} + ))} )} - - {fiatValue && } - + + {fiatValue && } + )} @@ -332,5 +338,5 @@ export default function CurrencyInputPanel({ value, /> )} - ); + ) } diff --git a/src/components/FeeSelector/FeeTierPercentageBadge.tsx b/src/components/FeeSelector/FeeTierPercentageBadge.tsx index b6b433b8..f0a84a7e 100644 --- a/src/components/FeeSelector/FeeTierPercentageBadge.tsx +++ b/src/components/FeeSelector/FeeTierPercentageBadge.tsx @@ -16,8 +16,8 @@ export function FeeTierPercentageBadge({ poolState: PoolState }) { return ( - - + + {!distributions || poolState === PoolState.NOT_EXISTS || poolState === PoolState.INVALID ? ( Not created ) : distributions[feeAmount] !== undefined ? ( diff --git a/src/components/FeeSelector/index.tsx b/src/components/FeeSelector/index.tsx index 67120f34..eba67ac5 100644 --- a/src/components/FeeSelector/index.tsx +++ b/src/components/FeeSelector/index.tsx @@ -34,10 +34,11 @@ const pulse = (color: string) => keyframes` box-shadow: 0 0 0 0 ${color}; } ` -const FocusedOutlineCard = styled(Card)<{ pulsing: boolean }>` - border: 1px solid ${({ theme }) => theme.surface3}; +const FocusedOutlineCard = styled(Card) <{ pulsing: boolean, feeAmount: FeeAmount }>` + border: 1px solid ${({ theme, feeAmount }) => feeAmount ? theme.jediBlue : theme.surface3}; animation: ${({ pulsing, theme }) => pulsing && pulse(theme.accent1)} 0.6s linear; align-self: center; + border-radius: 8px; ` const Select = styled.div` @@ -146,24 +147,27 @@ export default function FeeSelector({ return ( - setPulsing(false)}> + setPulsing(false)} feeAmount={feeAmount}> {!feeAmount ? ( <> - - Select Fee tier + + Select Fee Tier - + The % you will earn in fees. ) : ( <> - {FEE_AMOUNT_DETAIL[feeAmount].label}% fee tier + {FEE_AMOUNT_DETAIL[feeAmount].label}% Fee Tier - + {/* {distributions && ( )} - + */} )} - setShowOptions(!showOptions)} width="auto" padding="4px" $borderRadius="6px"> + {/* setShowOptions(!showOptions)} width="auto" padding="4px" $borderRadius="6px"> {showOptions ? Hide : Edit} - + */} - {chainId && showOptions && ( + {chainId && (