Skip to content

Commit

Permalink
♻️ Removed unused imports and debug logs
Browse files Browse the repository at this point in the history
- Removed unused import `abiWithErrors` from multiple files
- Changed default value of `showToolTip` in Button.tsx to false
- Commented out line fetching element with id "dialog" in EthAddress.tsx
- Adjusted TooltipIfOverflow usage in GardenCard.tsx for better readability
- Simplified calculation of allocatedInProposal in ProposalCard.tsx
- Added console.debug for proposal differences array in Proposals.tsx
- Enhanced error logging in useContractWriteWithConfirmations hook by including error message
- Added Sentry.extraErrorDataIntegration configuration to sentry.client.config.ts
  • Loading branch information
Corantin committed Oct 20, 2024
1 parent e1da13d commit 15f3145
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { useMetadataIpfsFetch } from "@/hooks/useIpfsFetch";
import { useSubgraphQuery } from "@/hooks/useSubgraphQuery";
import { alloABI } from "@/src/generated";
import { PoolTypes, ProposalStatus } from "@/types";
import { abiWithErrors } from "@/utils/abi";

import { useErrorDetails } from "@/utils/getErrorName";
import { prettyTimestamp } from "@/utils/text";

Expand Down
1 change: 0 additions & 1 deletion apps/web/components/ActivatePoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import useCheckAllowList from "@/hooks/useCheckAllowList";
import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations";
import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons";
import { cvStrategyABI } from "@/src/generated";
import { abiWithErrors } from "@/utils/abi";
import { useErrorDetails } from "@/utils/getErrorName";

type ActiveMemberProps = {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function Button({
className: styles = "",
disabled = false,
tooltip,
showToolTip = true,
showToolTip = false,
tooltipClassName: tooltipStyles = "",
tooltipSide = "tooltip-top",
children,
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/CancelButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useChainIdFromPath } from "@/hooks/useChainIdFromPath";
import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations";
import { MetadataV1 } from "@/hooks/useIpfsFetch";
import { cvStrategyABI } from "@/src/generated";
import { abiWithErrors } from "@/utils/abi";

type Props = {
proposalData: Maybe<
Expand Down
4 changes: 1 addition & 3 deletions apps/web/components/DisputeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ import {
safeArbitratorABI,
} from "@/src/generated";
import { DisputeStatus, ProposalStatus } from "@/types";
import { abiWithErrors } from "@/utils/abi";
import { delayAsync } from "@/utils/delayAsync";
import { ipfsJsonUpload } from "@/utils/ipfsUtils";
import { convertSecondsToReadableTime } from "@/utils/numbers";
import { shortenAddress } from "@/utils/text";

type Props = {
proposalData: Maybe<
Expand Down Expand Up @@ -313,7 +311,7 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
const disableTribunalSafeBtnCondition: ConditionObject[] = [
{
condition: !isTribunalSafe,
message: `Connect with Tribunal safe`,
message: "Connect with Tribunal safe",
},
];

Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/EthAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const EthAddress = ({
}: EthAddressProps) => {
const divParentRef = React.useRef<HTMLDivElement>(null);
const chain = useChainFromPath();
const topLayerNode = document.getElementById("dialog");
// const topLayerNode = document.getElementById("dialog");
// const theme: ThemeDeclaration = {
// textColor: "black",
// // secondaryColor: "black",
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/Forms/AllowListInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ export function AllowListInput({
className={`!p-2 font-normal text-[14px] leading-4
${!isUnlimited ? "" : "!text-black !border-black"}`}
onClick={handleAllowEveryone}
showToolTip
disabled={!isUnlimited}
icon={<UserGroupIcon className="w-4 h-4" />}
tooltip={
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/Forms/CommunityForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { useChainFromPath } from "@/hooks/useChainFromPath";
import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations";
import { useDisableButtons } from "@/hooks/useDisableButtons";
import { registryFactoryABI, safeABI } from "@/src/generated";
import { abiWithErrors } from "@/utils/abi";
import { getEventFromReceipt } from "@/utils/contracts";
import { ipfsJsonUpload } from "@/utils/ipfsUtils";
import {
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/Forms/ProposalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithC
import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons";
import { alloABI } from "@/src/generated";
import { PoolTypes } from "@/types";
import { abiWithErrors } from "@/utils/abi";
import { getEventFromReceipt } from "@/utils/contracts";
import { ipfsJsonUpload } from "@/utils/ipfsUtils";
import { formatTokenAmount } from "@/utils/numbers";
Expand Down
6 changes: 4 additions & 2 deletions apps/web/components/GardenCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import Image from "next/image";
import { Address } from "viem";
import { getTokenGardensQuery } from "#/subgraph/.graphclient";
import { Statistic, TokenLabel } from ".";
import TooltipIfOverflow from "./TooltipIfOverflow";
import { gardenLand } from "@/assets";
import { Card } from "@/components/Card";
import { ChainIcon, getConfigByChain } from "@/configs/chains";
import TooltipIfOverflow from "./TooltipIfOverflow";

type TokenGarden = getTokenGardensQuery["tokenGardens"][number];

Expand Down Expand Up @@ -45,7 +45,9 @@ export function GardenCard({ garden }: { garden: TokenGarden }) {
<div className="flex items-center justify-between gap-2">
{/* TODO: find appropiate token image */}
<h3 className="text-neutral-content h-14">
<TooltipIfOverflow lineClamp="line-clamp-2">{name}</TooltipIfOverflow>
<TooltipIfOverflow lineClamp="line-clamp-2">
{name}
</TooltipIfOverflow>
</h3>
<TokenLabel chainId={chainId} noSymbol />
</div>
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/IncreasePower.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithC
import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons";
import { useHandleAllowance } from "@/hooks/useHandleAllowance";
import { registryCommunityABI } from "@/src/generated";
import { abiWithErrors } from "@/utils/abi";
import { parseToken } from "@/utils/numbers";
import { getTxMessage } from "@/utils/transactionMessages";

Expand Down
3 changes: 1 addition & 2 deletions apps/web/components/PoolHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
ProposalStatus,
SybilResistanceType,
} from "@/types";
import { abiWithErrors } from "@/utils/abi";
import {
convertSecondsToReadableTime,
CV_PASSPORT_THRESHOLD_SCALE,
Expand Down Expand Up @@ -286,7 +285,7 @@ export default function PoolHeader({
const disableCouncilSafeBtnCondition: ConditionObject[] = [
{
condition: !isCouncilSafe,
message: `Connect with Council safe`,
message: "Connect with Council safe",
},
];

Expand Down
1 change: 0 additions & 1 deletion apps/web/components/PoolMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithC
import { useDisableButtons } from "@/hooks/useDisableButtons";
import { useHandleAllowance } from "@/hooks/useHandleAllowance";
import { alloABI } from "@/src/generated";
import { abiWithErrors } from "@/utils/abi";
import { getTxMessage } from "@/utils/transactionMessages";

interface PoolMetricsProps {
Expand Down
7 changes: 1 addition & 6 deletions apps/web/components/ProposalCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ export function ProposalCard({
const inputValue =
inputData ? calculatePercentage(inputData.value, memberActivatedPoints) : 0;

const allocatedInProposal = calculatePercentage(
stakedFilter?.value,
memberActivatedPoints,
);

const poolWeightAllocatedInProposal = (
(inputValue * memberPoolWeight) /
100
Expand Down Expand Up @@ -261,7 +256,7 @@ export function ProposalCard({
</span>
/{memberPoolWeight}%{" "}
<span className="text-neutral-soft-content text-sm">
({allocatedInProposal}% of your total support)
({inputValue}% of your total support)
</span>
</p>
{/* <p className="text-primary-content">Support</p> */}
Expand Down
6 changes: 2 additions & 4 deletions apps/web/components/Proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from "@heroicons/react/24/outline";
import { FetchTokenResult } from "@wagmi/core";
import Link from "next/link";
import { Id, toast } from "react-toastify";
import { parseAbiParameters, encodeAbiParameters } from "viem";
import { Address, useAccount, useContractRead } from "wagmi";
import {
Expand Down Expand Up @@ -38,10 +39,8 @@ import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons";
import { useSubgraphQuery } from "@/hooks/useSubgraphQuery";
import { alloABI, cvStrategyABI, registryCommunityABI } from "@/src/generated";
import { ProposalStatus } from "@/types";
import { abiWithErrors } from "@/utils/abi";
import { useErrorDetails } from "@/utils/getErrorName";
import { calculatePercentage } from "@/utils/numbers";
import { Id, toast } from "react-toastify";

// Types
export type ProposalInputItem = {
Expand Down Expand Up @@ -128,7 +127,6 @@ export function Proposals({
topic: "member",
id: wallet,
containerId: strategy.poolId,
type: ["add", "delete"],
},
{
topic: "proposal",
Expand Down Expand Up @@ -403,7 +401,7 @@ export function Proposals({
inputs,
stakedFilters,
);

console.debug("Proposal Deltas", proposalsDifferencesArr);
const abiTypes = parseAbiParameters(
"(uint256 proposalId, int256 deltaSupport)[]",
);
Expand Down
1 change: 0 additions & 1 deletion apps/web/components/RegisterMember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons";
import { useHandleAllowance } from "@/hooks/useHandleAllowance";
import { useHandleRegistration } from "@/hooks/useHandleRegistration";
import { registryCommunityABI } from "@/src/generated";
import { abiWithErrors } from "@/utils/abi";
import { useErrorDetails } from "@/utils/getErrorName";
import { gte } from "@/utils/numbers";

Expand Down
2 changes: 1 addition & 1 deletion apps/web/hooks/useContractWriteWithConfirmations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function useContractWriteWithConfirmations<

console.error(
`Error with transaction [${props.contractName} -> ${props.functionName}]`,
{ error, variables, context, rawData, contract: props.address },
{ error, variables, context, rawData, contract: props.address, message: error.message },
);
}

Expand Down
1 change: 0 additions & 1 deletion apps/web/hooks/useHandleAllowance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useChainIdFromPath } from "./useChainIdFromPath";
import { useContractWriteWithConfirmations } from "./useContractWriteWithConfirmations";
import { TransactionProps } from "@/components/TransactionModal";
import { erc20ABI } from "@/src/generated";
import { abiWithErrors } from "@/utils/abi";
import { getTxMessage } from "@/utils/transactionMessages";

export function useHandleAllowance(
Expand Down
1 change: 0 additions & 1 deletion apps/web/hooks/useHandleRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { TransactionProps } from "@/components/TransactionModal";
import { usePubSubContext } from "@/contexts/pubsub.context";
import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations";
import { registryCommunityABI } from "@/src/generated";
import { abiWithErrors } from "@/utils/abi";
import { getTxMessage } from "@/utils/transactionMessages";

export function useHandleRegistration(
Expand Down
4 changes: 4 additions & 0 deletions apps/web/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@ Sentry.init({
colorScheme: "light",
showBranding: false,
}),
Sentry.extraErrorDataIntegration({
depth: 3,
captureErrorCause: true,
}),
],
});

0 comments on commit 15f3145

Please sign in to comment.