Add propose restrict (#43)
* Add disabled btn style * Extract Warning component * Add warning to propose modal
This commit is contained in:
parent
4218d939a1
commit
3c9c0d2130
|
@ -23,6 +23,7 @@ export const ButtonPrimary = styled(Button)`
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
background: ${Colors.GrayDisabledDark};
|
background: ${Colors.GrayDisabledDark};
|
||||||
|
color: ${Colors.GreyTextDisabled};
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
export const ButtonSecondary = styled(Button)`
|
export const ButtonSecondary = styled(Button)`
|
||||||
|
|
|
@ -5,6 +5,8 @@ import { ButtonPrimary } from '../Button'
|
||||||
import { CardCommunity } from '../Card'
|
import { CardCommunity } from '../Card'
|
||||||
import { Input } from '../Input'
|
import { Input } from '../Input'
|
||||||
import { VotePropose } from '../votes/VotePropose'
|
import { VotePropose } from '../votes/VotePropose'
|
||||||
|
import { Warning } from '../votes/VoteWarning'
|
||||||
|
import { ConfirmBtn } from './VoteConfirmModal'
|
||||||
|
|
||||||
interface ProposeModalProps {
|
interface ProposeModalProps {
|
||||||
availableAmount: number
|
availableAmount: number
|
||||||
|
@ -32,9 +34,18 @@ export function ProposeModal({ availableAmount, setShowConfirmModal, setPublicKe
|
||||||
{publicKey && communityFound && (
|
{publicKey && communityFound && (
|
||||||
<div>
|
<div>
|
||||||
<CardCommunity community={communityFound} />
|
<CardCommunity community={communityFound} />
|
||||||
|
{communityFound.validForAddition ? (
|
||||||
<VoteProposeWrap>
|
<VoteProposeWrap>
|
||||||
<VotePropose availableAmount={availableAmount} />
|
<VotePropose availableAmount={availableAmount} />
|
||||||
</VoteProposeWrap>
|
</VoteProposeWrap>
|
||||||
|
) : (
|
||||||
|
<WarningWrap>
|
||||||
|
<Warning
|
||||||
|
icon="🤏"
|
||||||
|
text={`${communityFound.name} currently only has ${communityFound.numberOfMembers} members. A community needs more than 42 members before a vote to be added to the Status community directory can be proposed.`}
|
||||||
|
/>
|
||||||
|
</WarningWrap>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -45,6 +56,16 @@ export function ProposeModal({ availableAmount, setShowConfirmModal, setPublicKe
|
||||||
</ProposingInfo>
|
</ProposingInfo>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{communityFound && !communityFound.validForAddition ? (
|
||||||
|
<ConfirmBtn
|
||||||
|
onClick={() => {
|
||||||
|
setShowConfirmModal(false)
|
||||||
|
setPublicKey('')
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
OK, let’s move on! <span>🤙</span>
|
||||||
|
</ConfirmBtn>
|
||||||
|
) : (
|
||||||
<ProposingBtn
|
<ProposingBtn
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={!communityFound}
|
disabled={!communityFound}
|
||||||
|
@ -53,6 +74,7 @@ export function ProposeModal({ availableAmount, setShowConfirmModal, setPublicKe
|
||||||
>
|
>
|
||||||
Confirm vote to add community
|
Confirm vote to add community
|
||||||
</ProposingBtn>
|
</ProposingBtn>
|
||||||
|
)}
|
||||||
</CommunityProposing>
|
</CommunityProposing>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -104,3 +126,6 @@ const ProposingBtn = styled(ButtonPrimary)`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 11px 0;
|
padding: 11px 0;
|
||||||
`
|
`
|
||||||
|
const WarningWrap = styled.div`
|
||||||
|
margin: 24px 0;
|
||||||
|
`
|
||||||
|
|
|
@ -61,7 +61,7 @@ const EtherscanLink = styled(LinkExternal)`
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
`
|
`
|
||||||
|
|
||||||
const ConfirmBtn = styled(ButtonSecondary)`
|
export const ConfirmBtn = styled(ButtonSecondary)`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 11px 0;
|
padding: 11px 0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { Colors } from '../../constants/styles'
|
||||||
import { addCommas } from '../../helpers/addCommas'
|
import { addCommas } from '../../helpers/addCommas'
|
||||||
import { CurrentVoting } from '../../models/community'
|
import { CurrentVoting } from '../../models/community'
|
||||||
import { Input } from '../Input'
|
import { Input } from '../Input'
|
||||||
|
import { Warning } from './VoteWarning'
|
||||||
|
|
||||||
export interface VoteProposingProps {
|
export interface VoteProposingProps {
|
||||||
vote?: CurrentVoting
|
vote?: CurrentVoting
|
||||||
|
@ -65,10 +66,10 @@ export function VotePropose({ vote, selectedVote, availableAmount }: VoteProposi
|
||||||
</VoteProposingRangeWrap>
|
</VoteProposingRangeWrap>
|
||||||
|
|
||||||
{vote?.type === 'Remove' && Number(proposingAmount) > 2000000 && vote.timeLeft / 3600 > 24 && (
|
{vote?.type === 'Remove' && Number(proposingAmount) > 2000000 && vote.timeLeft / 3600 > 24 && (
|
||||||
<VoteWarning>
|
<Warning
|
||||||
<span>⚠️</span>
|
icon="⚠️"
|
||||||
<WarningText>{`Your vote will shorten vote duration! Votes over 2,000,000 SNT for ${selectedVote?.noun} of the community shortens the vote duration to 24 hours.`}</WarningText>
|
text={`Your vote will shorten vote duration! Votes over 2,000,000 SNT for ${selectedVote?.noun} of the community shortens the vote duration to 24 hours.`}
|
||||||
</VoteWarning>
|
/>
|
||||||
)}
|
)}
|
||||||
</VoteProposing>
|
</VoteProposing>
|
||||||
)
|
)
|
||||||
|
@ -134,26 +135,3 @@ const VoteProposingRange = styled.input`
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const VoteWarning = styled.div`
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
padding: 16px;
|
|
||||||
background: #ffeff2;
|
|
||||||
border-radius: 6px;
|
|
||||||
margin-bottom: 32px;
|
|
||||||
|
|
||||||
& > span {
|
|
||||||
font-size: 24px;
|
|
||||||
line-height: 32px;
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const WarningText = styled.div`
|
|
||||||
max-width: 353px;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 16px;
|
|
||||||
letter-spacing: 0.1px;
|
|
||||||
`
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
import React from 'react'
|
||||||
|
import styled from 'styled-components'
|
||||||
|
|
||||||
|
type VoteWarningProps = {
|
||||||
|
icon: string
|
||||||
|
text: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Warning({ icon, text }: VoteWarningProps) {
|
||||||
|
return (
|
||||||
|
<VoteWarning>
|
||||||
|
<span>{icon}</span>
|
||||||
|
<WarningText>{text}</WarningText>
|
||||||
|
</VoteWarning>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const VoteWarning = styled.div`
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
padding: 16px;
|
||||||
|
background: #ffeff2;
|
||||||
|
border-radius: 6px;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
|
||||||
|
& > span {
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 32px;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const WarningText = styled.div`
|
||||||
|
max-width: 353px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 16px;
|
||||||
|
letter-spacing: 0.1px;
|
||||||
|
`
|
|
@ -14,6 +14,7 @@ export const Colors = {
|
||||||
GrayDisabledDark: '#888888',
|
GrayDisabledDark: '#888888',
|
||||||
GrayDisabledLight: '#F3F3F3',
|
GrayDisabledLight: '#F3F3F3',
|
||||||
GreyText: '#939BA1',
|
GreyText: '#939BA1',
|
||||||
|
GreyTextDisabled: '#B1B1B1',
|
||||||
GrayLight: '#FBFCFE',
|
GrayLight: '#FBFCFE',
|
||||||
GrayBorder: '#EEF2F5',
|
GrayBorder: '#EEF2F5',
|
||||||
ShadowCard: '0px 2px 12px rgba(0, 0, 0, 0.15)',
|
ShadowCard: '0px 2px 12px rgba(0, 0, 0, 0.15)',
|
||||||
|
|
|
@ -23,8 +23,8 @@ export const communities: Array<CommunityDetail> = [
|
||||||
icon: 'https://static.coindesk.com/wp-content/uploads/2021/01/cryptopunk.jpg',
|
icon: 'https://static.coindesk.com/wp-content/uploads/2021/01/cryptopunk.jpg',
|
||||||
tags: ['nfts', 'collectables', 'cryptopunks', 'quite long', 'funny', 'very long tag', 'short'],
|
tags: ['nfts', 'collectables', 'cryptopunks', 'quite long', 'funny', 'very long tag', 'short'],
|
||||||
description: 'Owners of CryptoPunks, marketplace. Nullam mattis mattis mattis fermentum libero.',
|
description: 'Owners of CryptoPunks, marketplace. Nullam mattis mattis mattis fermentum libero.',
|
||||||
numberOfMembers: 50,
|
numberOfMembers: 4,
|
||||||
validForAddition: true,
|
validForAddition: false,
|
||||||
votingHistory: [],
|
votingHistory: [],
|
||||||
currentVoting: {
|
currentVoting: {
|
||||||
timeLeft: 172800,
|
timeLeft: 172800,
|
||||||
|
|
Loading…
Reference in New Issue