From e4c30cb3b5342b1c7e63dbbe7c88b2f083dd0aeb Mon Sep 17 00:00:00 2001 From: Szymon Szlachtowicz <38212223+Szymx95@users.noreply.github.com> Date: Wed, 22 Sep 2021 01:41:02 +0200 Subject: [PATCH] Export proposal components (#85) --- .../components/mobile/ProposalVoteMobile.tsx | 5 ++-- packages/proposal-components/src/index.ts | 24 ++++++++++++++++--- .../src/components/Proposal.tsx | 5 +--- .../src/components}/ProposalMobile.tsx | 8 +++---- packages/proposal-example/src/index.tsx | 3 ++- 5 files changed, 29 insertions(+), 16 deletions(-) rename packages/{proposal-components => proposal-example}/src/components/Proposal.tsx (94%) rename packages/{proposal-components/src/components/mobile => proposal-example/src/components}/ProposalMobile.tsx (83%) diff --git a/packages/proposal-components/src/components/mobile/ProposalVoteMobile.tsx b/packages/proposal-components/src/components/mobile/ProposalVoteMobile.tsx index 4c3e7ee..d4722c8 100644 --- a/packages/proposal-components/src/components/mobile/ProposalVoteMobile.tsx +++ b/packages/proposal-components/src/components/mobile/ProposalVoteMobile.tsx @@ -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) diff --git a/packages/proposal-components/src/index.ts b/packages/proposal-components/src/index.ts index 51233bd..fdfd465 100644 --- a/packages/proposal-components/src/index.ts +++ b/packages/proposal-components/src/index.ts @@ -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, +} diff --git a/packages/proposal-components/src/components/Proposal.tsx b/packages/proposal-example/src/components/Proposal.tsx similarity index 94% rename from packages/proposal-components/src/components/Proposal.tsx rename to packages/proposal-example/src/components/Proposal.tsx index 5bf6ddc..4f272c5 100644 --- a/packages/proposal-components/src/components/Proposal.tsx +++ b/packages/proposal-example/src/components/Proposal.tsx @@ -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' diff --git a/packages/proposal-components/src/components/mobile/ProposalMobile.tsx b/packages/proposal-example/src/components/ProposalMobile.tsx similarity index 83% rename from packages/proposal-components/src/components/mobile/ProposalMobile.tsx rename to packages/proposal-example/src/components/ProposalMobile.tsx index f90b2e6..1007955 100644 --- a/packages/proposal-components/src/components/mobile/ProposalMobile.tsx +++ b/packages/proposal-example/src/components/ProposalMobile.tsx @@ -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) { - } /> - + diff --git a/packages/proposal-example/src/index.tsx b/packages/proposal-example/src/index.tsx index 80981ec..39f7789 100644 --- a/packages/proposal-example/src/index.tsx +++ b/packages/proposal-example/src/index.tsx @@ -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'