Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hugolxt committed Dec 3, 2024
1 parent 47733d0 commit 087bb85
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions src/routes/_merkl.opportunity.$chain.$type.$id.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type { Opportunity } from "@angleprotocol/merkl-api";
import {
type LoaderFunctionArgs,
type MetaFunction,
json,
} from "@remix-run/node";
import { type LoaderFunctionArgs, type MetaFunction, json } from "@remix-run/node";
import { Meta, Outlet, useLoaderData } from "@remix-run/react";
import { useMemo } from "react";
import { ChainService } from "src/api/services/chain.service";
Expand All @@ -13,9 +9,7 @@ import Tag from "src/components/element/Tag";
import { ErrorHeading } from "src/components/layout/ErrorHeading";
import useOpportunity from "src/hooks/resources/useOpportunity";

export async function loader({
params: { id, type, chain: chainId },
}: LoaderFunctionArgs) {
export async function loader({ params: { id, type, chain: chainId } }: LoaderFunctionArgs) {
if (!chainId || !id || !type) throw "";

const chain = await ChainService.get({ search: chainId });
Expand Down Expand Up @@ -59,17 +53,11 @@ export default function Index() {
if (str.includes("-"))
return str
.split("-")
.flatMap((s, i, arr) => [
s,
i !== arr.length - 1 && <span className="text-main-11">-</span>,
]);
.flatMap((s, i, arr) => [s, i !== arr.length - 1 && <span className="text-main-11">-</span>]);
if (str.includes("/"))
return str
.split("/")
.flatMap((s, i, arr) => [
s,
i !== arr.length - 1 && <span className="text-main-11">/</span>,
]);
.flatMap((s, i, arr) => [s, i !== arr.length - 1 && <span className="text-main-11">/</span>]);
return [<span key={key}>{str}</span>];
})
.flatMap((str, index, arr) => [str, index !== arr.length - 1 && " "]);
Expand All @@ -79,23 +67,16 @@ export default function Index() {
<>
<Meta />
<Hero
icons={opportunity.tokens.map((t) => ({ src: t.icon }))}
icons={opportunity.tokens.map(t => ({ src: t.icon }))}
navigation={{ label: "Back to opportunities", link: "/" }}
title={styleName}
description={description}
tabs={[
{ label: "Overview", link },
{ label: "Leaderboard", link: `${link}/leaderboard` },
]}
tags={tags.map((tag) => (
<Tag
key={`${tag.type}_${tag.value?.address ?? tag.value}`}
{...tag}
size="md"
/>
))}
opportunity={opportunity}
>
tags={tags.map(tag => <Tag key={`${tag.type}_${tag.value?.address ?? tag.value}`} {...tag} size="md" />)}
opportunity={opportunity}>
<Outlet context={{ opportunity }} />
</Hero>
</>
Expand Down

0 comments on commit 087bb85

Please sign in to comment.