store voted proposals to local storage
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
063a9af321
commit
d30dc0dc74
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.17",
|
"version": "0.5.18",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ import { DecimalBigNumber } from "../../helpers/DecimalBigNumber";
|
|||||||
|
|
||||||
import ProposalModal from "./components/ProposalModal";
|
import ProposalModal from "./components/ProposalModal";
|
||||||
import { parseFunctionCalldata } from "./components/functions/index";
|
import { parseFunctionCalldata } from "./components/functions/index";
|
||||||
import { MY_PROPOSALS_PREFIX, VOTED_PROPOSALS_PREFIX } from "./helpers";
|
import { MY_PROPOSALS_PREFIX } from "./helpers";
|
||||||
|
|
||||||
const NewProposal = ({ config, address, connect, chainId }) => {
|
const NewProposal = ({ config, address, connect, chainId }) => {
|
||||||
const isSemiSmallScreen = useMediaQuery("(max-width: 745px)");
|
const isSemiSmallScreen = useMediaQuery("(max-width: 745px)");
|
||||||
|
|||||||
@ -28,7 +28,7 @@ import { PrimaryButton, SecondaryButton } from "../../components/Button";
|
|||||||
import GhostStyledIcon from "../../components/Icon/GhostIcon";
|
import GhostStyledIcon from "../../components/Icon/GhostIcon";
|
||||||
import ArrowUpIcon from "../../assets/icons/arrow-up.svg?react";
|
import ArrowUpIcon from "../../assets/icons/arrow-up.svg?react";
|
||||||
|
|
||||||
import { formatNumber, shorten } from "../../helpers";
|
import { formatNumber, formatCurrency, shorten } from "../../helpers";
|
||||||
import { prettifySecondsInDays } from "../../helpers/timeUtil";
|
import { prettifySecondsInDays } from "../../helpers/timeUtil";
|
||||||
import { DecimalBigNumber, } from "../../helpers/DecimalBigNumber";
|
import { DecimalBigNumber, } from "../../helpers/DecimalBigNumber";
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ import { convertStatusToTemplate, convertStatusToLabel } from "./helpers";
|
|||||||
import { parseFunctionCalldata } from "./components/functions";
|
import { parseFunctionCalldata } from "./components/functions";
|
||||||
|
|
||||||
import { networkAvgBlockSpeed } from "../../constants";
|
import { networkAvgBlockSpeed } from "../../constants";
|
||||||
import { formatCurrency } from "../../helpers";
|
|
||||||
import { useTokenSymbol, usePastTotalSupply, usePastVotes, useBalance } from "../../hooks/tokens";
|
import { useTokenSymbol, usePastTotalSupply, usePastVotes, useBalance } from "../../hooks/tokens";
|
||||||
import {
|
import {
|
||||||
useProposalState,
|
useProposalState,
|
||||||
@ -54,6 +54,8 @@ import {
|
|||||||
releaseLocked
|
releaseLocked
|
||||||
} from "../../hooks/governance";
|
} from "../../hooks/governance";
|
||||||
|
|
||||||
|
import { VOTED_PROPOSALS_PREFIX } from "./helpers";
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
import Timeline from '@mui/lab/Timeline';
|
import Timeline from '@mui/lab/Timeline';
|
||||||
import TimelineItem from '@mui/lab/TimelineItem';
|
import TimelineItem from '@mui/lab/TimelineItem';
|
||||||
@ -156,7 +158,13 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
|||||||
const handleVote = async (against) => {
|
const handleVote = async (against) => {
|
||||||
setIsPending(true);
|
setIsPending(true);
|
||||||
const support = against ? 0 : 1;
|
const support = against ? 0 : 1;
|
||||||
await castVote(chainId, address, proposalId, support);
|
const result = await castVote(chainId, address, proposalId, support);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
const toStore = JSON.stringify(proposalId.toString()));
|
||||||
|
localStorage.setItem(VOTED_PROPOSALS_PREFIX, toStore);
|
||||||
|
}
|
||||||
|
|
||||||
setIsPending(true);
|
setIsPending(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user