diff --git a/packages/proposals/src/actions/addCustomSingleSignerTransaction.ts b/packages/proposals/src/actions/addCustomSingleSignerTransaction.ts index 377633b..4be6682 100644 --- a/packages/proposals/src/actions/addCustomSingleSignerTransaction.ts +++ b/packages/proposals/src/actions/addCustomSingleSignerTransaction.ts @@ -1,7 +1,6 @@ import { Account, Connection, - Message, PublicKey, SystemProgram, TransactionInstruction, @@ -16,7 +15,7 @@ import { import { addCustomSingleSignerTransactionInstruction } from '../models/addCustomSingleSignerTransaction'; const { sendTransaction } = contexts.Connection; -const { notify, toUTF8Array, fromUTF8Array } = utils; +const { notify } = utils; const { approve } = models; export const addCustomSingleSignerTransaction = async ( diff --git a/packages/proposals/src/components/Background/index.tsx b/packages/proposals/src/components/Background/index.tsx index 4f8e737..a521e35 100644 --- a/packages/proposals/src/components/Background/index.tsx +++ b/packages/proposals/src/components/Background/index.tsx @@ -1,47 +1,57 @@ -import * as CANNON from 'cannon' -import ReactDOM from 'react-dom' -import React, { useEffect, useState } from 'react' -import { Canvas } from 'react-three-fiber' -import { useCannon, Provider } from './useCannon' -import './styles.less' +import * as CANNON from 'cannon'; +import React, { useEffect, useState } from 'react'; +import { Canvas } from 'react-three-fiber'; +import { useCannon, Provider } from './useCannon'; +import './styles.less'; -function Plane({ position }: { position: any}) { +function Plane({ position }: { position: any }) { // Register plane as a physics body with zero mass const ref = useCannon({ mass: 0 }, (body: any) => { - body.addShape(new CANNON.Plane()) - body.position.set(...position) - }) + body.addShape(new CANNON.Plane()); + body.position.set(...position); + }); return ( - ) + ); } -function Box({ position }: { position: any}) { +function Box({ position }: { position: any }) { // Register box as a physics body with mass const ref = useCannon({ mass: 100000 }, (body: any) => { - body.addShape(new CANNON.Box(new CANNON.Vec3(1, 1, 1))) - body.position.set(...position) - }) + body.addShape(new CANNON.Box(new CANNON.Vec3(1, 1, 1))); + body.position.set(...position); + }); return ( - ) + ); } export const Background = () => { - const [showPlane, set] = useState(true) + const [showPlane, set] = useState(true); // When React removes (unmounts) the upper plane after 5 sec, objects should drop ... // This may seem like magic, but as the plane unmounts it removes itself from cannon and that's that - useEffect(() => void setTimeout(() => set(false), 3000), []) + useEffect(() => void setTimeout(() => set(false), 3000), []); return ( - + - + {showPlane && } @@ -54,5 +64,5 @@ export const Background = () => { {!showPlane && } - ) + ); }; diff --git a/packages/proposals/src/components/Layout/index.tsx b/packages/proposals/src/components/Layout/index.tsx index 84ffb3f..b3ede8c 100644 --- a/packages/proposals/src/components/Layout/index.tsx +++ b/packages/proposals/src/components/Layout/index.tsx @@ -4,15 +4,13 @@ import { Breadcrumb, Layout } from 'antd'; import { Link, useLocation } from 'react-router-dom'; import { LABELS } from '../../constants'; -import { contexts, components } from '@oyster/common'; +import { components } from '@oyster/common'; import { Content, Header } from 'antd/lib/layout/layout'; import Logo from './dark-horizontal-combined-rainbow.inline.svg'; const { AppBar } = components; -const { useConnectionConfig } = contexts.Connection; export const AppLayout = React.memo((props: any) => { - const { env } = useConnectionConfig(); const location = useLocation(); const breadcrumbNameMap: any = { @@ -44,19 +42,13 @@ export const AppLayout = React.memo((props: any) => {
-
- - {`Solana - -
- -
+
+ + {`Solana + +
+ + {/* {breadcrumbItems} */} {props.children} diff --git a/packages/proposals/src/components/Proposal/InstructionCard.tsx b/packages/proposals/src/components/Proposal/InstructionCard.tsx index 7de76cf..1e8ba7d 100644 --- a/packages/proposals/src/components/Proposal/InstructionCard.tsx +++ b/packages/proposals/src/components/Proposal/InstructionCard.tsx @@ -108,9 +108,13 @@ function PlayStatusButton({ useEffect(() => { if (ineligibleToSee) { - const id = setTimeout(() => { + const timer = setTimeout(() => { connection.getSlot().then(setCurrSlot); }, 5000); + + return () => { + clearTimeout(timer); + }; } }, [ineligibleToSee, connection, currSlot]); @@ -127,8 +131,8 @@ function PlayStatusButton({ }; if ( - state.info.status != TimelockStateStatus.Executing && - state.info.status != TimelockStateStatus.Completed + state.info.status !== TimelockStateStatus.Executing && + state.info.status !== TimelockStateStatus.Completed ) return null; if (ineligibleToSee) return null; diff --git a/packages/proposals/src/components/Proposal/MintSourceTokens.tsx b/packages/proposals/src/components/Proposal/MintSourceTokens.tsx index a24794a..3e538be 100644 --- a/packages/proposals/src/components/Proposal/MintSourceTokens.tsx +++ b/packages/proposals/src/components/Proposal/MintSourceTokens.tsx @@ -57,7 +57,7 @@ export default function MintSourceTokens({ let failedSourcesHold: SourceEntryInterface[] = []; const zeroKey = PROGRAM_IDS.system; sourceHoldersAndCounts.forEach((value: string, index: number) => { - if (index % 2 == 0) + if (index % 2 === 0) sourceHolders.push({ owner: value ? new PublicKey(value) : zeroKey, tokenAmount: 0, @@ -75,7 +75,7 @@ export default function MintSourceTokens({ sourceAccount: undefined, }); - if (!sourceHolders.find(v => v.owner != zeroKey)) { + if (!sourceHolders.find(v => v.owner !== zeroKey)) { notify({ message: LABELS.ENTER_AT_LEAST_ONE_PUB_KEY, type: 'error', diff --git a/packages/proposals/src/components/Proposal/VoterTable.tsx b/packages/proposals/src/components/Proposal/VoterTable.tsx index 15506e2..e996309 100644 --- a/packages/proposals/src/components/Proposal/VoterTable.tsx +++ b/packages/proposals/src/components/Proposal/VoterTable.tsx @@ -90,7 +90,7 @@ export const VoterTable = (props: IVoterTable) => { render: (count: number, record: VoterDisplayData) => ( { { title: LABELS.PERCENTAGE, dataIndex: 'value', - key: 'value', + key: 'percentage', align: 'center', render: (count: number, record: VoterDisplayData) => ( { (acc, proposalKey) => { let proposal = proposals[proposalKey]; let state = states[proposal.info.state.toBase58()]; - if (proposal.info.config.toBase58() == configKey) { + if (proposal.info.config.toBase58() === configKey) { acc.active = acc.active + (state.info.status === TimelockStateStatus.Voting || diff --git a/packages/proposals/src/views/proposal/index.tsx b/packages/proposals/src/views/proposal/index.tsx index f5fec67..c7cfd28 100644 --- a/packages/proposals/src/views/proposal/index.tsx +++ b/packages/proposals/src/views/proposal/index.tsx @@ -113,7 +113,7 @@ function useLoadGist({ } fetch(toFetch) .then(async resp => { - if (resp.status == 200) { + if (resp.status === 200) { if (isGist) { const jsonContent = await resp.json(); const nextUrlFileName = Object.keys(jsonContent['files'])[0]; @@ -123,7 +123,7 @@ function useLoadGist({ ); } else setContent(await resp.text()); } else { - if (resp.status == 403 && isGist) + if (resp.status === 403 && isGist) setMsg(LABELS.GIT_CONTENT_EXCEEDED); setFailed(true); } @@ -408,7 +408,11 @@ function InnerProposalView({ failed ? (

{LABELS.DESCRIPTION}:{' '} - + {msg ? msg : LABELS.NO_LOAD}

diff --git a/packages/proposals/src/views/proposal/new.tsx b/packages/proposals/src/views/proposal/new.tsx index a4d5a2a..8da7ca9 100644 --- a/packages/proposals/src/views/proposal/new.tsx +++ b/packages/proposals/src/views/proposal/new.tsx @@ -138,7 +138,9 @@ export function NewForm({ > diff --git a/packages/proposals/src/views/proposals/index.tsx b/packages/proposals/src/views/proposals/index.tsx index 7e8b22f..cd221fb 100644 --- a/packages/proposals/src/views/proposals/index.tsx +++ b/packages/proposals/src/views/proposals/index.tsx @@ -13,7 +13,7 @@ export const ProposalsView = () => { const history = useHistory(); const { proposals, states } = useProposals(); const config = useConfig(id); - const [page, setPage] = useState(0); + const [, setPage] = useState(0); const { tokenMap } = useConnectionConfig(); const { connected } = useWallet(); const token = tokenMap.get( @@ -65,7 +65,11 @@ export const ProposalsView = () => { />