Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SouravInsights committed Dec 8, 2024
1 parent 7e7bc38 commit 6a5478c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
21 changes: 9 additions & 12 deletions app/components/forms/FormView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { Form, FormElementType, FormElementValue } from "@/types/form";
import { useState, useEffect, useMemo } from "react";
import { useState, useEffect } from "react";
import { useToast } from "@/hooks/use-toast";
import { useTokenGate } from "@/app/hooks/use-token-gate";
import { useFormRewards } from "@/app/hooks/use-form-rewards";
Expand All @@ -17,12 +17,9 @@ interface FormViewProps {
className?: string;
}

interface TokenMetadata {
symbol: string;
decimals: number;
}

export function FormView({ form, isPreview, className }: FormViewProps) {
const minTokenBalance = form.settings.web3.tokenGating.minTokenBalance;
console.log("minTokenBalance:", minTokenBalance);
const [currentElementIndex, setCurrentElementIndex] = useState(0);
const [responses, setResponses] = useState<Record<string, FormElementValue>>(
{}
Expand All @@ -33,12 +30,12 @@ export function FormView({ form, isPreview, className }: FormViewProps) {
const [isMobile, setIsMobile] = useState(false);
const { toast } = useToast();
const { connect } = useConnect();
const { hasAccess, isConnected, address, isLoading, balance } = useTokenGate(
const { hasAccess, isConnected, address } = useTokenGate(
form.settings.web3?.tokenGating
);
const [submissionId, setSubmissionId] = useState<number | null>(null);

const { claimReward, isClaimingReward, canClaim, isReady } = useFormRewards({
const { claimReward, isReady } = useFormRewards({
rewards: form.settings.web3?.rewards || { enabled: false, chainId: 1 },
formId: form.id,
responseId: submissionId || 0,
Expand Down Expand Up @@ -286,7 +283,7 @@ export function FormView({ form, isPreview, className }: FormViewProps) {
return formContent;
}

// Helper function to get explorer link
const getExplorerLink = (txHash: string) => {
return `https://sepolia.basescan.org/tx/${txHash}`;
};
// // Helper function to get explorer link
// const getExplorerLink = (txHash: string) => {
// return `https://sepolia.basescan.org/tx/${txHash}`;
// };
2 changes: 1 addition & 1 deletion app/components/forms/RewardClaim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function RewardClaim({ rewards, formId, responseId }: RewardClaimProps) {
title: "Success!",
description: "Your reward has been claimed.",
});
} catch (error) {
} catch {
toast({
title: "Error",
description: "Failed to claim reward. Please try again.",
Expand Down
7 changes: 0 additions & 7 deletions app/components/forms/Web3Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ import { Switch } from "@/components/ui/switch";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";
import { FormSettings } from "@/types/form";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";
import { useAccount, useConnect } from "wagmi";
Expand Down
1 change: 0 additions & 1 deletion app/hooks/use-token-gate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ interface UseTokenGateResult {
isLoading: boolean;
isConnected: boolean;
address?: `0x${string}`;
balance?: bigint;
}

export function useTokenGate(
Expand Down

0 comments on commit 6a5478c

Please sign in to comment.