Skip to content

Commit

Permalink
Merge pull request #149 from bhargavaparoksham/payout-split
Browse files Browse the repository at this point in the history
feat: payout column with recent payout details
  • Loading branch information
hmrtn authored Mar 1, 2022
2 parents 09ba3fb + c131c02 commit 75a9053
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/react-app/src/routes/party/Party.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Button, Box, Center, Menu, MenuButton, MenuList, MenuItem, Text, Toolti
import { ArrowBackIcon, ChevronDownIcon, QuestionOutlineIcon } from "@chakra-ui/icons";
import { useParams, useHistory } from "react-router-dom";
import { VoteTable, ViewTable, ReceiptsTable, Distribute, Metadata } from "./components";
import { utils } from "ethers";

export default function Party({
address,
Expand Down Expand Up @@ -40,6 +41,10 @@ export default function Party({
setAccountVoteData(submitted);
setCanVote(submitted.length === 0 && participating);
setIsPaid(party.receipts.length > 0);
const len = party.receipts.length;
if(len > 0) {
setAmountToDistribute(utils.formatEther(party.receipts[len-1].amount));
}
setIsParticipant(participating);
setPartyData(party);
setLoading(false);
Expand Down
9 changes: 7 additions & 2 deletions packages/react-app/src/routes/party/components/Distribute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useColorModeValue } from "@chakra-ui/color-mode";
import { QuestionOutlineIcon } from "@chakra-ui/icons";
import { Box, Button, Center, HStack, Text, Tooltip, Spacer } from "@chakra-ui/react";
import { InputNumber } from "antd";
import { BigNumber, ethers } from "ethers";
import { BigNumber, ethers, utils } from "ethers";
import React, { useState } from "react";
import { toWei } from "web3-utils";
import TokenSelect from "./TokenSelect";
Expand Down Expand Up @@ -88,7 +88,12 @@ export const Distribute = ({
setTotal(tot);
setAmounts(amts);
setAddresses(adrs);
setAmountToDistribute(amt);
const len = partyData.receipts.length;
if(len > 0) {
amt > 0 ? setAmountToDistribute(amt) : setAmountToDistribute(utils.formatEther(partyData.receipts[len-1].amount));
} else {
amt > 0 ? setAmountToDistribute(amt) : setAmountToDistribute(0);
}
setHasApprovedAllowance(false);
}
} catch {
Expand Down

0 comments on commit 75a9053

Please sign in to comment.