on master help sign in
Clean up senate.js for less warnings
commit45c8c6e69bee0a40316c35e80682c7b43093e1fb authorFang <git@fang.io> dateThu 19 Dec 2019, 18:46 (7 years ago) parentbc8d8c0
1 file changed+11−33
src/views/Senate.js+11−33
src/views/Senate.js+11−33
@@ -1,42 +1,26 @@
11import React, { useCallback, useMemo, useState } from 'react';
2−import cn from 'classnames';
3−import { Grid, Text, Input, P, LinkButton } from 'indigo-react';
2+import { Grid, Text, P, LinkButton } from 'indigo-react';
43import * as azimuth from 'azimuth-js';
5−import ob from 'urbit-ob';
64
75import { useNetwork } from 'store/network';
8−import { usePointCache } from 'store/pointCache';
96import { usePointCursor } from 'store/pointCursor';
107
118import * as need from 'lib/need';
129import useEthereumTransaction from 'lib/useEthereumTransaction';
1310import { GAS_LIMITS } from 'lib/constants';
14−import patp2dec from 'lib/patp2dec';
15−import { getSpawnCandidate } from 'lib/child';
1611import { useLocalRouter } from 'lib/LocalRouter';
17−import useConstant from 'lib/useConstant';
1812
1913import { keccak256 } from 'lib/wallet';
2014
2115import ViewHeader from 'components/ViewHeader';
2216import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
2317import View from 'components/View';
24−import { PointInput, AddressInput } from 'form/Inputs';
25−import {
26− composeValidator,
27− buildPointValidator,
28− buildAddressValidator,
29− hasErrors,
30−} from 'form/validators';
3118import BridgeForm from 'form/BridgeForm';
32−import FormError from 'form/FormError';
33−import CopiableAddress from 'components/CopiableAddress';
3419import convertToInt from 'lib/convertToInt';
3520
3621function useCastDocumentVote() {
3722 const { contracts } = useNetwork();
3823 const { pointCursor } = usePointCursor();
39− const { syncDetails } = usePointCache();
4024
4125 const _contracts = need.contracts(contracts);
4226 const _point = need.point(pointCursor);
@@ -66,15 +50,9 @@ export default function Senate() {
6650 const _contracts = need.contracts(contracts);
6751 const _point = convertToInt(need.point(pointCursor), 10);
6852
69− const {
70− construct,
71− unconstruct,
72− inputsLocked,
73− completed,
74− bind,
75− } = useCastDocumentVote();
53+ const { construct, bind } = useCastDocumentVote();
7654
77− const [documentHash, setDocumentHash] = useState('0x...');
55+ // const [documentHash, setDocumentHash] = useState('0x...');
7856 const [majorities, setMajorities] = useState([]);
7957 const [proposals, setProposals] = useState([]);
8058 const [polls, setPolls] = useState({});
@@ -103,7 +81,7 @@ export default function Senate() {
10381 setPolls(polls);
10482 setLoading(false);
10583 return;
106− }, [_contracts]);
84+ }, [_contracts, _point]);
10785
10886 const [open, closed] = useMemo(() => {
10987 let open = [];
@@ -185,15 +163,15 @@ export default function Senate() {
185163 </>
186164 );
187165 });
188− }, [open, polls, votingOn]);
166+ }, [open, polls, votingOn, doVote]);
189167
190168 const onDocumentChange = useCallback(({ valid, values }) => {
191− if (values.document) {
192− const hash = '0x' + keccak256(values.document.trim()).toString('hex');
193− setDocumentHash(hash);
194− } else {
195− setDocumentHash('0x...');
196− }
169+ // if (values.document) {
170+ // const hash = '0x' + keccak256(values.document.trim()).toString('hex');
171+ // setDocumentHash(hash);
172+ // } else {
173+ // setDocumentHash('0x...');
174+ // }
197175 }, []);
198176
199177 return (