Commit a7a1607f authored by Moody Salem's avatar Moody Salem Committed by GitHub

fix: add a link to switch the locale conditionally (#1776)

* add a link to switch the locale conditionally

* make it smaller

* add the locale labels

* language labels from the internet

* fix the heart in the claim popup

* undo the conditional change

* remove todo

* updated Chinese locale name to office-365 language ids

* added missing <Trans>
Co-authored-by: default avatarJustin Domingue <judo@uniswap.org>
parent 5125cbb1
import { Trans } from '@lingui/macro'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import React, { useCallback, useEffect } from 'react' import React, { useCallback, useEffect } from 'react'
import ReactGA from 'react-ga' import ReactGA from 'react-ga'
import { X } from 'react-feather' import { Heart, X } from 'react-feather'
import styled, { keyframes } from 'styled-components' import styled, { keyframes } from 'styled-components'
import tokenLogo from '../../assets/images/token-logo.png' import tokenLogo from '../../assets/images/token-logo.png'
import { ButtonPrimary } from '../../components/Button' import { ButtonPrimary } from '../../components/Button'
...@@ -104,18 +105,20 @@ export default function ClaimPopup() { ...@@ -104,18 +105,20 @@ export default function ClaimPopup() {
<span role="img" aria-label="party"> <span role="img" aria-label="party">
🎉 🎉
</span>{' '} </span>{' '}
UNI has arrived{' '} <Trans>UNI has arrived</Trans>{' '}
<span role="img" aria-label="party"> <span role="img" aria-label="party">
🎉 🎉
</span> </span>
</TYPE.white> </TYPE.white>
<TYPE.subHeader style={{ paddingTop: '0.5rem', textAlign: 'center' }} color="white"> <TYPE.subHeader style={{ paddingTop: '0.5rem', textAlign: 'center' }} color="white">
{`Thanks for being part of the Uniswap community <3`} <Trans>
Thanks for being part of the Uniswap community <Heart size={12} />
</Trans>
</TYPE.subHeader> </TYPE.subHeader>
</AutoColumn> </AutoColumn>
<AutoColumn style={{ zIndex: 10 }} justify="center"> <AutoColumn style={{ zIndex: 10 }} justify="center">
<ButtonPrimary padding="8px" borderRadius="8px" width={'fit-content'} onClick={handleToggleSelfClaimModal}> <ButtonPrimary padding="8px" borderRadius="8px" width={'fit-content'} onClick={handleToggleSelfClaimModal}>
Claim your UNI tokens <Trans>Claim your UNI tokens</Trans>
</ButtonPrimary> </ButtonPrimary>
</AutoColumn> </AutoColumn>
</StyledClaimPopup> </StyledClaimPopup>
......
import { Trans } from '@lingui/macro'
import React, { useMemo } from 'react'
import { useLocation } from 'react-router'
import styled from 'styled-components/macro'
import { DEFAULT_LOCALE, LOCALE_LABEL, SupportedLocale } from '../../constants/locales'
import { navigatorLocale, useActiveLocale } from '../../hooks/useActiveLocale'
import useParsedQueryString from '../../hooks/useParsedQueryString'
import { StyledInternalLink, TYPE } from '../../theme'
import { stringify } from 'qs'
const Container = styled(TYPE.small)`
opacity: 0.6;
:hover {
opacity: 1;
}
margin-top: 1rem !important;
`
export function SwitchLocaleLink() {
const activeLocale = useActiveLocale()
const browserLocale = useMemo(() => navigatorLocale(), [])
const location = useLocation()
const qs = useParsedQueryString()
if (browserLocale && (browserLocale !== DEFAULT_LOCALE || activeLocale !== DEFAULT_LOCALE)) {
let targetLocale: SupportedLocale
if (activeLocale === browserLocale) {
targetLocale = DEFAULT_LOCALE
} else {
targetLocale = browserLocale
}
const target = {
...location,
search: stringify({ ...qs, lng: targetLocale }),
}
return (
<Container>
<Trans>
Uniswap available in: {<StyledInternalLink to={target}>{LOCALE_LABEL[targetLocale]}</StyledInternalLink>}
</Trans>
</Container>
)
}
return null
}
...@@ -35,7 +35,36 @@ export type SupportedLocale = typeof SUPPORTED_LOCALES[number] ...@@ -35,7 +35,36 @@ export type SupportedLocale = typeof SUPPORTED_LOCALES[number]
export const DEFAULT_LOCALE: SupportedLocale = 'en-US' export const DEFAULT_LOCALE: SupportedLocale = 'en-US'
// todo: fill this back out export const LOCALE_LABEL: { [locale in SupportedLocale]: string } = {
export const LOCALE_LABEL: { [locale in SupportedLocale]?: string } = { 'af-ZA': 'Afrikaans',
'ar-SA': 'العربية',
'ca-ES': 'Català',
'cs-CZ': 'čeština',
'da-DK': 'dansk',
'de-DE': 'Deutsche',
'el-GR': 'ελληνικά',
'en-US': 'English', 'en-US': 'English',
'es-ES': 'Español',
'fi-FI': 'Suomalainen',
'fr-FR': 'français',
'he-IL': 'עִברִית',
'hu-HU': 'Magyar',
'id-ID': 'bahasa Indonesia',
'it-IT': 'Italiano',
'ja-JP': '日本語',
'ko-KR': '한국어',
'nl-NL': 'Nederlands',
'no-NO': 'norsk',
'pl-PL': 'Polskie',
'pt-BR': 'português',
'pt-PT': 'português',
'ro-RO': 'Română',
'ru-RU': 'русский',
'sr-SP': 'Српски',
'sv-SE': 'svenska',
'tr-TR': 'Türkçe',
'uk-UA': 'Український',
'vi-VN': 'Tiếng Việt',
'zh-CN': '中文 ( 中国 )',
'zh-TW': '中文 ( 台灣 )',
} }
...@@ -17,7 +17,7 @@ function parseLocale(maybeSupportedLocale: string): SupportedLocale | undefined ...@@ -17,7 +17,7 @@ function parseLocale(maybeSupportedLocale: string): SupportedLocale | undefined
/** /**
* Returns the supported locale read from the user agent (navigator) * Returns the supported locale read from the user agent (navigator)
*/ */
function navigatorLocale(): SupportedLocale | undefined { export function navigatorLocale(): SupportedLocale | undefined {
if (!navigator.language) return undefined if (!navigator.language) return undefined
const [language, region] = navigator.language.split('-') const [language, region] = navigator.language.split('-')
......
...@@ -13,6 +13,7 @@ import { Link } from 'react-router-dom' ...@@ -13,6 +13,7 @@ import { Link } from 'react-router-dom'
import { useWalletModalToggle } from 'state/application/hooks' import { useWalletModalToggle } from 'state/application/hooks'
import styled, { ThemeContext } from 'styled-components' import styled, { ThemeContext } from 'styled-components'
import { HideSmall, TYPE } from 'theme' import { HideSmall, TYPE } from 'theme'
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
import { LoadingRows } from './styleds' import { LoadingRows } from './styleds'
import Toggle from 'components/Toggle' import Toggle from 'components/Toggle'
import { useUserHideClosedPositions } from 'state/user/hooks' import { useUserHideClosedPositions } from 'state/user/hooks'
...@@ -295,6 +296,7 @@ export default function Pool() { ...@@ -295,6 +296,7 @@ export default function Pool() {
</AutoColumn> </AutoColumn>
</AutoColumn> </AutoColumn>
</PageWrapper> </PageWrapper>
<SwitchLocaleLink />
</> </>
) )
} }
import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Token, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Token, TradeType } from '@uniswap/sdk-core'
import { Trade as V2Trade } from '@uniswap/v2-sdk' import { Trade as V2Trade } from '@uniswap/v2-sdk'
import { Trade as V3Trade } from '@uniswap/v3-sdk' import { Trade as V3Trade } from '@uniswap/v3-sdk'
...@@ -6,7 +7,7 @@ import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter ...@@ -6,7 +7,7 @@ import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter
import { MouseoverTooltip, MouseoverTooltipContent } from 'components/Tooltip' import { MouseoverTooltip, MouseoverTooltipContent } from 'components/Tooltip'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react' import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'
import { ArrowDown, CheckCircle, HelpCircle, Info, ArrowLeft } from 'react-feather' import { ArrowDown, ArrowLeft, CheckCircle, HelpCircle, Info } from 'react-feather'
import ReactGA from 'react-ga' import ReactGA from 'react-ga'
import { Link, RouteComponentProps } from 'react-router-dom' import { Link, RouteComponentProps } from 'react-router-dom'
import { Text } from 'rebass' import { Text } from 'rebass'
...@@ -26,8 +27,8 @@ import ConfirmSwapModal from '../../components/swap/ConfirmSwapModal' ...@@ -26,8 +27,8 @@ import ConfirmSwapModal from '../../components/swap/ConfirmSwapModal'
import { ArrowWrapper, BottomGrouping, Dots, SwapCallbackError, Wrapper } from '../../components/swap/styleds' import { ArrowWrapper, BottomGrouping, Dots, SwapCallbackError, Wrapper } from '../../components/swap/styleds'
import SwapHeader from '../../components/swap/SwapHeader' import SwapHeader from '../../components/swap/SwapHeader'
import TradePrice from '../../components/swap/TradePrice' import TradePrice from '../../components/swap/TradePrice'
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
import TokenWarningModal from '../../components/TokenWarningModal' import TokenWarningModal from '../../components/TokenWarningModal'
import { useActiveWeb3React } from '../../hooks/web3'
import { useAllTokens, useCurrency } from '../../hooks/Tokens' import { useAllTokens, useCurrency } from '../../hooks/Tokens'
import { ApprovalState, useApproveCallbackFromTrade } from '../../hooks/useApproveCallback' import { ApprovalState, useApproveCallbackFromTrade } from '../../hooks/useApproveCallback'
import { V3TradeState } from '../../hooks/useBestV3Trade' import { V3TradeState } from '../../hooks/useBestV3Trade'
...@@ -39,6 +40,7 @@ import { useSwapCallback } from '../../hooks/useSwapCallback' ...@@ -39,6 +40,7 @@ import { useSwapCallback } from '../../hooks/useSwapCallback'
import useToggledVersion, { Version } from '../../hooks/useToggledVersion' import useToggledVersion, { Version } from '../../hooks/useToggledVersion'
import { useUSDCValue } from '../../hooks/useUSDCPrice' import { useUSDCValue } from '../../hooks/useUSDCPrice'
import useWrapCallback, { WrapType } from '../../hooks/useWrapCallback' import useWrapCallback, { WrapType } from '../../hooks/useWrapCallback'
import { useActiveWeb3React } from '../../hooks/web3'
import { useWalletModalToggle } from '../../state/application/hooks' import { useWalletModalToggle } from '../../state/application/hooks'
import { Field } from '../../state/swap/actions' import { Field } from '../../state/swap/actions'
import { import {
...@@ -55,7 +57,6 @@ import { isTradeBetter } from '../../utils/isTradeBetter' ...@@ -55,7 +57,6 @@ import { isTradeBetter } from '../../utils/isTradeBetter'
import { maxAmountSpend } from '../../utils/maxAmountSpend' import { maxAmountSpend } from '../../utils/maxAmountSpend'
import { warningSeverity } from '../../utils/prices' import { warningSeverity } from '../../utils/prices'
import AppBody from '../AppBody' import AppBody from '../AppBody'
import { Trans } from '@lingui/macro'
const StyledInfo = styled(Info)` const StyledInfo = styled(Info)`
opacity: 0.4; opacity: 0.4;
...@@ -658,6 +659,7 @@ export default function Swap({ history }: RouteComponentProps) { ...@@ -658,6 +659,7 @@ export default function Swap({ history }: RouteComponentProps) {
</AutoColumn> </AutoColumn>
</Wrapper> </Wrapper>
</AppBody> </AppBody>
<SwitchLocaleLink />
{!swapIsUnsupported ? null : ( {!swapIsUnsupported ? null : (
<UnsupportedCurrencyFooter show={swapIsUnsupported} currencies={[currencies.INPUT, currencies.OUTPUT]} /> <UnsupportedCurrencyFooter show={swapIsUnsupported} currencies={[currencies.INPUT, currencies.OUTPUT]} />
)} )}
......
...@@ -14,6 +14,7 @@ import { GreyCard } from '../../components/Card' ...@@ -14,6 +14,7 @@ import { GreyCard } from '../../components/Card'
import { AutoColumn } from '../../components/Column' import { AutoColumn } from '../../components/Column'
import { CardSection, DataCard } from '../../components/earn/styled' import { CardSection, DataCard } from '../../components/earn/styled'
import { RowBetween, RowFixed } from '../../components/Row' import { RowBetween, RowFixed } from '../../components/Row'
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
import DelegateModal from '../../components/vote/DelegateModal' import DelegateModal from '../../components/vote/DelegateModal'
import VoteModal from '../../components/vote/VoteModal' import VoteModal from '../../components/vote/VoteModal'
import { import {
...@@ -199,161 +200,164 @@ export default function VotePage({ ...@@ -199,161 +200,164 @@ export default function VotePage({
} }
return ( return (
<PageWrapper gap="lg" justify="center"> <>
<VoteModal isOpen={showVoteModal} onDismiss={toggleVoteModal} proposalId={proposalData?.id} support={support} /> <PageWrapper gap="lg" justify="center">
<DelegateModal isOpen={showDelegateModal} onDismiss={toggleDelegateModal} title={<Trans>Unlock Votes</Trans>} /> <VoteModal isOpen={showVoteModal} onDismiss={toggleVoteModal} proposalId={proposalData?.id} support={support} />
<ProposalInfo gap="lg" justify="start"> <DelegateModal isOpen={showDelegateModal} onDismiss={toggleDelegateModal} title={<Trans>Unlock Votes</Trans>} />
<RowBetween style={{ width: '100%' }}> <ProposalInfo gap="lg" justify="start">
<ArrowWrapper to="/vote"> <RowBetween style={{ width: '100%' }}>
<Trans> <ArrowWrapper to="/vote">
<ArrowLeft size={20} /> All Proposals <Trans>
</Trans> <ArrowLeft size={20} /> All Proposals
</ArrowWrapper> </Trans>
{proposalData && ( </ArrowWrapper>
<ProposalStatus status={proposalData.status}>{ProposalState[proposalData.status]}</ProposalStatus> {proposalData && (
)} <ProposalStatus status={proposalData.status}>{ProposalState[proposalData.status]}</ProposalStatus>
</RowBetween> )}
<AutoColumn gap="10px" style={{ width: '100%' }}>
<TYPE.largeHeader style={{ marginBottom: '.5rem' }}>{proposalData?.title}</TYPE.largeHeader>
<RowBetween>
<TYPE.main>
{endDate && endDate < now ? (
<Trans>Voting ended {endDate && endDate.toLocaleString(DateTime.DATETIME_FULL)}</Trans>
) : proposalData ? (
<Trans>Voting ends approximately {endDate && endDate.toLocaleString(DateTime.DATETIME_FULL)}</Trans>
) : (
''
)}
</TYPE.main>
</RowBetween> </RowBetween>
{proposalData && proposalData.status === ProposalState.Active && !showVotingButtons && ( <AutoColumn gap="10px" style={{ width: '100%' }}>
<GreyCard> <TYPE.largeHeader style={{ marginBottom: '.5rem' }}>{proposalData?.title}</TYPE.largeHeader>
<TYPE.black> <RowBetween>
<Trans> <TYPE.main>
Only UNI votes that were self delegated or delegated to another address before block{' '} {endDate && endDate < now ? (
{proposalData.startBlock} are eligible for voting.{' '} <Trans>Voting ended {endDate && endDate.toLocaleString(DateTime.DATETIME_FULL)}</Trans>
</Trans> ) : proposalData ? (
{showLinkForUnlock && ( <Trans>Voting ends approximately {endDate && endDate.toLocaleString(DateTime.DATETIME_FULL)}</Trans>
<span> ) : (
<Trans> ''
<StyledInternalLink to="/vote">Unlock voting</StyledInternalLink> to prepare for the next
proposal.
</Trans>
</span>
)} )}
</TYPE.black> </TYPE.main>
</GreyCard> </RowBetween>
)} {proposalData && proposalData.status === ProposalState.Active && !showVotingButtons && (
</AutoColumn> <GreyCard>
{showVotingButtons ? ( <TYPE.black>
<RowFixed style={{ width: '100%', gap: '12px' }}>
<ButtonPrimary
padding="8px"
borderRadius="8px"
onClick={() => {
setSupport(true)
toggleVoteModal()
}}
>
Vote For
</ButtonPrimary>
<ButtonPrimary
padding="8px"
borderRadius="8px"
onClick={() => {
setSupport(false)
toggleVoteModal()
}}
>
<Trans>Vote Against</Trans>
</ButtonPrimary>
</RowFixed>
) : (
''
)}
<CardWrapper>
<StyledDataCard>
<CardSection>
<AutoColumn gap="md">
<WrapSmall>
<Trans> <Trans>
Only UNI votes that were self delegated or delegated to another address before block{' '}
{proposalData.startBlock} are eligible for voting.{' '}
</Trans>
{showLinkForUnlock && (
<span>
<Trans>
<StyledInternalLink to="/vote">Unlock voting</StyledInternalLink> to prepare for the next
proposal.
</Trans>
</span>
)}
</TYPE.black>
</GreyCard>
)}
</AutoColumn>
{showVotingButtons ? (
<RowFixed style={{ width: '100%', gap: '12px' }}>
<ButtonPrimary
padding="8px"
borderRadius="8px"
onClick={() => {
setSupport(true)
toggleVoteModal()
}}
>
<Trans>Vote For</Trans>
</ButtonPrimary>
<ButtonPrimary
padding="8px"
borderRadius="8px"
onClick={() => {
setSupport(false)
toggleVoteModal()
}}
>
<Trans>Vote Against</Trans>
</ButtonPrimary>
</RowFixed>
) : (
''
)}
<CardWrapper>
<StyledDataCard>
<CardSection>
<AutoColumn gap="md">
<WrapSmall>
<Trans>
<TYPE.black fontWeight={600}>
<Trans>For</Trans>
</TYPE.black>
<TYPE.black fontWeight={600}>
{' '}
{proposalData?.forCount.toLocaleString(undefined, { maximumFractionDigits: 0 })}
</TYPE.black>
</Trans>
</WrapSmall>
</AutoColumn>
<ProgressWrapper>
<Progress status={'for'} percentageString={forPercentage} />
</ProgressWrapper>
</CardSection>
</StyledDataCard>
<StyledDataCard>
<CardSection>
<AutoColumn gap="md">
<WrapSmall>
<TYPE.black fontWeight={600}> <TYPE.black fontWeight={600}>
<Trans>For</Trans> <Trans>Against</Trans>
</TYPE.black> </TYPE.black>
<TYPE.black fontWeight={600}> <TYPE.black fontWeight={600}>
{' '} {proposalData?.againstCount.toLocaleString(undefined, { maximumFractionDigits: 0 })}
{proposalData?.forCount.toLocaleString(undefined, { maximumFractionDigits: 0 })}
</TYPE.black> </TYPE.black>
</Trans> </WrapSmall>
</WrapSmall> </AutoColumn>
</AutoColumn> <ProgressWrapper>
<ProgressWrapper> <Progress status={'against'} percentageString={againstPercentage} />
<Progress status={'for'} percentageString={forPercentage} /> </ProgressWrapper>
</ProgressWrapper> </CardSection>
</CardSection> </StyledDataCard>
</StyledDataCard> </CardWrapper>
<StyledDataCard> <AutoColumn gap="md">
<CardSection> <TYPE.mediumHeader fontWeight={600}>
<AutoColumn gap="md"> <Trans>Details</Trans>
<WrapSmall> </TYPE.mediumHeader>
<TYPE.black fontWeight={600}> {proposalData?.details?.map((d, i) => {
<Trans>Against</Trans> return (
</TYPE.black> <DetailText key={i}>
<TYPE.black fontWeight={600}> {i + 1}: {linkIfAddress(d.target)}.{d.functionSig}(
{proposalData?.againstCount.toLocaleString(undefined, { maximumFractionDigits: 0 })} {d.callData.split(',').map((content, i) => {
</TYPE.black> return (
</WrapSmall> <span key={i}>
</AutoColumn> {linkIfAddress(content)}
<ProgressWrapper> {d.callData.split(',').length - 1 === i ? '' : ','}
<Progress status={'against'} percentageString={againstPercentage} /> </span>
</ProgressWrapper> )
</CardSection> })}
</StyledDataCard>
</CardWrapper>
<AutoColumn gap="md">
<TYPE.mediumHeader fontWeight={600}>
<Trans>Details</Trans>
</TYPE.mediumHeader>
{proposalData?.details?.map((d, i) => {
return (
<DetailText key={i}>
{i + 1}: {linkIfAddress(d.target)}.{d.functionSig}(
{d.callData.split(',').map((content, i) => {
return (
<span key={i}>
{linkIfAddress(content)}
{d.callData.split(',').length - 1 === i ? '' : ','}
</span>
) )
})} </DetailText>
) )
</DetailText> })}
) </AutoColumn>
})} <AutoColumn gap="md">
</AutoColumn> <TYPE.mediumHeader fontWeight={600}>
<AutoColumn gap="md"> <Trans>Description</Trans>
<TYPE.mediumHeader fontWeight={600}> </TYPE.mediumHeader>
<Trans>Description</Trans> <MarkDownWrapper>
</TYPE.mediumHeader> <ReactMarkdown source={proposalData?.description} />
<MarkDownWrapper> </MarkDownWrapper>
<ReactMarkdown source={proposalData?.description} /> </AutoColumn>
</MarkDownWrapper> <AutoColumn gap="md">
</AutoColumn> <TYPE.mediumHeader fontWeight={600}>
<AutoColumn gap="md"> <Trans>Proposer</Trans>
<TYPE.mediumHeader fontWeight={600}> </TYPE.mediumHeader>
<Trans>Proposer</Trans> <ProposerAddressLink
</TYPE.mediumHeader> href={
<ProposerAddressLink proposalData?.proposer && chainId
href={ ? getExplorerLink(chainId, proposalData?.proposer, ExplorerDataType.ADDRESS)
proposalData?.proposer && chainId : ''
? getExplorerLink(chainId, proposalData?.proposer, ExplorerDataType.ADDRESS) }
: '' >
} <ReactMarkdown source={proposalData?.proposer} />
> </ProposerAddressLink>
<ReactMarkdown source={proposalData?.proposer} /> </AutoColumn>
</ProposerAddressLink> </ProposalInfo>
</AutoColumn> </PageWrapper>
</ProposalInfo> <SwitchLocaleLink />
</PageWrapper> </>
) )
} }
import React from 'react' import React from 'react'
import { AutoColumn } from '../../components/Column' import { AutoColumn } from '../../components/Column'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
import { UNI } from '../../constants/tokens' import { UNI } from '../../constants/tokens'
import { ExternalLink, TYPE } from '../../theme' import { ExternalLink, TYPE } from '../../theme'
import { RowBetween, RowFixed } from '../../components/Row' import { RowBetween, RowFixed } from '../../components/Row'
...@@ -135,130 +136,133 @@ export default function Vote() { ...@@ -135,130 +136,133 @@ export default function Vote() {
) )
return ( return (
<PageWrapper gap="lg" justify="center"> <>
<DelegateModal <PageWrapper gap="lg" justify="center">
isOpen={showDelegateModal} <DelegateModal
onDismiss={toggleDelegateModal} isOpen={showDelegateModal}
title={showUnlockVoting ? <Trans>Unlock Votes</Trans> : <Trans>Update Delegation</Trans>} onDismiss={toggleDelegateModal}
/> title={showUnlockVoting ? <Trans>Unlock Votes</Trans> : <Trans>Update Delegation</Trans>}
<TopSection gap="md"> />
<VoteCard> <TopSection gap="md">
<CardBGImage /> <VoteCard>
<CardNoise /> <CardBGImage />
<CardSection> <CardNoise />
<AutoColumn gap="md"> <CardSection>
<RowBetween> <AutoColumn gap="md">
<TYPE.white fontWeight={600}> <RowBetween>
<Trans>Uniswap Governance</Trans> <TYPE.white fontWeight={600}>
</TYPE.white> <Trans>Uniswap Governance</Trans>
</RowBetween> </TYPE.white>
<RowBetween> </RowBetween>
<TYPE.white fontSize={14}> <RowBetween>
<Trans> <TYPE.white fontSize={14}>
UNI tokens represent voting shares in Uniswap governance. You can vote on each proposal yourself or <Trans>
delegate your votes to a third party. UNI tokens represent voting shares in Uniswap governance. You can vote on each proposal yourself
</Trans> or delegate your votes to a third party.
</TYPE.white> </Trans>
</RowBetween> </TYPE.white>
<ExternalLink </RowBetween>
style={{ color: 'white', textDecoration: 'underline' }} <ExternalLink
href="https://uniswap.org/blog/uni" style={{ color: 'white', textDecoration: 'underline' }}
target="_blank" href="https://uniswap.org/blog/uni"
target="_blank"
>
<TYPE.white fontSize={14}>
<Trans>Read more about Uniswap governance</Trans>
</TYPE.white>
</ExternalLink>
</AutoColumn>
</CardSection>
<CardBGImage />
<CardNoise />
</VoteCard>
</TopSection>
<TopSection gap="2px">
<WrapSmall>
<TYPE.mediumHeader style={{ margin: '0.5rem 0.5rem 0.5rem 0', flexShrink: 0 }}>
<Trans>Proposals</Trans>
</TYPE.mediumHeader>
{(!allProposals || allProposals.length === 0) && !availableVotes && <Loader />}
{showUnlockVoting ? (
<ButtonPrimary
style={{ width: 'fit-content' }}
padding="8px"
borderRadius="8px"
onClick={toggleDelegateModal}
> >
<TYPE.white fontSize={14}> <Trans>Unlock Voting</Trans>
<Trans>Read more about Uniswap governance</Trans> </ButtonPrimary>
</TYPE.white> ) : availableVotes && JSBI.notEqual(JSBI.BigInt(0), availableVotes?.quotient) ? (
</ExternalLink> <TYPE.body fontWeight={500} mr="6px">
</AutoColumn> <Trans>
</CardSection> <FormattedCurrencyAmount currencyAmount={availableVotes} /> Votes
<CardBGImage /> </Trans>
<CardNoise /> </TYPE.body>
</VoteCard> ) : uniBalance &&
</TopSection> userDelegatee &&
<TopSection gap="2px"> userDelegatee !== ZERO_ADDRESS &&
<WrapSmall> JSBI.notEqual(JSBI.BigInt(0), uniBalance?.quotient) ? (
<TYPE.mediumHeader style={{ margin: '0.5rem 0.5rem 0.5rem 0', flexShrink: 0 }}> <TYPE.body fontWeight={500} mr="6px">
<Trans>Proposals</Trans> <Trans>
</TYPE.mediumHeader> <FormattedCurrencyAmount currencyAmount={uniBalance} /> Votes
{(!allProposals || allProposals.length === 0) && !availableVotes && <Loader />} </Trans>
{showUnlockVoting ? ( </TYPE.body>
<ButtonPrimary
style={{ width: 'fit-content' }}
padding="8px"
borderRadius="8px"
onClick={toggleDelegateModal}
>
<Trans>Unlock Voting</Trans>
</ButtonPrimary>
) : availableVotes && JSBI.notEqual(JSBI.BigInt(0), availableVotes?.quotient) ? (
<TYPE.body fontWeight={500} mr="6px">
<Trans>
<FormattedCurrencyAmount currencyAmount={availableVotes} /> Votes
</Trans>
</TYPE.body>
) : uniBalance &&
userDelegatee &&
userDelegatee !== ZERO_ADDRESS &&
JSBI.notEqual(JSBI.BigInt(0), uniBalance?.quotient) ? (
<TYPE.body fontWeight={500} mr="6px">
<Trans>
<FormattedCurrencyAmount currencyAmount={uniBalance} /> Votes
</Trans>
</TYPE.body>
) : (
''
)}
</WrapSmall>
{!showUnlockVoting && (
<RowBetween>
<div />
{userDelegatee && userDelegatee !== ZERO_ADDRESS ? (
<RowFixed>
<TYPE.body fontWeight={500} mr="4px">
<Trans>Delegated to:</Trans>
</TYPE.body>
<AddressButton>
<StyledExternalLink
href={getExplorerLink(1, userDelegatee, ExplorerDataType.ADDRESS)}
style={{ margin: '0 4px' }}
>
{userDelegatee === account ? <Trans>Self</Trans> : shortenAddress(userDelegatee)}
</StyledExternalLink>
<TextButton onClick={toggleDelegateModal} style={{ marginLeft: '4px' }}>
<Trans>(edit)</Trans>
</TextButton>
</AddressButton>
</RowFixed>
) : ( ) : (
'' ''
)} )}
</RowBetween> </WrapSmall>
)} {!showUnlockVoting && (
{allProposals?.length === 0 && ( <RowBetween>
<EmptyProposals> <div />
<TYPE.body style={{ marginBottom: '8px' }}> {userDelegatee && userDelegatee !== ZERO_ADDRESS ? (
<Trans>No proposals found.</Trans> <RowFixed>
</TYPE.body> <TYPE.body fontWeight={500} mr="4px">
<TYPE.subHeader> <Trans>Delegated to:</Trans>
<i> </TYPE.body>
<Trans>Proposals submitted by community members will appear here.</Trans> <AddressButton>
</i> <StyledExternalLink
</TYPE.subHeader> href={getExplorerLink(1, userDelegatee, ExplorerDataType.ADDRESS)}
</EmptyProposals> style={{ margin: '0 4px' }}
)} >
{allProposals?.map((p: ProposalData, i) => { {userDelegatee === account ? <Trans>Self</Trans> : shortenAddress(userDelegatee)}
return ( </StyledExternalLink>
<Proposal as={Link} to={'/vote/' + p.id} key={i}> <TextButton onClick={toggleDelegateModal} style={{ marginLeft: '4px' }}>
<ProposalNumber>{p.id}</ProposalNumber> <Trans>(edit)</Trans>
<ProposalTitle>{p.title}</ProposalTitle> </TextButton>
<ProposalStatus status={p.status}>{ProposalState[p.status]}</ProposalStatus> </AddressButton>
</Proposal> </RowFixed>
) ) : (
})} ''
</TopSection> )}
<TYPE.subHeader color="text3"> </RowBetween>
<Trans>A minimum threshold of 1% of the total UNI supply is required to submit proposals</Trans> )}
</TYPE.subHeader> {allProposals?.length === 0 && (
</PageWrapper> <EmptyProposals>
<TYPE.body style={{ marginBottom: '8px' }}>
<Trans>No proposals found.</Trans>
</TYPE.body>
<TYPE.subHeader>
<i>
<Trans>Proposals submitted by community members will appear here.</Trans>
</i>
</TYPE.subHeader>
</EmptyProposals>
)}
{allProposals?.map((p: ProposalData, i) => {
return (
<Proposal as={Link} to={'/vote/' + p.id} key={i}>
<ProposalNumber>{p.id}</ProposalNumber>
<ProposalTitle>{p.title}</ProposalTitle>
<ProposalStatus status={p.status}>{ProposalState[p.status]}</ProposalStatus>
</Proposal>
)
})}
</TopSection>
<TYPE.subHeader color="text3">
<Trans>A minimum threshold of 1% of the total UNI supply is required to submit proposals</Trans>
</TYPE.subHeader>
</PageWrapper>
<SwitchLocaleLink />
</>
) )
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment