diff --git a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx index 0b3808897..5586736bf 100644 --- a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx +++ b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx @@ -65,7 +65,9 @@ export default function Page({ const proposalData = data?.cvproposal; const metadata = proposalData?.metadata; const proposalIdNumber = - !!proposalData ? BigInt(proposalData.proposalNumber) : undefined; + proposalData?.proposalNumber ? + BigInt(proposalData.proposalNumber) + : undefined; const { publish } = usePubSubContext(); const chainId = useChainIdFromPath(); @@ -158,48 +160,53 @@ export default function Page({

- {ipfsResult?.title} #{proposalIdNumber} + {ipfsResult?.title} #{proposalData?.proposalNumber}

-

- {prettyTimestamp(proposalData?.createdAt ?? 0)} +

+ Created:{" "} + + {prettyTimestamp(proposalData?.createdAt ?? 0)} +

{ipfsResult?.description}

-
- {!isSignalingType && ( - <> - } - > - - - }> - - - - )} - }> - - +
+
+ {!isSignalingType && ( + <> + } + > + + + }> + + + + )} + }> + + +
+
+ +
-
-
- -
-
{status && status !== "active" && status !== "disputed" ? @@ -211,7 +218,26 @@ export default function Page({ : `Proposal as been ${status}.`} : <> -

Metrics

+
+

Metrics

+ {status === "active" && !isSignalingType && ( + + )} +
} -
- {status === "active" && !isSignalingType && ( - - )} -
); diff --git a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/create-proposal/page.tsx b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/create-proposal/page.tsx index d70703561..0139d4d9f 100644 --- a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/create-proposal/page.tsx +++ b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/create-proposal/page.tsx @@ -47,12 +47,10 @@ export default function Page({ return (
-
-

- Create a Proposal in Pool #{poolId} -

-
-

{metadata.title}

+
+

Create a Proposal in Pool #{poolId}

+
+

{metadata.title}

-
-

- Create a Pool in {communityName} community -

+
+

Create a Pool in {communityName} community

-
-

+
+

Welcome to the {tokenGarden.symbol} Community Form!

-
-

+

+

Create a vibrant community around the {tokenGarden.name} by providing the necessary details below.

diff --git a/apps/web/components/Button.tsx b/apps/web/components/Button.tsx index 96ad71906..b0513687f 100644 --- a/apps/web/components/Button.tsx +++ b/apps/web/components/Button.tsx @@ -79,18 +79,22 @@ export function Button({ icon, type = "button", }: ButtonProps) { - const buttonContent = - isLoading ? : children; - const buttonElement = ( ); diff --git a/apps/web/components/ConnectWalletButton.tsx b/apps/web/components/ConnectWalletButton.tsx index 34c474b91..f75cd913b 100644 --- a/apps/web/components/ConnectWalletButton.tsx +++ b/apps/web/components/ConnectWalletButton.tsx @@ -151,12 +151,10 @@ export function ConnectWallet() {

Balance

-
@@ -199,17 +197,6 @@ export function ConnectWallet() { ); })()} - {urlChainId === chain?.id && tokenUrlAddress !== undefined && ( -
-

Balance

- -
- )} ); }} diff --git a/apps/web/components/DisputeButton.tsx b/apps/web/components/DisputeButton.tsx index 7d80e883f..aac422bda 100644 --- a/apps/web/components/DisputeButton.tsx +++ b/apps/web/components/DisputeButton.tsx @@ -155,13 +155,17 @@ export const DisputeButton: FC = ({ proposalData }) => { async function handleSubmit() { setIsLoading(true); - const reasonHash = await ipfsJsonUpload({ reason }, "disputeReason"); - if (!reasonHash) { - return; + try { + const reasonHash = await ipfsJsonUpload({ reason }, "disputeReason"); + if (!reasonHash) { + return; + } + await writeDisputeProposalAsync({ + args: [BigInt(proposalData.proposalNumber), reasonHash, "0x0"], + }); + } catch (error) { + setIsLoading(false); } - await writeDisputeProposalAsync({ - args: [BigInt(proposalData.proposalNumber), reasonHash, "0x0"], - }); setIsLoading(false); } @@ -315,7 +319,6 @@ export const DisputeButton: FC = ({ proposalData }) => { /> )}
-
- - setIsModalOpened(false)} - isOpen={isModalOpened} - > - {content} - {buttons} - - - ))} + {(ProposalStatus[proposalData?.proposalStatus] === "active" || + ProposalStatus[proposalData?.proposalStatus] === "disputed") && ( + <> + + setIsModalOpened(false)} + isOpen={isModalOpened} + > + {content} + {buttons} + + + )} ); }; diff --git a/apps/web/components/Forms/CommunityForm.tsx b/apps/web/components/Forms/CommunityForm.tsx index 7d5ce9127..49e591ed5 100644 --- a/apps/web/components/Forms/CommunityForm.tsx +++ b/apps/web/components/Forms/CommunityForm.tsx @@ -43,7 +43,7 @@ type FormRowTypes = { parse?: (value: any) => string; }; -const ethereumAddressRegEx = /^(0x)?[0-9a-fA-F]{40}$/; +const ethereumAddressRegEx = /^0x[a-fA-F0-9]{40}$/; export const CommunityForm = ({ chainId, diff --git a/apps/web/components/Forms/FormInput.tsx b/apps/web/components/Forms/FormInput.tsx index a2c0767d1..14051fe49 100644 --- a/apps/web/components/Forms/FormInput.tsx +++ b/apps/web/components/Forms/FormInput.tsx @@ -91,7 +91,7 @@ export function FormInput({ {children}
{errors && ( -

+

{errors[registerKey]?.message || ""}

)} diff --git a/apps/web/components/Forms/FormPreview.tsx b/apps/web/components/Forms/FormPreview.tsx index 3ee58c435..4a82a8708 100644 --- a/apps/web/components/Forms/FormPreview.tsx +++ b/apps/web/components/Forms/FormPreview.tsx @@ -19,32 +19,15 @@ export function FormPreview({ return <>Error no Data; } - // description or covenant - { - /*

-Covenant -

-

-{covenant} -

*/ - } - return ( <> - {/*
*/} -
-

- {previewTitle} -

+
+

{previewTitle}

{title && description && ( -
-

- {title} -

-

- {description} -

+
+

{title}

+

{description}

)} diff --git a/apps/web/components/Modal.tsx b/apps/web/components/Modal.tsx index fb3eb8d46..cea078a9c 100644 --- a/apps/web/components/Modal.tsx +++ b/apps/web/components/Modal.tsx @@ -22,15 +22,29 @@ export function Modal({ const dialogRef = useRef(null); useEffect(() => { + const dialogElement = dialogRef.current; + if (isOpen) { - dialogRef.current?.showModal(); + dialogElement?.showModal(); } else { - dialogRef.current?.close(); + dialogElement?.close(); } - }, [isOpen]); + + const handleDialogClose = () => { + if (!dialogElement?.open) { + onClose(); + } + }; + + dialogElement?.addEventListener("close", handleDialogClose); + + return () => { + dialogElement?.removeEventListener("close", handleDialogClose); + }; + }, [isOpen, onClose]); const handleClose = () => { - onClose?.(); + onClose(); dialogRef.current?.close(); }; diff --git a/apps/web/components/PoolHeader.tsx b/apps/web/components/PoolHeader.tsx index f9e3aa883..86095c1f9 100644 --- a/apps/web/components/PoolHeader.tsx +++ b/apps/web/components/PoolHeader.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState } from "react"; import { BoltIcon, ChartBarIcon, @@ -154,7 +154,7 @@ export default function PoolHeader({ abi: abiWithErrors(registryCommunityABI), contractName: "Registry Community", functionName: "addStrategyByPoolId", - fallbackErrorMessage: "Error creating a pool. Please ty again.", + fallbackErrorMessage: "Error approving pool. Please try again.", args: [BigInt(poolId)], onConfirmations: () => { publish({ @@ -171,7 +171,7 @@ export default function PoolHeader({ abi: abiWithErrors(registryCommunityABI), contractName: "Registry Community", functionName: "removeStrategyByPoolId", - fallbackErrorMessage: "Error creating a pool. Please ty again.", + fallbackErrorMessage: "Error disabling pool. Please try again.", args: [BigInt(poolId)], onConfirmations: () => { publish({ diff --git a/apps/web/components/ProposalCard.tsx b/apps/web/components/ProposalCard.tsx index f48f1f935..a350fbc08 100644 --- a/apps/web/components/ProposalCard.tsx +++ b/apps/web/components/ProposalCard.tsx @@ -111,8 +111,9 @@ export function ProposalCard({ } />
- {[...Array(21)].map((_) => ( - + {[...Array(21)].map((_, i) => ( + // eslint-disable-next-line react/no-array-index-key + | ))} diff --git a/apps/web/components/Proposals.tsx b/apps/web/components/Proposals.tsx index 8d70cb57c..2c83f9e5a 100644 --- a/apps/web/components/Proposals.tsx +++ b/apps/web/components/Proposals.tsx @@ -5,6 +5,7 @@ import { AdjustmentsHorizontalIcon, PlusIcon, } from "@heroicons/react/24/outline"; +import { filter } from "lodash-es"; import Link from "next/link"; import { Address as AddressType, useAccount } from "wagmi"; import { @@ -30,7 +31,7 @@ import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithC import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { useSubgraphQuery } from "@/hooks/useSubgraphQuery"; import { alloABI, cvStrategyABI } from "@/src/generated"; -import { LightCVStrategy } from "@/types"; +import { LightCVStrategy, ProposalStatus } from "@/types"; import { abiWithErrors } from "@/utils/abiWithErrors"; import { encodeFunctionParams } from "@/utils/encodeFunctionParams"; import { useErrorDetails } from "@/utils/getErrorName"; @@ -98,11 +99,18 @@ export function Proposals({ me: wallet?.toLowerCase(), comm: strategy.registryCommunity.id.toLowerCase(), }, - changeScope: { - topic: "member", - id: wallet, - type: ["add", "delete"], - }, + changeScope: [ + { + topic: "member", + id: wallet, + type: ["add", "delete"], + }, + { + topic: "proposal", + containerId: strategy.id, + function: "allocate", + }, + ], enabled: !!wallet, }); @@ -197,7 +205,11 @@ export function Proposals({ getProposals(wallet, strategy) .then((res) => { if (res !== undefined) { - setProposals(res); + const filteredProposals = res.filter( + ({ status }) => ProposalStatus[status] !== "rejected", + ); + console.log(filteredProposals); + setProposals(filteredProposals); } else { console.debug("No proposals"); } @@ -289,9 +301,8 @@ export function Proposals({ publish({ topic: "proposal", type: "update", - id: alloInfo.id, + containerId: strategy.id, function: "allocate", - urlChainId, }); }, }); @@ -471,7 +482,10 @@ function UserAllocationStats({ stats }: { stats: Stats[] }) {

Your Allocation Overview

{stats.map((stat) => ( -
+
{ return ( -
- {icon &&
{icon}
} - {(label ?? count) && ( -

- {label}: {count} -

- )} +
+
+ {icon &&
{icon}
} + {label && ( +

+ {label}: {count} +

+ )} +
{children}
); diff --git a/apps/web/components/WalletBalance.tsx b/apps/web/components/WalletBalance.tsx index b641ff96e..7a3c06c4d 100644 --- a/apps/web/components/WalletBalance.tsx +++ b/apps/web/components/WalletBalance.tsx @@ -76,10 +76,10 @@ export const WalletBalance: FC = ({

Your balance:

[0]; let toastOptions: Partial; - const clickToExplorer = () => - window.open( - `${chainDataMap[chain?.id ?? 0].explorer}/tx/${transactionData?.hash}`, - "_blank", - ); + const clickToExplorer = () => { + if (transactionData?.hash) { + window.open( + `${chainDataMap[chain?.id ?? 0].explorer}/tx/${transactionData?.hash}`, + "_blank", + ); + } else { + return; + } + }; switch (transactionStatus) { case "waiting": @@ -173,6 +178,8 @@ export const TransactionStatusNotification = ({ break; } + // if error on wagmi or no tx hash then not clickable + return (
{icon && (