From 0b9292e2febbe6104b2aac84582d08fd9329fa2b Mon Sep 17 00:00:00 2001 From: sheykei Date: Mon, 11 Nov 2024 16:29:06 +0100 Subject: [PATCH] fix: lint --- .../_merkl.action.$action.(opportunities).tsx | 6 ++--- .../_merkl.chain.$id.(opportunities).tsx | 2 +- app/routes/_merkl.chain.$id.tsx | 4 +-- ...pportunity.$chain.$type.$id.(overview).tsx | 2 +- .../_merkl.opportunity.$chain.$type.$id.tsx | 6 ++--- .../_merkl.protocol.$id.(opportunities).tsx | 4 +-- .../_merkl.status.$status.(opportunities).tsx | 4 +-- .../_merkl.token.$symbol.(opportunities).tsx | 4 +-- .../opportunity/OpportunityFilters.tsx | 25 ++++++++++--------- .../rewards/ClaimRewardsChainTable.tsx | 2 +- .../rewards/ClaimRewardsChainTableRow.tsx | 20 ++++++++------- .../element/rewards/ClaimRewardsLibrary.tsx | 16 +++++------- .../rewards/ClaimRewardsTokenTableRow.tsx | 9 +++---- src/hooks/resources/useOpportunity.tsx | 3 +-- 14 files changed, 50 insertions(+), 57 deletions(-) diff --git a/app/routes/_merkl.action.$action.(opportunities).tsx b/app/routes/_merkl.action.$action.(opportunities).tsx index 04267dcd..c7dde831 100644 --- a/app/routes/_merkl.action.$action.(opportunities).tsx +++ b/app/routes/_merkl.action.$action.(opportunities).tsx @@ -12,11 +12,11 @@ export async function loader({ params: { action: _action }, request }: LoaderFun if (!action) throw new Error("Unknown action"); const { data: opportunities, ...res } = await fetchOpportunities(request, { action }); - const { data: chains } = await api.v4.chain.get({ query: {}}); + const { data: chains } = await api.v4.chain.get({ query: {} }); if (!opportunities || !chains) throw new Error("Unknown opportunity"); - return json({ opportunities, chains}); + return json({ opportunities, chains }); } export default function Index() { @@ -25,7 +25,7 @@ export default function Index() { return ( <> - o)} chains={chains}/> + o)} chains={chains} /> ); } diff --git a/app/routes/_merkl.chain.$id.(opportunities).tsx b/app/routes/_merkl.chain.$id.(opportunities).tsx index 6daa7ebe..9f80cb3b 100644 --- a/app/routes/_merkl.chain.$id.(opportunities).tsx +++ b/app/routes/_merkl.chain.$id.(opportunities).tsx @@ -7,7 +7,7 @@ import OpportunityLibrary from "src/components/element/opportunity/OpportunityLi export async function loader({ params: { id: chainId }, request }: LoaderFunctionArgs) { if (!chainId) throw new Error("Unsupported Chain"); - + const { data: chains } = await api.v4.chain.get({ query: { search: chainId } }); const chain = chains?.[0]; diff --git a/app/routes/_merkl.chain.$id.tsx b/app/routes/_merkl.chain.$id.tsx index e2088d3b..ed9a0a94 100644 --- a/app/routes/_merkl.chain.$id.tsx +++ b/app/routes/_merkl.chain.$id.tsx @@ -46,9 +46,7 @@ export function ErrorBoundary() { {error?.message ?? "Error"} {/* We don't support this chain */} -
- -
+
); diff --git a/app/routes/_merkl.opportunity.$chain.$type.$id.(overview).tsx b/app/routes/_merkl.opportunity.$chain.$type.$id.(overview).tsx index bbb80578..8f152955 100644 --- a/app/routes/_merkl.opportunity.$chain.$type.$id.(overview).tsx +++ b/app/routes/_merkl.opportunity.$chain.$type.$id.(overview).tsx @@ -10,7 +10,7 @@ import useOpportunity from "src/hooks/resources/useOpportunity"; export async function loader({ params: { id, type, chain: chainId } }: LoaderFunctionArgs) { if (!chainId || !id || !type) throw ""; - + const { data: chains } = await api.v4.chain.get({ query: { search: id } }); const chain = chains?.[0]; diff --git a/app/routes/_merkl.opportunity.$chain.$type.$id.tsx b/app/routes/_merkl.opportunity.$chain.$type.$id.tsx index d909ecab..3cbcfade 100644 --- a/app/routes/_merkl.opportunity.$chain.$type.$id.tsx +++ b/app/routes/_merkl.opportunity.$chain.$type.$id.tsx @@ -1,4 +1,3 @@ -import type { Opportunity } from "@angleprotocol/merkl-api"; import { type LoaderFunctionArgs, type MetaFunction, json } from "@remix-run/node"; import { Meta, Outlet, useLoaderData, useParams } from "@remix-run/react"; import { api } from "src/api"; @@ -9,14 +8,13 @@ import Tag from "src/components/element/Tag"; import useOpportunity from "src/hooks/resources/useOpportunity"; export async function loader({ params: { id, type, chain: chainId } }: LoaderFunctionArgs) { - if (!chainId || !id || !type) throw ""; - + const { data: chains } = await api.v4.chain.get({ query: { search: id } }); const chain = chains?.[0]; if (!chain) throw ""; - + const { data: opportunity, ...res } = await api.v4.opportunity({ chainId: chain.id })({ type })({ id }).get(); if (!opportunity) throw ""; diff --git a/app/routes/_merkl.protocol.$id.(opportunities).tsx b/app/routes/_merkl.protocol.$id.(opportunities).tsx index bfe471cc..410a91a3 100644 --- a/app/routes/_merkl.protocol.$id.(opportunities).tsx +++ b/app/routes/_merkl.protocol.$id.(opportunities).tsx @@ -11,7 +11,7 @@ export async function loader({ params: { id }, request }: LoaderFunctionArgs) { if (!protocol) throw new Error("Unsupported Protocol"); const { data: opportunities, ...res } = await fetchOpportunities(request, { mainProtocolType: protocol.type }); - const { data: chains } = await api.v4.chain.get({ query: {}}); + const { data: chains } = await api.v4.chain.get({ query: {} }); if (!opportunities || !chains) throw new Error(""); @@ -24,7 +24,7 @@ export default function Index() { return ( <> - + ); } diff --git a/app/routes/_merkl.status.$status.(opportunities).tsx b/app/routes/_merkl.status.$status.(opportunities).tsx index 603b6911..265bc521 100644 --- a/app/routes/_merkl.status.$status.(opportunities).tsx +++ b/app/routes/_merkl.status.$status.(opportunities).tsx @@ -12,7 +12,7 @@ export async function loader({ params: { status: _status }, request }: LoaderFun if (!status) throw new Error("Unknown status"); const { data: opportunities, ...res } = await fetchOpportunities(request, { status }); - const { data: chains } = await api.v4.chain.get({ query: {}}); + const { data: chains } = await api.v4.chain.get({ query: {} }); if (!opportunities || !chains) throw new Error("Unknown opportunity"); @@ -20,7 +20,7 @@ export async function loader({ params: { status: _status }, request }: LoaderFun } export default function Index() { - const { opportunities, chains} = useLoaderData(); + const { opportunities, chains } = useLoaderData(); return ( <> diff --git a/app/routes/_merkl.token.$symbol.(opportunities).tsx b/app/routes/_merkl.token.$symbol.(opportunities).tsx index 0d04c72d..4d5dffc2 100644 --- a/app/routes/_merkl.token.$symbol.(opportunities).tsx +++ b/app/routes/_merkl.token.$symbol.(opportunities).tsx @@ -7,7 +7,7 @@ import OpportunityLibrary from "src/components/element/opportunity/OpportunityLi export async function loader({ params: { symbol }, request }: LoaderFunctionArgs) { const { data: opportunities, ...res } = await fetchOpportunities(request, { tokens: [symbol] }); - const { data: chains } = await api.v4.chain.get({ query: {}}); + const { data: chains } = await api.v4.chain.get({ query: {} }); if (!opportunities?.length || !chains) throw new Error("Unknown token"); @@ -20,7 +20,7 @@ export default function Index() { return ( <> - + ); } diff --git a/src/components/element/opportunity/OpportunityFilters.tsx b/src/components/element/opportunity/OpportunityFilters.tsx index 0d8dbaf4..754e5b83 100644 --- a/src/components/element/opportunity/OpportunityFilters.tsx +++ b/src/components/element/opportunity/OpportunityFilters.tsx @@ -45,18 +45,19 @@ export default function OpportunityFilters({ only, exclude, chains }: Opportunit ), }; - const chainOptions = chains?.reduce( - (obj, chain) => - Object.assign(obj, { - [chain.id]: ( - <> - - {chain.name} - - ), - }), - {}, - ) ?? []; + const chainOptions = + chains?.reduce( + (obj, chain) => + Object.assign(obj, { + [chain.id]: ( + <> + + {chain.name} + + ), + }), + {}, + ) ?? []; const [actionsFilter, setActions] = useSearchParamState( "action", diff --git a/src/components/element/rewards/ClaimRewardsChainTable.tsx b/src/components/element/rewards/ClaimRewardsChainTable.tsx index a8553d5a..cdbafdb2 100644 --- a/src/components/element/rewards/ClaimRewardsChainTable.tsx +++ b/src/components/element/rewards/ClaimRewardsChainTable.tsx @@ -25,5 +25,5 @@ export const [ClaimRewardsChainTable, ClaimRewardsChainRow, claimRewardsChainCol size: "minmax(100px,100px)", compactSize: "minmax(min-content,1fr)", className: "justify-end", - } + }, }); diff --git a/src/components/element/rewards/ClaimRewardsChainTableRow.tsx b/src/components/element/rewards/ClaimRewardsChainTableRow.tsx index 99d9a662..4aef77a5 100644 --- a/src/components/element/rewards/ClaimRewardsChainTableRow.tsx +++ b/src/components/element/rewards/ClaimRewardsChainTableRow.tsx @@ -1,13 +1,11 @@ -import { Button, createTable, Icon, Space, Text } from "dappkit"; -import { ClaimRewardsTokenRow, ClaimRewardsTokenTable } from "./ClaimRewardsTokenTable"; -import Token from "../token/Token"; -import { PropsWithChildren, useState } from "react"; -import Accordion from "packages/dappkit/src/components/primitives/Accordion"; +import { Button, Icon, Space, Text } from "dappkit"; import Collapsible from "packages/dappkit/src/components/primitives/Collapsible"; +import EventBlocker from "packages/dappkit/src/components/primitives/EventBlocker"; +import { type PropsWithChildren, useState } from "react"; import Chain from "../chain/Chain"; import { ClaimRewardsChainRow } from "./ClaimRewardsChainTable"; +import { ClaimRewardsTokenTable } from "./ClaimRewardsTokenTable"; import ClaimRewardsTokenTableRow from "./ClaimRewardsTokenTableRow"; -import EventBlocker from "packages/dappkit/src/components/primitives/EventBlocker"; export type ClaimRewardsChainTableRowProps = PropsWithChildren; @@ -38,9 +36,13 @@ export default function ClaimRewardsChainTableRow(props: ClaimRewardsChainTableR TOKEN} - - size="sm" look="soft"> + tokenHeader={ + + TOKEN + + } + size="sm" + look="soft"> diff --git a/src/components/element/rewards/ClaimRewardsLibrary.tsx b/src/components/element/rewards/ClaimRewardsLibrary.tsx index f09544a1..c82fe8e0 100644 --- a/src/components/element/rewards/ClaimRewardsLibrary.tsx +++ b/src/components/element/rewards/ClaimRewardsLibrary.tsx @@ -1,19 +1,15 @@ -import { List, Box, Group, Text, Button, Value } from "dappkit"; -import { ClaimRewardsChainRow, ClaimRewardsChainTable } from "./ClaimRewardsChainTable"; -import { ClaimRewardsTokenRow, ClaimRewardsTokenTable } from "./ClaimRewardsTokenTable"; -import Chain from "../chain/Chain"; -import Token from "../token/Token"; -import ClaimRewardsTokenTableRow from "./ClaimRewardsTokenTableRow"; +import { Group, Text } from "dappkit"; +import { ClaimRewardsChainTable } from "./ClaimRewardsChainTable"; import ClaimRewardsChainTableRow from "./ClaimRewardsChainTableRow"; export default function ClaimRewardsLibrary() { return ( 23k$ to claim across 6 chains}> - - - - + + + + ); diff --git a/src/components/element/rewards/ClaimRewardsTokenTableRow.tsx b/src/components/element/rewards/ClaimRewardsTokenTableRow.tsx index fe0551f6..780ca8d3 100644 --- a/src/components/element/rewards/ClaimRewardsTokenTableRow.tsx +++ b/src/components/element/rewards/ClaimRewardsTokenTableRow.tsx @@ -1,9 +1,8 @@ -import { createTable, Space } from "dappkit"; -import { ClaimRewardsTokenRow } from "./ClaimRewardsTokenTable"; -import Token from "../token/Token"; -import { PropsWithChildren, useState } from "react"; -import Accordion from "packages/dappkit/src/components/primitives/Accordion"; +import { Space } from "dappkit"; import Collapsible from "packages/dappkit/src/components/primitives/Collapsible"; +import { type PropsWithChildren, useState } from "react"; +import Token from "../token/Token"; +import { ClaimRewardsTokenRow } from "./ClaimRewardsTokenTable"; export type ClaimRewardsTokenTableRowProps = PropsWithChildren; diff --git a/src/hooks/resources/useOpportunity.tsx b/src/hooks/resources/useOpportunity.tsx index 16bd3259..571478ce 100644 --- a/src/hooks/resources/useOpportunity.tsx +++ b/src/hooks/resources/useOpportunity.tsx @@ -15,8 +15,7 @@ export default function useOpportunity(opportunity: Opportunity) { }, [opportunity]); const link = useMemo( - () => - `/opportunity/${opportunity.chain?.name?.toLowerCase?.()}/${opportunity.type}/${opportunity.identifier}`, + () => `/opportunity/${opportunity.chain?.name?.toLowerCase?.()}/${opportunity.type}/${opportunity.identifier}`, [opportunity], );