-
-
-
- (
-
- )}
- />
-
+
+
+
+
+ (
+
+ )}
+ />
+
+
+
+
+
+ (
+
+ )}
+ />
+
+
{watchToken !== 'Other' && (
-
{
- // only Validate if this is active
- if (!isKnownToken) return true;
+ <>
+
+
+
{
+ // only Validate if this is active
+ if (!isKnownToken) return true;
- // Required
- if (v === undefined || v === '')
- return 'Please enter an amount';
+ // Required
+ if (v === undefined || v === '')
+ return 'Please enter an amount';
- // Number Pattern
- if (!NumberPattern.test(v))
- return 'Please enter a number, e.g. 3.141';
+ // Number Pattern
+ if (!NumberPattern.test(v))
+ return 'Please enter a number, e.g. 3.141';
- // Otherwise this is valid
- return true;
- },
- })}
- id="amount"
- tooltip={`Amount of ${watchToken} to deposit`}
- label="Amount"
- error={errors.amount}
- disabled={!isKnownToken || isSendingTransaction}
- />
+ // Otherwise this is valid
+ return true;
+ },
+ })}
+ id="amount"
+ className="border-none text-2xl [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [appearance:textfield] focus:ring-0 focus:ring-offset-0"
+ placeholder={'0.0'}
+ error={errors.amount}
+ disabled={!isKnownToken || isSendingTransaction}
+ />
+ {balance !== undefined && (
+
+
+ {balance.symbol}
+
+
{
+ setValue(
+ 'amount',
+ formatUnits(balance.value, balance.decimals)
+ );
+ }}
+ />
+
+ )}
+
+ >
)}
{watchToken === 'Other' ? (
@@ -316,9 +369,27 @@ export const DepositAssets = () => {
) : (
+ {!isApproved && (
+
);
};
-
-function useDebounce(value: T, delay?: number): T {
- const [debouncedValue, setDebouncedValue] = useState(value);
-
- useEffect(() => {
- const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
-
- return () => {
- clearTimeout(timer);
- };
- }, [value, delay]);
-
- return debouncedValue;
-}
diff --git a/src/components/icons/Rep.tsx b/src/components/icons/Rep.tsx
index c22fa96e..6fc9a933 100644
--- a/src/components/icons/Rep.tsx
+++ b/src/components/icons/Rep.tsx
@@ -19,9 +19,28 @@ const Rep = ({ className, ...props }: React.BaseHTMLAttributes) => {
>
-
- R
-
+
);
diff --git a/src/components/layout/UserBalances.tsx b/src/components/layout/UserBalances.tsx
index 1108fd80..5563c028 100644
--- a/src/components/layout/UserBalances.tsx
+++ b/src/components/layout/UserBalances.tsx
@@ -25,9 +25,11 @@ const UserBalances = () => {
const { address, isConnected } = useAccount();
const { votingPower, loading: repLoading } = useVotingPower({
address,
+ watch: true,
});
const { secoinBalance, loading: secoinLoading } = useSecoinBalance({
address,
+ watch: true,
});
const showBalances =
diff --git a/src/components/newProposal/actions/ChangeParamInput.tsx b/src/components/newProposal/actions/ChangeParamInput.tsx
index 11eacff2..3db03a49 100644
--- a/src/components/newProposal/actions/ChangeParamInput.tsx
+++ b/src/components/newProposal/actions/ChangeParamInput.tsx
@@ -28,6 +28,11 @@ import {
SelectTrigger,
SelectValue,
} from '@/src/components/ui/Select';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/src/components/ui/Tooltip';
import { useDaoVariable } from '@/src/hooks/useDaoVariable';
import { useDaoVariables } from '@/src/hooks/useDaoVariables';
import {
@@ -43,8 +48,6 @@ import { indexObject, isNullOrUndefined } from '@/src/lib/utils';
import { Controller, useFormContext, useWatch } from 'react-hook-form';
import { HiCog, HiQuestionMarkCircle, HiXMark } from 'react-icons/hi2';
-import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/Tooltip';
-
export interface ProposalFormChangeParamData {
name: 'change_param';
plugin: string;
@@ -259,6 +262,7 @@ export const ChangeParamInput = () => {
);
diff --git a/src/pages/Finance.tsx b/src/pages/Finance.tsx
index 978407ca..b75b5374 100644
--- a/src/pages/Finance.tsx
+++ b/src/pages/Finance.tsx
@@ -6,7 +6,8 @@
* LICENSE file in the root directory of this source tree.
*/
-import { useState } from 'react';
+import { ReactNode, useState } from 'react';
+import Loading from '@/src/components/icons/Loading';
import { Address } from '@/src/components/ui/Address';
import { Button } from '@/src/components/ui/Button';
import { Card } from '@/src/components/ui/Card';
@@ -23,10 +24,14 @@ import { DefaultMainCardHeader, MainCard } from '@/src/components/ui/MainCard';
import { Skeleton } from '@/src/components/ui/Skeleton';
import TokenAmount from '@/src/components/ui/TokenAmount';
import { DaoBalance, useDaoBalance } from '@/src/hooks/useDaoBalance';
-import { DaoTransfer, useDaoTransfers } from '@/src/hooks/useDaoTransfers';
+import {
+ DaoTransfer,
+ TransferType,
+ useDaoTransfers,
+} from '@/src/hooks/useDaoTransfers';
import { ACTIONS } from '@/src/lib/constants/actions';
-import { TransferType } from '@aragon/sdk-client';
import { format } from 'date-fns';
+import { constants } from 'ethers';
import {
HiArrowSmallRight,
HiArrowsRightLeft,
@@ -34,6 +39,19 @@ import {
HiInboxArrowDown,
} from 'react-icons/hi2';
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from '../components/ui/Accordion';
+import CategoryList, { Category } from '../components/ui/CategoryList';
+import Header from '../components/ui/Header';
+import { useDiamondSDKContext } from '../context/DiamondGovernanceSDK';
+import { usePoolBalance } from '../hooks/useFacetFetch';
+import { TOKENS } from '../lib/constants/tokens';
+import { filterNullOrUndefined } from '../lib/utils';
+
/**
* Convert a TransferType to a sign (+ or -)
* @param tt TransferType, as defined in @aragon/sdk-client
@@ -45,10 +63,14 @@ import {
export const transfertypeToSign = (tt: TransferType) =>
tt === TransferType.WITHDRAW ? '-' : '+';
+interface RichDaoBalance extends DaoBalance {
+ content?: ReactNode;
+}
+
type DaoTokenListProps = {
loading: boolean;
error: string | null;
- daoBalances: DaoBalance[] | null;
+ daoBalances: RichDaoBalance[] | null;
limit: number;
};
@@ -86,37 +108,52 @@ const DaoTokensList = ({
);
- const balances = daoBalances
- .slice() //Copies array
- .sort((a, b) => (a.updateDate < b.updateDate ? 1 : -1))
- .slice(0, limit);
+ const balances = daoBalances.slice(0, limit);
+
+ const BalanceInfo = ({ balance }: { balance: RichDaoBalance }) => (
+ <>
+
+ {balance.token?.name ? balance.token.name : 'Unkown Token'}
+
+
+ >
+ );
return (
- {balances.map((balance: DaoBalance, i) => (
-
-
- {balance.name != '' && balance.name ? balance.name : 'Unkown Token'}
-
-
-
- ))}
+ {balances.map((balance: RichDaoBalance, i) =>
+ balance.content !== undefined ? (
+
+
+
+
+
+
+ {balance.content}
+
+
+
+ ) : (
+
+
+
+ )
+ )}
);
};
@@ -132,7 +169,6 @@ export const DaoTransfersList = ({
loading,
error,
daoTransfers,
- limit = daoTransfers?.length ?? 3,
}: DaoTransfersListProps): JSX.Element => {
if (loading)
return (
@@ -157,25 +193,31 @@ export const DaoTransfersList = ({
);
- const transfers = daoTransfers.slice(0, limit);
-
return (
- {transfers.map((transfer: DaoTransfer) => (
-
+ {daoTransfers.map((transfer: DaoTransfer) => (
+
-
{transfer.type}
-
{format(transfer.creationDate, 'Pp')}
+
+ {transfer.type}
+
+ {transfer.creationDate && (
+
{format(transfer.creationDate, 'Pp')}
+ )}
-
+ {transfer.token ? (
+
+ ) : (
+
?
+ )}
{
return transfer.from;
}
if (transfer.type === TransferType.WITHDRAW) {
- return transfer.to;
+ return transfer.to ?? '-';
}
throw new Error('Unreachable exception');
};
const Finance = () => {
const {
- daoBalances,
+ daoBalances: daoBalancesRaw,
loading: tokensLoading,
error: tokensError,
} = useDaoBalance();
- const [tokenLimit, setTokenLimit] = useState(3);
+ const [tokenLimit, setTokenLimit] = useState(5);
+ const [transferLimit, setTransferLimit] = useState(5);
const {
daoTransfers,
loading: transfersLoading,
+ refetching: transfersRefetching,
error: trasnfersError,
- } = useDaoTransfers();
- const [transferLimit, setTransferLimit] = useState(3);
+ } = useDaoTransfers({
+ limit: transferLimit,
+ });
+
+ const { secoinAddress } = useDiamondSDKContext();
+
+ const { data: secoinPools } = usePoolBalance();
+ const daoBalances = enrichDaoBalances(daoBalancesRaw, {
+ secoinPoolData: secoinPools,
+ secoinAddress,
+ });
return (
@@ -282,16 +335,7 @@ const Finance = () => {
)}
-
- }
- loading={transfersLoading}
- icon={HiArrowsRightLeft}
- >
+
{
loading={transfersLoading}
error={trasnfersError}
/>
- {daoTransfers && transferLimit < daoTransfers.length && (
+ {((daoTransfers && transferLimit <= daoTransfers.length) ||
+ transfersRefetching) && (
@@ -402,10 +406,10 @@ const Swap = () => {
{
};
export default Swap;
-const MaxButton = ({
- max,
- setMaxValue,
-}: {
- max: BigNumber;
- setMaxValue: () => void;
-}) => {
- return (
-
-
-
-
- );
-};
-
export const SwapSettings = ({
register,
setValue,
diff --git a/src/pages/Verification.tsx b/src/pages/Verification.tsx
index ebb0d38c..a2ddcc7a 100644
--- a/src/pages/Verification.tsx
+++ b/src/pages/Verification.tsx
@@ -24,6 +24,7 @@ import OneTimeRewardCard from '@/src/components/verification/OneTimeRewardCard';
import PendingVerificationCard from '@/src/components/verification/PendingVerificationCard';
import RecentVerificationCard from '@/src/components/verification/RecentVerificationCard';
import StampCard from '@/src/components/verification/StampCard';
+import { useLocalStorage } from '@/src/hooks/useLocalStorage';
import { toast } from '@/src/hooks/useToast';
import {
PendingVerification,
@@ -41,8 +42,6 @@ import {
import { useSearchParams } from 'react-router-dom';
import { useAccount, useSignMessage } from 'wagmi';
-import { useLocalStorage } from '../hooks/useLocalStorage';
-
export const availableStamps: StampInfo[] = [
{
id: 'proofofhumanity',