Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
clmntsnr committed Nov 11, 2024
1 parent 4d4e61c commit 0b9292e
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 57 deletions.
6 changes: 3 additions & 3 deletions app/routes/_merkl.action.$action.(opportunities).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -25,7 +25,7 @@ export default function Index() {
return (
<>
<Space size="md" />
<OpportunityLibrary exclude={["action"]} opportunities={opportunities.filter(o => o)} chains={chains}/>
<OpportunityLibrary exclude={["action"]} opportunities={opportunities.filter(o => o)} chains={chains} />
</>
);
}
2 changes: 1 addition & 1 deletion app/routes/_merkl.chain.$id.(opportunities).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
4 changes: 1 addition & 3 deletions app/routes/_merkl.chain.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ export function ErrorBoundary() {
<Group className="mx-auto my-auto flex-col p-xl*2 [&>*]:text-center max-w-fit justify-center">
<Title h={3}>{error?.message ?? "Error"}</Title>
{/* <Text h={3}>We don't support this chain</Text> */}
<div>

</div>
<div></div>
</Group>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
6 changes: 2 additions & 4 deletions app/routes/_merkl.opportunity.$chain.$type.$id.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 "";
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_merkl.protocol.$id.(opportunities).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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("");

Expand All @@ -24,7 +24,7 @@ export default function Index() {
return (
<>
<Space size="md" />
<OpportunityLibrary opportunities={opportunities} chains={chains}/>
<OpportunityLibrary opportunities={opportunities} chains={chains} />
</>
);
}
4 changes: 2 additions & 2 deletions app/routes/_merkl.status.$status.(opportunities).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ 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");

return json({ opportunities, chains });
}

export default function Index() {
const { opportunities, chains} = useLoaderData<typeof loader>();
const { opportunities, chains } = useLoaderData<typeof loader>();

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_merkl.token.$symbol.(opportunities).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -20,7 +20,7 @@ export default function Index() {
return (
<>
<Space size="md" />
<OpportunityLibrary opportunities={opportunities} chains={chains}/>
<OpportunityLibrary opportunities={opportunities} chains={chains} />
</>
);
}
25 changes: 13 additions & 12 deletions src/components/element/opportunity/OpportunityFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,19 @@ export default function OpportunityFilters({ only, exclude, chains }: Opportunit
</>
),
};
const chainOptions = chains?.reduce(
(obj, chain) =>
Object.assign(obj, {
[chain.id]: (
<>
<Icon size="sm" src={chain?.icon} />
{chain.name}
</>
),
}),
{},
) ?? [];
const chainOptions =
chains?.reduce(
(obj, chain) =>
Object.assign(obj, {
[chain.id]: (
<>
<Icon size="sm" src={chain?.icon} />
{chain.name}
</>
),
}),
{},
) ?? [];

const [actionsFilter, setActions] = useSearchParamState<string[]>(
"action",
Expand Down
2 changes: 1 addition & 1 deletion src/components/element/rewards/ClaimRewardsChainTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export const [ClaimRewardsChainTable, ClaimRewardsChainRow, claimRewardsChainCol
size: "minmax(100px,100px)",
compactSize: "minmax(min-content,1fr)",
className: "justify-end",
}
},
});
20 changes: 11 additions & 9 deletions src/components/element/rewards/ClaimRewardsChainTableRow.tsx
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -38,9 +36,13 @@ export default function ClaimRewardsChainTableRow(props: ClaimRewardsChainTableR
<Collapsible state={[open, setOpen]}>
<Space size="md" />
<ClaimRewardsTokenTable
tokenHeader={<Text size="xs" className="pl-md">TOKEN</Text>}

size="sm" look="soft">
tokenHeader={
<Text size="xs" className="pl-md">
TOKEN
</Text>
}
size="sm"
look="soft">
<ClaimRewardsTokenTableRow />
<ClaimRewardsTokenTableRow />
<ClaimRewardsTokenTableRow />
Expand Down
16 changes: 6 additions & 10 deletions src/components/element/rewards/ClaimRewardsLibrary.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Group className="flex-row w-full [&>*]:flex-grow">
<ClaimRewardsChainTable header={<Text>23k$ to claim across 6 chains</Text>}>
<ClaimRewardsChainTableRow/>
<ClaimRewardsChainTableRow/>
<ClaimRewardsChainTableRow/>
<ClaimRewardsChainTableRow/>
<ClaimRewardsChainTableRow />
<ClaimRewardsChainTableRow />
<ClaimRewardsChainTableRow />
<ClaimRewardsChainTableRow />
</ClaimRewardsChainTable>
</Group>
);
Expand Down
9 changes: 4 additions & 5 deletions src/components/element/rewards/ClaimRewardsTokenTableRow.tsx
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
3 changes: 1 addition & 2 deletions src/hooks/resources/useOpportunity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
);

Expand Down

0 comments on commit 0b9292e

Please sign in to comment.