Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
alissacrane-cb committed Nov 7, 2024
1 parent bb916f2 commit 4f12b02
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
24 changes: 11 additions & 13 deletions app/components/AgentAssets.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Token, TokenRow } from "@coinbase/onchainkit/token";
import { useCallback, useEffect, useState } from "react";
import { Token, TokenRow } from '@coinbase/onchainkit/token';
import { useCallback, useEffect, useState } from 'react';
// import useGetNFTs from "../hooks/useGetNFTs";
import type { Address } from "viem";
import { useToken } from "wagmi";
import useGetTokens from "../hooks/useGetTokens";
import type { Address } from 'viem';
import { useToken } from 'wagmi';
import useGetTokens from '../hooks/useGetTokens';

type AgentTokenProps = {
tokenAddress: Address;
Expand All @@ -17,15 +17,13 @@ function AgentToken({ tokenAddress }: AgentTokenProps) {
decimals: data?.decimals || 0,
name: data?.name || '',
symbol: data?.symbol || '',
image: ''
image: '',
};

return (
<TokenRow token={token} className="rounded max-w-56" />
);
return <TokenRow token={token} className="rounded max-w-56" />;
}
export default function AgentAssets() {
const [tab, setTab] = useState("tokens");
const [tab, setTab] = useState('tokens');
// const [nfts, setNFTs] = useState<string[]>([]);
const [tokens, setTokens] = useState<Address[]>([]);

Expand Down Expand Up @@ -56,16 +54,16 @@ export default function AgentAssets() {
</button> */}
<button
type="button"
onClick={handleTabChange("tokens")}
onClick={handleTabChange('tokens')}
className={`flex items-center justify-center py-1 ${
tab === "tokens" ? "border-b border-[#5788FA]" : ""
tab === 'tokens' ? 'border-b border-[#5788FA]' : ''
}`}
>
Tokens
</button>
</div>

{tab === "tokens" &&
{tab === 'tokens' &&
tokens &&
tokens?.map((token) => (
<AgentToken key={token} tokenAddress={token} />
Expand Down
10 changes: 5 additions & 5 deletions app/hooks/useGetNFTs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useState } from "react";
import { API_URL } from "../config";
import { useCallback, useState } from 'react';
import { API_URL } from '../config';

type UseGetNFTsResponse = {
NFTs?: string[];
Expand All @@ -22,9 +22,9 @@ export default function useGetNFTs({

try {
const response = await fetch(`${API_URL}/nfts`, {
method: "GET",
method: 'GET',
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json',
},
});

Expand All @@ -38,7 +38,7 @@ export default function useGetNFTs({

return { nfts, error: null };
} catch (error) {
console.error("Error fetching nfts:", error);
console.error('Error fetching nfts:', error);
return { nfts: [], error: error as Error };
} finally {
setIsLoading(false);
Expand Down
13 changes: 6 additions & 7 deletions app/hooks/useGetTokens.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useState } from "react";
import type { Address } from "viem";
import { API_URL } from "../config";
import { useCallback, useState } from 'react';
import type { Address } from 'viem';
import { API_URL } from '../config';

type UseGetTokensResponse = {
tokens?: Address[];
Expand All @@ -23,9 +23,9 @@ export default function useGetTokens({

try {
const response = await fetch(`${API_URL}/tokens`, {
method: "GET",
method: 'GET',
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json',
},
});

Expand All @@ -36,9 +36,8 @@ export default function useGetTokens({
const { tokens } = await response.json();
onSuccess?.(tokens);
return { tokens, error: null };

} catch (error) {
console.error("Error fetching tokens:", error);
console.error('Error fetching tokens:', error);
return { tokens: [], error: error as Error };
} finally {
setIsLoading(false);
Expand Down

0 comments on commit 4f12b02

Please sign in to comment.