From 0df04a3b8fa93292386370e2e65b24cf09c9aaea Mon Sep 17 00:00:00 2001 From: C Date: Wed, 17 Aug 2022 12:36:51 +0200 Subject: [PATCH 1/5] Update README.md Added Prisma link / walkthrough. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eef9c11a..0affa9ca 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ yarn install Copy `client/sample.env` to `client/.env`. -Setup postgresql locally and create a database and update the `DATABASE_URL` in your `client/.env` +Setup [postgresql locally](https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database) and create a database and update the `DATABASE_URL` in your `client/.env` _A typical postgres example looks like `postgres://user:secret@localhost:5432/ousdgovernance`._ From 27ac0e8c829798affa59203e1e97ff1ef34ca75f Mon Sep 17 00:00:00 2001 From: C Date: Wed, 17 Aug 2022 13:16:20 +0200 Subject: [PATCH 2/5] init move files and folders --- client/components/LeaderboardTable.tsx | 2 +- client/components/Modal.tsx | 2 +- client/components/claim/EligibilityItem.tsx | 2 +- client/components/claim/education/Quiz.tsx | 4 ++-- client/components/holding/Page.tsx | 2 +- client/components/{ => icons}/CheckIcon.tsx | 0 .../components/{ => icons}/CheckIconWhite.tsx | 0 client/components/{ => icons}/CrossIcon.tsx | 0 .../components/{ => icons}/CrossIconWhite.tsx | 0 .../components/{ => icons}/EtherscanIcon.tsx | 0 .../{ => icons}/ExternalLinkIcon.tsx | 0 client/components/{ => icons}/PlayIcon.tsx | 0 client/components/layout.tsx | 2 +- .../proposal/ProposalParameters.tsx | 2 +- client/components/proposal/ProposalTable.tsx | 2 +- client/components/{ => utils}/Address.tsx | 0 client/components/{ => utils}/AdminUtils.js | 0 client/components/{ => utils}/TimeToDate.tsx | 2 +- .../{ => utils}/TransactionListener.tsx | 0 .../vote-escrow/AccountBalances.tsx | 23 +++++++++++++++++++ client/components/vote-escrow/LockupTable.tsx | 2 +- .../components/vote-escrow/LockupsTable.tsx | 6 ++--- client/pages/_app.tsx | 2 +- client/utils/useHistoricalLockupToasts.js | 2 +- 24 files changed, 39 insertions(+), 16 deletions(-) rename client/components/{ => icons}/CheckIcon.tsx (100%) rename client/components/{ => icons}/CheckIconWhite.tsx (100%) rename client/components/{ => icons}/CrossIcon.tsx (100%) rename client/components/{ => icons}/CrossIconWhite.tsx (100%) rename client/components/{ => icons}/EtherscanIcon.tsx (100%) rename client/components/{ => icons}/ExternalLinkIcon.tsx (100%) rename client/components/{ => icons}/PlayIcon.tsx (100%) rename client/components/{ => utils}/Address.tsx (100%) rename client/components/{ => utils}/AdminUtils.js (100%) rename client/components/{ => utils}/TimeToDate.tsx (93%) rename client/components/{ => utils}/TransactionListener.tsx (100%) diff --git a/client/components/LeaderboardTable.tsx b/client/components/LeaderboardTable.tsx index b30c5c60..fb6a939f 100644 --- a/client/components/LeaderboardTable.tsx +++ b/client/components/LeaderboardTable.tsx @@ -1,5 +1,5 @@ import { ethers } from "ethers"; -import { Address } from "components/Address"; +import { Address } from "@/components/utils/Address"; export const LeaderboardTable = ({ voters }: { voters: Array }) => { if (voters.length < 1) { diff --git a/client/components/Modal.tsx b/client/components/Modal.tsx index a94dc337..41671812 100644 --- a/client/components/Modal.tsx +++ b/client/components/Modal.tsx @@ -1,6 +1,6 @@ import { FunctionComponent, ReactNode, Dispatch, SetStateAction } from "react"; import classNames from "classnames"; -import CrossIcon from "components/CrossIcon"; +import CrossIcon from "components/icons/CrossIcon"; interface ModalProps { show: Boolean; diff --git a/client/components/claim/EligibilityItem.tsx b/client/components/claim/EligibilityItem.tsx index ad9e6e85..1083f4c5 100644 --- a/client/components/claim/EligibilityItem.tsx +++ b/client/components/claim/EligibilityItem.tsx @@ -1,7 +1,7 @@ import { FunctionComponent } from "react"; import { utils, BigNumber } from "ethers"; import TokenIcon from "components/TokenIcon"; -import CheckIcon from "components/CheckIcon"; +import CheckIcon from "components/icons/CheckIcon"; import ReactTooltip from "react-tooltip"; import { formatCurrency } from "utils/math"; diff --git a/client/components/claim/education/Quiz.tsx b/client/components/claim/education/Quiz.tsx index cf0722c5..aad54dc5 100644 --- a/client/components/claim/education/Quiz.tsx +++ b/client/components/claim/education/Quiz.tsx @@ -1,8 +1,8 @@ import { FunctionComponent, useState, Dispatch, SetStateAction } from "react"; import classNames from "classnames"; import Button from "components/Button"; -import CheckIconWhite from "components/CheckIconWhite"; -import CrossIconWhite from "components/CrossIconWhite"; +import CheckIconWhite from "components/icons/CheckIconWhite"; +import CrossIconWhite from "components/icons/CrossIconWhite"; import { shuffle } from "lodash"; interface QuizQuestion { diff --git a/client/components/holding/Page.tsx b/client/components/holding/Page.tsx index 11654abb..c03e91f3 100644 --- a/client/components/holding/Page.tsx +++ b/client/components/holding/Page.tsx @@ -6,7 +6,7 @@ import CardGroup from "../CardGroup"; import Card from "../Card"; import CardDescription from "../CardDescription"; import CardStat from "../CardStat"; -import ExternalLinkIcon from "../ExternalLinkIcon"; +import ExternalLinkIcon from "../icons/ExternalLinkIcon"; import { useStore } from "utils/store"; const renderer: CountdownRendererFn = ({ days, hours, minutes, seconds }) => ( diff --git a/client/components/CheckIcon.tsx b/client/components/icons/CheckIcon.tsx similarity index 100% rename from client/components/CheckIcon.tsx rename to client/components/icons/CheckIcon.tsx diff --git a/client/components/CheckIconWhite.tsx b/client/components/icons/CheckIconWhite.tsx similarity index 100% rename from client/components/CheckIconWhite.tsx rename to client/components/icons/CheckIconWhite.tsx diff --git a/client/components/CrossIcon.tsx b/client/components/icons/CrossIcon.tsx similarity index 100% rename from client/components/CrossIcon.tsx rename to client/components/icons/CrossIcon.tsx diff --git a/client/components/CrossIconWhite.tsx b/client/components/icons/CrossIconWhite.tsx similarity index 100% rename from client/components/CrossIconWhite.tsx rename to client/components/icons/CrossIconWhite.tsx diff --git a/client/components/EtherscanIcon.tsx b/client/components/icons/EtherscanIcon.tsx similarity index 100% rename from client/components/EtherscanIcon.tsx rename to client/components/icons/EtherscanIcon.tsx diff --git a/client/components/ExternalLinkIcon.tsx b/client/components/icons/ExternalLinkIcon.tsx similarity index 100% rename from client/components/ExternalLinkIcon.tsx rename to client/components/icons/ExternalLinkIcon.tsx diff --git a/client/components/PlayIcon.tsx b/client/components/icons/PlayIcon.tsx similarity index 100% rename from client/components/PlayIcon.tsx rename to client/components/icons/PlayIcon.tsx diff --git a/client/components/layout.tsx b/client/components/layout.tsx index 8a4221ad..15dedcc6 100644 --- a/client/components/layout.tsx +++ b/client/components/layout.tsx @@ -1,7 +1,7 @@ import { FunctionComponent, ReactNode } from "react"; import Header from "components/Header"; import Footer from "components/Footer"; -import AdminUtils from "components/AdminUtils"; +import AdminUtils from "components/utils/AdminUtils"; interface LayoutProps { children: ReactNode; diff --git a/client/components/proposal/ProposalParameters.tsx b/client/components/proposal/ProposalParameters.tsx index 3f50a2cf..685be491 100644 --- a/client/components/proposal/ProposalParameters.tsx +++ b/client/components/proposal/ProposalParameters.tsx @@ -1,6 +1,6 @@ import { ethers } from "ethers"; import { useEffect, useState } from "react"; -import { Address } from "components/Address"; +import { Address } from "@/components/utils/Address"; import { StateTag } from "components/proposal/StateTag"; import { useStore } from "utils/store"; import { truncateBalance } from "utils/index"; diff --git a/client/components/proposal/ProposalTable.tsx b/client/components/proposal/ProposalTable.tsx index 34e0b29e..62b029ee 100644 --- a/client/components/proposal/ProposalTable.tsx +++ b/client/components/proposal/ProposalTable.tsx @@ -1,7 +1,7 @@ import { useRouter } from "next/router"; import { Loading } from "components/Loading"; import { StateTag } from "components/proposal/StateTag"; -import { Address } from "components/Address"; +import { Address } from "@/components/utils/Address"; import Link from "next/link"; export const ProposalTable = ({ proposalData }) => { diff --git a/client/components/Address.tsx b/client/components/utils/Address.tsx similarity index 100% rename from client/components/Address.tsx rename to client/components/utils/Address.tsx diff --git a/client/components/AdminUtils.js b/client/components/utils/AdminUtils.js similarity index 100% rename from client/components/AdminUtils.js rename to client/components/utils/AdminUtils.js diff --git a/client/components/TimeToDate.tsx b/client/components/utils/TimeToDate.tsx similarity index 93% rename from client/components/TimeToDate.tsx rename to client/components/utils/TimeToDate.tsx index da8c3481..e16e6ac9 100644 --- a/client/components/TimeToDate.tsx +++ b/client/components/utils/TimeToDate.tsx @@ -2,7 +2,7 @@ import { FunctionComponent, ReactNode } from "react"; import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; import { useStore } from "utils/store"; -import { SECONDS_IN_A_MONTH } from "../constants/index"; +import { SECONDS_IN_A_MONTH } from "../../constants/index"; dayjs.extend(relativeTime); diff --git a/client/components/TransactionListener.tsx b/client/components/utils/TransactionListener.tsx similarity index 100% rename from client/components/TransactionListener.tsx rename to client/components/utils/TransactionListener.tsx diff --git a/client/components/vote-escrow/AccountBalances.tsx b/client/components/vote-escrow/AccountBalances.tsx index 5189c6e7..5d4d41c9 100644 --- a/client/components/vote-escrow/AccountBalances.tsx +++ b/client/components/vote-escrow/AccountBalances.tsx @@ -21,6 +21,29 @@ const AccountBalances: FunctionComponent = () => { lockups.reduce((total: ethers.BigNumber, lockup) => { return total.add(lockup.amount); }, ethers.BigNumber.from("0")); + + const cardContentData = [ + { + + } + ] + + // const cardContent = () => { + // return ( + // + //
+ // TITLE + //
+ // + // + // + // + //
+ // DESCRIPTION + //
+ //
+ // ); + // } return ( <> diff --git a/client/components/vote-escrow/LockupTable.tsx b/client/components/vote-escrow/LockupTable.tsx index f21ff6bc..f01648b1 100644 --- a/client/components/vote-escrow/LockupTable.tsx +++ b/client/components/vote-escrow/LockupTable.tsx @@ -3,7 +3,7 @@ import moment from "moment"; import Card from "components/Card"; import TokenAmount from "components/TokenAmount"; import { Loading } from "components/Loading"; -import TimeToDate from "components/TimeToDate"; +import TimeToDate from "components/utils/TimeToDate"; interface LockupTableProps { lockup: Object; diff --git a/client/components/vote-escrow/LockupsTable.tsx b/client/components/vote-escrow/LockupsTable.tsx index 26b24de8..8f60655b 100644 --- a/client/components/vote-escrow/LockupsTable.tsx +++ b/client/components/vote-escrow/LockupsTable.tsx @@ -3,7 +3,7 @@ import moment from "moment"; import Card from "components/Card"; import TokenAmount from "components/TokenAmount"; import { Loading } from "components/Loading"; -import TimeToDate from "components/TimeToDate"; +import TimeToDate from "components/utils/TimeToDate"; import Link from "components/Link"; import Button from "components/Button"; import { useStore } from "utils/store"; @@ -13,8 +13,8 @@ import useLockups from "utils/useLockups"; import { toast } from "react-toastify"; import Modal from "components/Modal"; import { truncateEthAddress } from "utils"; -import EtherscanIcon from "components/EtherscanIcon"; -import ExternalLinkIcon from "../ExternalLinkIcon"; +import EtherscanIcon from "components/icons/EtherscanIcon"; +import ExternalLinkIcon from "../icons/ExternalLinkIcon"; const LockupsTable: FunctionComponent = () => { const { lockups, pendingTransactions, contracts, blockTimestamp, chainId } = diff --git a/client/pages/_app.tsx b/client/pages/_app.tsx index 5eb8b61d..4bece49b 100644 --- a/client/pages/_app.tsx +++ b/client/pages/_app.tsx @@ -3,7 +3,7 @@ import useTotalBalances from "utils/useTotalBalances"; import useContracts from "utils/useContracts"; import useLockups from "utils/useLockups"; import useBlock from "utils/useBlock"; -import { TransactionListener } from "components/TransactionListener"; +import { TransactionListener } from "components/utils/TransactionListener"; import "../styles/globals.css"; import Layout from "../components/layout"; import { claimOpenTimestampPassed } from "utils"; diff --git a/client/utils/useHistoricalLockupToasts.js b/client/utils/useHistoricalLockupToasts.js index 6620e795..8402aceb 100644 --- a/client/utils/useHistoricalLockupToasts.js +++ b/client/utils/useHistoricalLockupToasts.js @@ -7,7 +7,7 @@ import { truncateEthAddress } from "utils"; import { SECONDS_IN_A_MONTH } from "../constants/index"; import TokenAmount from "components/TokenAmount"; import Link from "components/Link"; -import ExternalLinkIcon from "components/ExternalLinkIcon"; +import ExternalLinkIcon from "components/icons/ExternalLinkIcon"; const _LockupContent = ({ shortAddress, ogvLockedUp, months, txHash }) => { return ( From 29c14b4ea4e77455bc0b50a3e44bfed62d3dec40 Mon Sep 17 00:00:00 2001 From: C Date: Wed, 17 Aug 2022 13:20:01 +0200 Subject: [PATCH 3/5] Fix the @ on components --- client/components/proposal/ProposalParameters.tsx | 2 +- client/components/proposal/ProposalTable.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/components/proposal/ProposalParameters.tsx b/client/components/proposal/ProposalParameters.tsx index 685be491..07901c32 100644 --- a/client/components/proposal/ProposalParameters.tsx +++ b/client/components/proposal/ProposalParameters.tsx @@ -1,6 +1,6 @@ import { ethers } from "ethers"; import { useEffect, useState } from "react"; -import { Address } from "@/components/utils/Address"; +import { Address } from "components/utils/Address"; import { StateTag } from "components/proposal/StateTag"; import { useStore } from "utils/store"; import { truncateBalance } from "utils/index"; diff --git a/client/components/proposal/ProposalTable.tsx b/client/components/proposal/ProposalTable.tsx index 62b029ee..4167024c 100644 --- a/client/components/proposal/ProposalTable.tsx +++ b/client/components/proposal/ProposalTable.tsx @@ -1,7 +1,7 @@ import { useRouter } from "next/router"; import { Loading } from "components/Loading"; import { StateTag } from "components/proposal/StateTag"; -import { Address } from "@/components/utils/Address"; +import { Address } from "components/utils/Address"; import Link from "next/link"; export const ProposalTable = ({ proposalData }) => { From 4b3bd791b09c0d6bee779ad4ece88e9dc65389cc Mon Sep 17 00:00:00 2001 From: C Date: Wed, 17 Aug 2022 13:35:35 +0200 Subject: [PATCH 4/5] Update AccountBalances.tsx Refactor and reduce to simple mapping. --- .../vote-escrow/AccountBalances.tsx | 108 ++++++------------ 1 file changed, 38 insertions(+), 70 deletions(-) diff --git a/client/components/vote-escrow/AccountBalances.tsx b/client/components/vote-escrow/AccountBalances.tsx index 5d4d41c9..f876e98f 100644 --- a/client/components/vote-escrow/AccountBalances.tsx +++ b/client/components/vote-escrow/AccountBalances.tsx @@ -21,81 +21,49 @@ const AccountBalances: FunctionComponent = () => { lockups.reduce((total: ethers.BigNumber, lockup) => { return total.add(lockup.amount); }, ethers.BigNumber.from("0")); - - const cardContentData = [ - { - - } - ] - // const cardContent = () => { - // return ( - // - //
- // TITLE - //
- // - // - // - // - //
- // DESCRIPTION - //
- //
- // ); - // } + const cardContentData = [ + { + label: "Balance", + amount: ogv, + description: "OGV", + }, + { + label: "Staked", + amount: totalOgvLockedUp, + description: "OGV", + }, + { + label: "Vote balance", + amount: veOgv, + description: "veOGV", + }, + { + label: "Accrued Rewards", + amount: accruedRewards, + description: "OGV", + }, + ]; return ( <> - -
- Balance -
- - - - -
- OGV -
-
- -
- Staked -
- - - - -
- OGV -
-
- -
- Vote balance -
- - - - -
- veOGV -
-
- -
- Accrued Rewards -
- - - - -
- OGV -
-
+ {cardContentData.map((data) => { + return ( + +
+ {data.label} +
+ + + + +
+ {data.description} +
+
+ ); + })}
); From c3a9d3adc8516aa6d758bc50e46bee173fe19542 Mon Sep 17 00:00:00 2001 From: C Date: Wed, 17 Aug 2022 13:39:17 +0200 Subject: [PATCH 5/5] Update AccountBalances.tsx Fix Icon src + altDescription --- client/components/vote-escrow/AccountBalances.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/components/vote-escrow/AccountBalances.tsx b/client/components/vote-escrow/AccountBalances.tsx index f876e98f..4c682351 100644 --- a/client/components/vote-escrow/AccountBalances.tsx +++ b/client/components/vote-escrow/AccountBalances.tsx @@ -27,21 +27,25 @@ const AccountBalances: FunctionComponent = () => { label: "Balance", amount: ogv, description: "OGV", + icon: "/ogv.svg", }, { label: "Staked", amount: totalOgvLockedUp, description: "OGV", + icon: "/ogv.svg", }, { label: "Vote balance", amount: veOgv, description: "veOGV", + icon: "/veogv.svg", }, { label: "Accrued Rewards", amount: accruedRewards, description: "OGV", + icon: "/ogv.svg", }, ]; @@ -54,7 +58,7 @@ const AccountBalances: FunctionComponent = () => {
{data.label}
- +