From fdd13d451db4abab1f9b4f0f4ef3600833e31f39 Mon Sep 17 00:00:00 2001 From: vctt94 Date: Thu, 26 Mar 2020 13:22:17 -0300 Subject: [PATCH] lint --- app/actions/GovernanceActions.js | 2 +- app/components/modals/Modal.js | 3 +- .../Proposals/PoliteiaDisabled.js | 1 - .../views/ProposalDetails/ChooseVoteOption.js | 96 +++++++++---------- app/components/views/ProposalDetails/Page.js | 12 +-- .../views/ProposalDetails/helpers.js | 2 +- app/components/views/ProposalDetails/index.js | 2 - app/reducers/governance.js | 8 +- 8 files changed, 59 insertions(+), 67 deletions(-) diff --git a/app/actions/GovernanceActions.js b/app/actions/GovernanceActions.js index 2aebc38953..8ea61e3046 100644 --- a/app/actions/GovernanceActions.js +++ b/app/actions/GovernanceActions.js @@ -488,7 +488,7 @@ export const getProposalDetails = (token) => async (dispatch, getState) => { } }; -export const viewProposalDetails = (token) => (dispatch, getState) => { +export const viewProposalDetails = (token) => (dispatch) => { dispatch(pushHistory(`/proposal/details/${token}`)); }; diff --git a/app/components/modals/Modal.js b/app/components/modals/Modal.js index f4262caed5..ad43de0c48 100644 --- a/app/components/modals/Modal.js +++ b/app/components/modals/Modal.js @@ -1,6 +1,5 @@ import { showCheck, eventOutsideElement } from "helpers"; import ReactDOM from "react-dom"; -import { modal } from "connectors"; import EventListener from "react-event-listener"; import "style/Modals.less"; import Draggable from "react-draggable"; @@ -28,7 +27,7 @@ function Modal(props) { const showingSidebarMenu = useSelector(sel.showingSidebarMenu); const { children, className, draggable } = props; const domNode = document.getElementById("modal-portal"); - const modalRef = useRef(null) + const modalRef = useRef(null); const innerView =
{children} diff --git a/app/components/views/GovernancePage/Proposals/PoliteiaDisabled.js b/app/components/views/GovernancePage/Proposals/PoliteiaDisabled.js index 58d2ee8da3..2d64eed372 100644 --- a/app/components/views/GovernancePage/Proposals/PoliteiaDisabled.js +++ b/app/components/views/GovernancePage/Proposals/PoliteiaDisabled.js @@ -1,7 +1,6 @@ import { FormattedMessage as T } from "react-intl"; import { EnableExternalRequestButton } from "buttons"; import { EXTERNALREQUEST_POLITEIA } from "main_dev/externalRequests"; -import { proposals } from "connectors"; export default ({ getTokenAndInitialBatch }) => (
diff --git a/app/components/views/ProposalDetails/ChooseVoteOption.js b/app/components/views/ProposalDetails/ChooseVoteOption.js index acb1892d6d..417c67250e 100644 --- a/app/components/views/ProposalDetails/ChooseVoteOption.js +++ b/app/components/views/ProposalDetails/ChooseVoteOption.js @@ -5,7 +5,7 @@ import { useMachine } from "@xstate/react"; import { StakeyBounceXs } from "indicators"; import { useDispatch } from "react-redux"; import { useState } from "react"; -import { ProposalError } from "./helpers" +import { ProposalError } from "./helpers"; import * as gov from "actions/GovernanceActions"; const VoteOption = ({ value, description, onClick, checked }) => ( @@ -14,35 +14,35 @@ const VoteOption = ({ value, description, onClick, checked }) => ( readOnly={!onClick} onChange={onClick} value={value} checked ={checked} - /> + />
); function UpdateVoteChoiceModalButton({ onSubmit, newVoteChoice, eligibleTicketCount }) { return ( - - -
-
- {newVoteChoice} -
- - } - modalDescription={ - - } - disabled={!newVoteChoice} - onSubmit={onSubmit} - buttonLabel={} - /> -)}; + + +
+
+ {newVoteChoice} +
+ + } + modalDescription={ + + } + disabled={!newVoteChoice} + onSubmit={onSubmit} + buttonLabel={} + /> + );} function getError(error) { if (!error) return; @@ -50,14 +50,14 @@ function getError(error) { if (typeof error === "object") { if (error.message) return error.message; return JSON.stringify(error); - } + } } function ChooseVoteOption({ viewedProposalDetails, voteOptions, currentVoteChoice, votingComplete, eligibleTicketCount }) { const [ newVoteChoice, setVoteOption ] = useState(null); - + const dispatch = useDispatch(); const onUpdateVoteChoice = (privatePassphrase) => dispatch( gov.updateVoteChoice(viewedProposalDetails, newVoteChoice, privatePassphrase) @@ -85,40 +85,40 @@ function ChooseVoteOption({ return currentVoteChoice === "abstain" && setVoteOption(o.id) } + onClick={ () => currentVoteChoice === "abstain" && setVoteOption(o.id) } checked={ newVoteChoice ? newVoteChoice === o.id : currentVoteChoice !== "abstain" ? currentVoteChoice.id === o.id : null } - /> + />; })}
{ !votingComplete && send({type: "FETCH", privatePassphrase }), eligibleTicketCount + newVoteChoice, onSubmit: (privatePassphrase) => send({ type: "FETCH", privatePassphrase }), eligibleTicketCount }} /> } ); switch (state.value) { - case "idle": - return ; - case "loading": - return ( -
- - ... -
- ); - case "success": - return ; - case "failure": - return ; + case "idle": + return ; + case "loading": + return ( +
+ + ... +
+ ); + case "success": + return ; + case "failure": + return ; } } diff --git a/app/components/views/ProposalDetails/Page.js b/app/components/views/ProposalDetails/Page.js index 491f86e214..2d8cbe630b 100644 --- a/app/components/views/ProposalDetails/Page.js +++ b/app/components/views/ProposalDetails/Page.js @@ -3,21 +3,19 @@ import { InvisibleButton } from "buttons"; import { PoliteiaLink, VerticalAccordion } from "shared"; import { ProposalNotVoting, NoTicketsVotingInfo, OverviewField, OverviewVotingProgressInfo, - NoElligibleTicketsVotingInfo, UpdatingVoteChoice, TimeValue, - ProposalText, ProposalAbandoned + NoElligibleTicketsVotingInfo, TimeValue, ProposalText, ProposalAbandoned } from "./helpers"; import ChooseVoteOption from "./ChooseVoteOption"; import { VOTESTATUS_ACTIVEVOTE, VOTESTATUS_FINISHEDVOTE, PROPOSALSTATUS_ABANDONED } from "actions/GovernanceActions"; import { useSelector } from "react-redux"; -import { useState } from "react" +import { useState } from "react"; import * as sel from "selectors"; -function ProposalDetails ({ +function ProposalDetails ({ viewedProposalDetails, showPurchaseTicketsPage, setVoteOption, - newVoteChoice, updateVoteChoiceAttempt, text, goBackHistory, - onUpdateVoteChoice + newVoteChoice, text, goBackHistory }) { const { creator, timestamp, endTimestamp, currentVoteChoice, hasEligibleTickets, @@ -47,7 +45,7 @@ function ProposalDetails ({ }} />; } return ; - }; + } let voteInfo = null; // Check if proposal is abandoned. If it is not we check its vote status if (proposalStatus === PROPOSALSTATUS_ABANDONED) { diff --git a/app/components/views/ProposalDetails/helpers.js b/app/components/views/ProposalDetails/helpers.js index 922d9362a3..bf486b330f 100644 --- a/app/components/views/ProposalDetails/helpers.js +++ b/app/components/views/ProposalDetails/helpers.js @@ -1,7 +1,7 @@ import { shell } from "electron"; import { KeyBlueButton, InvisibleConfirmPoliteiaModalButton } from "buttons"; import { FormattedMessage as T } from "react-intl"; -import { VotingProgress, PoliteiaLoading } from "indicators"; +import { VotingProgress } from "indicators"; import { showCheck } from "helpers"; import { default as ReactMarkdown } from "react-markdown"; import { FormattedRelative } from "shared"; diff --git a/app/components/views/ProposalDetails/index.js b/app/components/views/ProposalDetails/index.js index edd2eb43cc..a236a06110 100644 --- a/app/components/views/ProposalDetails/index.js +++ b/app/components/views/ProposalDetails/index.js @@ -1,8 +1,6 @@ -import { proposals } from "connectors"; import Page from "./Page"; import { ProposalError, politeiaMarkdownIndexMd } from "./helpers"; import { PoliteiaLoading } from "indicators"; -import { useState } from "react"; import * as sel from "selectors"; import { useSelector, useDispatch } from "react-redux"; import { useParams } from "react-router-dom"; diff --git a/app/reducers/governance.js b/app/reducers/governance.js index ddd6d58230..77f039c195 100644 --- a/app/reducers/governance.js +++ b/app/reducers/governance.js @@ -1,10 +1,8 @@ import { - GETPROPOSAL_ATTEMPT, GETPROPOSAL_FAILED, GETPROPOSAL_SUCCESS, - UPDATEVOTECHOICE_ATTEMPT, UPDATEVOTECHOICE_SUCCESS, UPDATEVOTECHOICE_FAILED, - GETTOKEN_INVENTORY_SUCCESS, GETPROPROSAL_UPDATEVOTESTATUS_ATTEMPT, - GETPROPROSAL_UPDATEVOTESTATUS_SUCCESS, GETPROPROSAL_UPDATEVOTESTATUS_FAILED, + UPDATEVOTECHOICE_SUCCESS, GETTOKEN_INVENTORY_SUCCESS, GETPROPROSAL_UPDATEVOTESTATUS_ATTEMPT, + GETPROPOSAL_ATTEMPT, GETPROPOSAL_FAILED, GETPROPOSAL_SUCCESS, REMOVED_PROPOSALS_FROM_LIST, GETTOKEN_INVENTORY_ATTEMPT, DISABLE_POLITEIA_SUCCESS, COMPARE_INVENTORY_SUCCESS, - REMOVED_PROPOSALS_FROM_LIST + GETPROPROSAL_UPDATEVOTESTATUS_SUCCESS, GETPROPROSAL_UPDATEVOTESTATUS_FAILED } from "actions/GovernanceActions"; import { CLOSEWALLET_SUCCESS