From 78351df9265a8985f260caa95d86fc1604a63940 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 1 Apr 2024 03:25:28 +0100 Subject: [PATCH] cleanup --- app/api/quote/route.ts | 10 +--------- components/FormAmount/FormAmount.module.css | 3 ++- components/ResultRow/ResultRow.tsx | 2 +- components/Strategies/Buy.tsx | 2 +- components/Strategies/Swap/Results.tsx | 2 +- hooks/use-prices.tsx | 2 +- hooks/use-quote.ts | 2 +- utils/index.ts => lib/utils.ts | 0 next.config.mjs | 2 +- 9 files changed, 9 insertions(+), 16 deletions(-) rename utils/index.ts => lib/utils.ts (100%) diff --git a/app/api/quote/route.ts b/app/api/quote/route.ts index 468f69a..3bb5749 100644 --- a/app/api/quote/route.ts +++ b/app/api/quote/route.ts @@ -4,14 +4,6 @@ export const runtime = 'edge' const apiUrl = process.env.WEB3_API_URL -const config: RequestInit = { - headers: { - 'content-type': 'application/json' - }, - method: 'GET', - next: { revalidate: 30 } -} - export async function GET(request: NextRequest) { const searchParams = request?.nextUrl?.searchParams const tokenIn = searchParams?.get('tokenIn') @@ -26,7 +18,7 @@ export async function GET(request: NextRequest) { let status try { - const res = await fetch(url, config) + const res = await fetch(url) const json = await res.json() data = json diff --git a/components/FormAmount/FormAmount.module.css b/components/FormAmount/FormAmount.module.css index ea5457d..738f394 100644 --- a/components/FormAmount/FormAmount.module.css +++ b/components/FormAmount/FormAmount.module.css @@ -3,5 +3,6 @@ border: 1px solid rgba(var(--foreground-rgb), 0.15); border-radius: var(--border-radius); overflow: hidden; - margin: 0 0.25rem; + margin: -0.15em 0.25rem 0 0.25rem; + font-size: 0.9em; } diff --git a/components/ResultRow/ResultRow.tsx b/components/ResultRow/ResultRow.tsx index 11d5e79..f893363 100644 --- a/components/ResultRow/ResultRow.tsx +++ b/components/ResultRow/ResultRow.tsx @@ -1,5 +1,5 @@ import styles from './ResultRow.module.css' -import { formatNumber } from '@/utils' +import { formatNumber } from '@/lib/utils' import { ArrowRightIcon } from '@radix-ui/react-icons' import { TokenLogo } from '../TokenLogo/TokenLogo' import { Token } from '@/types' diff --git a/components/Strategies/Buy.tsx b/components/Strategies/Buy.tsx index 50d63db..ddce207 100644 --- a/components/Strategies/Buy.tsx +++ b/components/Strategies/Buy.tsx @@ -7,7 +7,7 @@ import { useDebounce } from 'use-debounce' import stylesShared from './styles.module.css' import { usePrices } from '@/hooks' import { FormAmount } from '@/components/FormAmount' -import { getTokenBySymbol } from '@/utils' +import { getTokenBySymbol } from '@/lib/utils' export function Buy() { const { prices, isValidating, isLoading } = usePrices() diff --git a/components/Strategies/Swap/Results.tsx b/components/Strategies/Swap/Results.tsx index a995427..e66b63f 100644 --- a/components/Strategies/Swap/Results.tsx +++ b/components/Strategies/Swap/Results.tsx @@ -1,7 +1,7 @@ import { Result } from '@/components/ResultRow' import { ratioOceanToAsi, ratioAgixToAsi, ratioFetToAsi } from '@/constants' import { usePrices } from '@/hooks' -import { getTokenBySymbol } from '@/utils' +import { getTokenBySymbol } from '@/lib/utils' import { TokenSymbol } from '@/types' import { useQuote } from '@/hooks' diff --git a/hooks/use-prices.tsx b/hooks/use-prices.tsx index caf63e9..0fbaad1 100644 --- a/hooks/use-prices.tsx +++ b/hooks/use-prices.tsx @@ -1,5 +1,5 @@ import { tokens } from '@/constants' -import { fetcher, getTokenAddressBySymbol } from '@/utils' +import { fetcher, getTokenAddressBySymbol } from '@/lib/utils' import useSWR from 'swr' const tokenAddresses = tokens.map((token) => token.address).toString() diff --git a/hooks/use-quote.ts b/hooks/use-quote.ts index 4bee7df..51304b8 100644 --- a/hooks/use-quote.ts +++ b/hooks/use-quote.ts @@ -1,5 +1,5 @@ import { TokenSymbol } from '@/types' -import { getTokenAddressBySymbol, fetcher } from '@/utils' +import { getTokenAddressBySymbol, fetcher } from '@/lib/utils' import useSWR from 'swr' const options = { diff --git a/utils/index.ts b/lib/utils.ts similarity index 100% rename from utils/index.ts rename to lib/utils.ts diff --git a/next.config.mjs b/next.config.mjs index b6223b4..7b6dbfe 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -9,7 +9,7 @@ const nextConfig = { } ] }, - webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { + webpack: (config) => { config.module.rules.push({ test: /\.md$/, type: 'asset/source'