Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/refactor frontend components #322

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`._

Expand Down
2 changes: 1 addition & 1 deletion client/components/LeaderboardTable.tsx
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion client/components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion client/components/claim/EligibilityItem.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
4 changes: 2 additions & 2 deletions client/components/claim/education/Quiz.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/components/holding/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion client/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion client/components/proposal/ProposalParameters.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion client/components/proposal/ProposalTable.tsx
Original file line number Diff line number Diff line change
@@ -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 }) => {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
91 changes: 43 additions & 48 deletions client/components/vote-escrow/AccountBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,57 +22,52 @@ const AccountBalances: FunctionComponent<AccountBalancesProps> = () => {
return total.add(lockup.amount);
}, ethers.BigNumber.from("0"));

const cardContentData = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart!

{
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",
},
];

return (
<>
<CardGroup horizontal fourCol>
<Card dark tightPadding>
<div className="space-y-1">
<CardLabel>Balance</CardLabel>
<div className="flex space-x-1 items-center">
<TokenIcon src="/ogv.svg" alt="OGV" small />
<CardStat small>
<TokenAmount amount={ogv} />
</CardStat>
</div>
<CardDescription>OGV</CardDescription>
</div>
</Card>
<Card dark tightPadding>
<div className="space-y-1">
<CardLabel>Staked</CardLabel>
<div className="flex space-x-1 items-center">
<TokenIcon src="/ogv.svg" alt="OGV" small />
<CardStat small>
<TokenAmount amount={totalOgvLockedUp} />
</CardStat>
</div>
<CardDescription>OGV</CardDescription>
</div>
</Card>
<Card dark tightPadding>
<div className="space-y-1">
<CardLabel>Vote balance</CardLabel>
<div className="flex space-x-1 items-center">
<TokenIcon src="/veogv.svg" alt="veOGV" small />
<CardStat small>
<TokenAmount amount={veOgv} />
</CardStat>
</div>
<CardDescription>veOGV</CardDescription>
</div>
</Card>
<Card dark tightPadding>
<div className="space-y-1">
<CardLabel>Accrued Rewards</CardLabel>
<div className="flex space-x-1 items-center">
<TokenIcon src="/ogv.svg" alt="OGV" small />
<CardStat small>
<TokenAmount amount={accruedRewards} />
</CardStat>
</div>
<CardDescription>OGV</CardDescription>
</div>
</Card>
{cardContentData.map((data) => {
return (
<Card dark tightPadding key={data.label}>
<div className="space-y-1">
<CardLabel>{data.label}</CardLabel>
<div className="flex space-x-1 items-center">
<TokenIcon src={data.icon} alt={data.description} small />
<CardStat small>
<TokenAmount amount={data.amount} />
</CardStat>
</div>
<CardDescription>{data.description}</CardDescription>
</div>
</Card>
);
})}
</CardGroup>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion client/components/vote-escrow/LockupTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions client/components/vote-escrow/LockupsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 } =
Expand Down
2 changes: 1 addition & 1 deletion client/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion client/utils/useHistoricalLockupToasts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down