Export proposal components (#85)

This commit is contained in:
Szymon Szlachtowicz 2021-09-22 01:41:02 +02:00 committed by GitHub
parent e4f65a84be
commit e4c30cb3b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 16 deletions

View File

@ -1,7 +1,6 @@
import React, { useEffect, useMemo, useState } from 'react'
import { useParams } from 'react-router'
import styled from 'styled-components'
import { useEthers } from '@usedapp/core'
import { FinalBtn, VoteBtnAgainst, VoteBtnFor } from '../Buttons'
import { VoteSubmitButton } from '../ProposalVoteCard/VoteSubmitButton'
import { VoteChart } from '../ProposalVoteCard/VoteChart'
@ -14,11 +13,11 @@ import { BigNumber } from 'ethers'
interface ProposalVoteMobileProps {
wakuVoting: WakuVoting
availableAmount: number
account: string | null | undefined
}
export function ProposalVoteMobile({ wakuVoting, availableAmount }: ProposalVoteMobileProps) {
export function ProposalVoteMobile({ wakuVoting, availableAmount, account }: ProposalVoteMobileProps) {
const { id } = useParams<{ id: string }>()
const { account } = useEthers()
const [proposingAmount, setProposingAmount] = useState(0)
const [selectedVoted, setSelectedVoted] = useState(0)
const votingRoom = useVotingRoom(Number(id), wakuVoting)

View File

@ -1,4 +1,22 @@
import { Proposal } from './components/Proposal'
import { ProposalMobile } from './components/mobile/ProposalMobile'
import { ProposeMobile } from './components/mobile/ProposeMobile'
import { ProposalVoteMobile } from './components/mobile/ProposalVoteMobile'
export { Proposal, ProposalMobile }
import { VotingEmpty } from './components/VotingEmpty'
import { VotePropose } from './components/VotePropose'
import { ProposalList } from './components/ProposalList'
import { ProposalCard } from './components/ProposalCard'
import { ProposalHeader } from './components/ProposalHeader'
import { NotificationItem } from './components/NotificationItem'
import { NewVoteModal } from './components/newVoteModal/NewVoteModal'
export {
VotingEmpty,
VotePropose,
ProposalList,
ProposalCard,
ProposalHeader,
NotificationItem,
NewVoteModal,
ProposeMobile,
ProposalVoteMobile,
}

View File

@ -1,12 +1,9 @@
import React, { useCallback, useRef, useState } from 'react'
import styled from 'styled-components'
import { ProposalHeader } from './ProposalHeader'
import { ProposalHeader, ProposalList, VotingEmpty, NewVoteModal } from '@status-waku-voting/proposal-components'
import { blueTheme } from '@status-waku-voting/react-components/dist/esm/src/style/themes'
import { ProposalList } from './ProposalList'
import { WakuVoting } from '@status-waku-voting/core'
import { VotingEmpty } from './VotingEmpty'
import { useTokenBalance } from '@status-waku-voting/react-components'
import { NewVoteModal } from './newVoteModal/NewVoteModal'
import { useEthers } from '@usedapp/core'
import { Modal, Networks, useMobileVersion, Theme } from '@status-waku-voting/react-components'
import { useHistory } from 'react-router'

View File

@ -2,9 +2,8 @@ import React from 'react'
import { Redirect, Route, Switch } from 'react-router'
import { BrowserRouter } from 'react-router-dom'
import styled from 'styled-components'
import { ProposalVoteMobile } from './ProposalVoteMobile'
import { ProposeMobile } from './ProposeMobile'
import { Proposal } from '../Proposal'
import { ProposalVoteMobile, ProposeMobile } from '@status-waku-voting/proposal-components'
import { Proposal } from './Proposal'
import { WakuVoting } from '@status-waku-voting/core'
import { useTokenBalance } from '@status-waku-voting/react-components'
@ -19,9 +18,8 @@ export function ProposalMobile({ wakuVoting, account }: ProposalMobileProps) {
<BrowserRouter>
<ProposalWrapper>
<Switch>
<Route exact path="/" render={() => <Redirect to="/proposal" />} />
<Route exact path="/votingRoom/:id">
<ProposalVoteMobile wakuVoting={wakuVoting} availableAmount={tokenBalance} />
<ProposalVoteMobile wakuVoting={wakuVoting} availableAmount={tokenBalance} account={account} />
</Route>
<Route exact path="/creation">
<ProposeMobile availableAmount={tokenBalance} wakuVoting={wakuVoting} />

View File

@ -1,6 +1,7 @@
import React, { useRef } from 'react'
import { useWakuProposal } from '@status-waku-voting/proposal-hooks'
import { Proposal, ProposalMobile } from '@status-waku-voting/proposal-components'
import { ProposalMobile } from './components/ProposalMobile'
import { Proposal } from './components/Proposal'
import { TopBar, GlobalStyle, useMobileVersion } from '@status-waku-voting/react-components'
import votingIcon from './assets/images/voting.svg'
import styled from 'styled-components'