diff --git a/package.json b/package.json index cb81f4f58..29aad21d0 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "@react-navigation/stack": "6.2.2", "@reduxjs/toolkit": "1.9.1", "@rnmapbox/maps": "10.0.7-rc.0", - "@shopify/restyle": "^2.4.2", + "@shopify/restyle": "1.8.0", "@solana/spl-account-compression": "0.1.4", "@solana/spl-memo": "0.2.3", "@solana/spl-token": "0.3.6", diff --git a/src/components/TextTransform.tsx b/src/components/TextTransform.tsx index 6a6eb482a..9c1582c45 100644 --- a/src/components/TextTransform.tsx +++ b/src/components/TextTransform.tsx @@ -36,6 +36,7 @@ type Props = TextProps & { maxFontSizeMultiplier?: number colorTextVariant?: ResponsiveValue } + const TextTransform = ({ i18nKey, values, diff --git a/src/features/governance/DelegateTokensModal.tsx b/src/features/governance/DelegateTokensModal.tsx index 54ede427d..d76910ab6 100644 --- a/src/features/governance/DelegateTokensModal.tsx +++ b/src/features/governance/DelegateTokensModal.tsx @@ -107,14 +107,15 @@ export const DelegateTokensModal = ({ )} - - {subDaos?.map((subDao) => { + + {subDaos?.map((subDao, idx) => { const isSelected = selectedSubDaoPk?.equals(subDao.pubkey) return ( 0 ? 'm' : 'none'} backgroundColor={ isSelected ? 'secondaryBackground' : 'secondary' } diff --git a/src/features/governance/LockTokensModal.tsx b/src/features/governance/LockTokensModal.tsx index a53c5c01f..8ef65162b 100644 --- a/src/features/governance/LockTokensModal.tsx +++ b/src/features/governance/LockTokensModal.tsx @@ -289,8 +289,8 @@ export const LockTokensModal = ({ - - {lockupKindOptions.map((option) => { + + {lockupKindOptions.map((option, idx) => { const isActive = option.value === lockupKind.value @@ -301,6 +301,7 @@ export const LockTokensModal = ({ padding="s" alignItems="center" borderRadius="m" + marginLeft={idx > 0 ? 'ms' : 'none'} backgroundColor={ isActive ? 'surfaceSecondary' @@ -388,11 +389,11 @@ export const LockTokensModal = ({ ) : null} - + {(hasMinLockup ? [...lockupPeriodOptions.splice(1)] : lockupPeriodOptions - ).map((option) => { + ).map((option, idx) => { const isActive = option.value === lockupPeriod.value @@ -403,6 +404,7 @@ export const LockTokensModal = ({ padding="s" alignItems="center" borderRadius="m" + marginLeft={idx > 0 ? 'ms' : 'none'} backgroundColor={ isActive ? 'surfaceSecondary' : 'black500' } diff --git a/src/features/governance/PositionsList.tsx b/src/features/governance/PositionsList.tsx index 38406e21e..8dcb6dff9 100644 --- a/src/features/governance/PositionsList.tsx +++ b/src/features/governance/PositionsList.tsx @@ -68,11 +68,12 @@ export const PositionsList = ({ - - {sortedPositions?.map((p) => ( + + {sortedPositions?.map((p, idx) => ( 0 ? 'm' : 'none'} subDaos={subDaos} /> ))} diff --git a/src/features/governance/ProposalCard.tsx b/src/features/governance/ProposalCard.tsx index b33cc500a..924c09994 100644 --- a/src/features/governance/ProposalCard.tsx +++ b/src/features/governance/ProposalCard.tsx @@ -157,24 +157,24 @@ export const ProposalCard = ({ {proposal?.name} - + {proposal?.tags .filter((tag) => tag !== 'tags') .map((tag) => ( - - - - {tag.toUpperCase()} - - + + + {tag.toUpperCase()} + ))} diff --git a/src/features/governance/ProposalScreen.tsx b/src/features/governance/ProposalScreen.tsx index c3483433b..d8c523027 100644 --- a/src/features/governance/ProposalScreen.tsx +++ b/src/features/governance/ProposalScreen.tsx @@ -220,12 +220,13 @@ export const ProposalScreen = () => { borderRadius="l" padding="m" > - + {proposal?.tags .filter((tag) => tag !== 'tags') - .map((tag) => ( + .map((tag, idx) => ( 0 ? 's' : 'none'} padding="s" backgroundColor={ tag.toLowerCase().includes('temp check') @@ -286,10 +287,13 @@ export const ProposalScreen = () => { backgroundColor="secondaryBackground" borderRadius="l" paddingTop="m" - gap="s" > - {votingResults.results?.map((r) => ( - + {votingResults.results?.map((r, idx) => ( + 0 ? 's' : 'none'} + > { )} - - {votingResults.results?.map((r) => ( + + {votingResults.results?.map((r, idx) => ( { {loading && } - - {!loading && - proposals - ?.filter((p) => Boolean(p.info)) - .map((proposal) => ( - - navigation.push('ProposalScreen', { - proposal: p.toBase58(), - }) - } - /> - ))} - + {!loading && + proposals + ?.filter((p) => Boolean(p.info)) + .map((proposal, idx) => ( + 0 ? 'm' : 'none'} + proposal={proposal.info as ProposalV0} + proposalKey={proposal.publicKey} + onPress={async (p) => + navigation.push('ProposalScreen', { + proposal: p.toBase58(), + }) + } + /> + ))} - - {positions.map((pos) => { - const { lockup } = pos - const lockupKind = Object.keys( - lockup.kind, - )[0] as string - const isConstant = lockupKind === 'constant' - const isSelected = selectedPosPk?.equals( - pos.pubkey, - ) + {positions.map((pos, idx) => { + const { lockup } = pos + const lockupKind = Object.keys( + lockup.kind, + )[0] as string + const isConstant = lockupKind === 'constant' + const isSelected = selectedPosPk?.equals(pos.pubkey) - return ( - setSelectedPosPk(pos.pubkey)} - > - - - - {t('gov.positions.lockupType')} - - - {isConstant ? 'Constant' : 'Decaying'} - - - - - {t('gov.positions.voteMult')} - - - {( - (pos.votingPower.isZero() - ? 0 - : // Mul by 100 to get 2 decimal places - pos.votingPower - .mul(new BN(100)) - .div(pos.amountDepositedNative) - .toNumber() / 100) / - (pos.genesisEnd.gt(new BN(unixNow)) - ? pos.votingMint - .genesisVotePowerMultiplier - : 1) - ).toFixed(2)} - - - - - {isConstant - ? 'Min. Duration' - : 'Time left'} - - - {isConstant - ? getMinDurationFmt( - pos.lockup.startTs, - pos.lockup.endTs, - ) - : getTimeLeftFromNowFmt( - pos.lockup.endTs, - )} - - - - + return ( + 0 ? 'm' : 'none'} + flex={1} + borderRadius="l" + backgroundColor={ + isSelected + ? 'secondaryBackground' + : 'secondary' + } + onPress={() => setSelectedPosPk(pos.pubkey)} + > + + + + {t('gov.positions.lockupType')} + - {t('gov.positions.lockedAmount', { - amount: - mintAcc && - humanReadable( - new BN(pos.amountDepositedNative), - mintAcc.decimals, - ), - symbol, - })} + {isConstant ? 'Constant' : 'Decaying'} - - ) - })} - + + + {t('gov.positions.voteMult')} + + + {( + (pos.votingPower.isZero() + ? 0 + : // Mul by 100 to get 2 decimal places + pos.votingPower + .mul(new BN(100)) + .div(pos.amountDepositedNative) + .toNumber() / 100) / + (pos.genesisEnd.gt(new BN(unixNow)) + ? pos.votingMint + .genesisVotePowerMultiplier + : 1) + ).toFixed(2)} + + + + + {isConstant + ? 'Min. Duration' + : 'Time left'} + + + {isConstant + ? getMinDurationFmt( + pos.lockup.startTs, + pos.lockup.endTs, + ) + : getTimeLeftFromNowFmt( + pos.lockup.endTs, + )} + + + + + + {t('gov.positions.lockedAmount', { + amount: + mintAcc && + humanReadable( + new BN(pos.amountDepositedNative), + mintAcc.decimals, + ), + symbol, + })} + + + + ) + })} )} diff --git a/src/features/governance/VoteOption.tsx b/src/features/governance/VoteOption.tsx index fdff94d8f..8edebdf33 100644 --- a/src/features/governance/VoteOption.tsx +++ b/src/features/governance/VoteOption.tsx @@ -5,7 +5,8 @@ import React from 'react' import Box from '@components/Box' import CircleLoader from '@components/CircleLoader' import { useColors } from '@theme/themeHooks' -import { Color } from '@theme/theme' +import { Color, Theme } from '@theme/theme' +import { BoxProps } from '@shopify/restyle' import { VoteChoiceWithMeta, VotingResultColors } from './governanceTypes' export const VoteOption = ({ @@ -16,6 +17,7 @@ export const VoteOption = ({ voting, onVote, onRelinquishVote, + ...boxProps }: { option: VoteChoiceWithMeta myWeight?: BN @@ -24,17 +26,17 @@ export const VoteOption = ({ voting: boolean onVote?: () => Promise onRelinquishVote?: () => Promise -}) => { +} & BoxProps) => { const colors = useColors() return ( ) : ( - +