From 415db6f3bef90ac78ebbe21c14b3d0da1eae4329 Mon Sep 17 00:00:00 2001 From: indaviande Date: Tue, 3 Dec 2024 18:11:56 +0100 Subject: [PATCH] lint --- src/components/element/SwitchMode.tsx | 5 +- src/components/element/Tag.tsx | 47 ++++--------------- .../element/functions/SearchBar.tsx | 47 ++++--------------- .../opportunity/OpportunityFilters.tsx | 36 +++++++------- src/components/layout/Header.tsx | 38 ++++----------- src/components/layout/LayerMenu.tsx | 8 +--- 6 files changed, 46 insertions(+), 135 deletions(-) diff --git a/src/components/element/SwitchMode.tsx b/src/components/element/SwitchMode.tsx index b21d2495..1379ae9d 100644 --- a/src/components/element/SwitchMode.tsx +++ b/src/components/element/SwitchMode.tsx @@ -4,10 +4,7 @@ import { useMemo } from "react"; export default function SwitchMode() { const { mode, toggleMode } = useTheme(); - const canSwitchModes = useMemo( - () => !(!config.modes || config.modes?.length === 1), - [] - ); + const canSwitchModes = useMemo(() => !(!config.modes || config.modes?.length === 1), []); return ( canSwitchModes && ( diff --git a/src/components/element/Tag.tsx b/src/components/element/Tag.tsx index 55927187..8a3da624 100644 --- a/src/components/element/Tag.tsx +++ b/src/components/element/Tag.tsx @@ -1,15 +1,6 @@ import type { Opportunity, Token } from "@angleprotocol/merkl-api"; import type { Chain } from "@merkl/api"; -import { - Button, - Divider, - Dropdown, - Group, - Hash, - Icon, - PrimitiveTag, - Text, -} from "dappkit"; +import { Button, Divider, Dropdown, Group, Hash, Icon, PrimitiveTag, Text } from "dappkit"; import type { ButtonProps } from "dappkit"; import { type Action, actions } from "src/config/actions"; import type { Protocol } from "src/config/protocols"; @@ -33,11 +24,7 @@ export type TagProps = ButtonProps & { value: TagTypes[T]; }; -export default function Tag({ - type, - value, - ...props -}: TagProps) { +export default function Tag({ type, value, ...props }: TagProps) { switch (type) { case "status": { const status = statuses[value as TagTypes["status"]] ?? statuses.LIVE; @@ -64,8 +51,7 @@ export default function Tag({ - } - > + }> {status?.label} @@ -98,8 +84,7 @@ export default function Tag({ - } - > + }> {chain?.name} @@ -131,8 +116,7 @@ export default function Tag({ Open - } - > + }> {action?.label} @@ -175,8 +159,7 @@ export default function Tag({ - } - > + }> {token?.symbol} @@ -210,11 +193,7 @@ export default function Tag({ {/* {token?.description} */} - @@ -228,8 +207,7 @@ export default function Tag({ - } - > + }> {token.chain.name} @@ -255,11 +233,7 @@ export default function Tag({ {/* {token?.description} */} - @@ -269,8 +243,7 @@ export default function Tag({ - } - > + }> {value?.name} diff --git a/src/components/element/functions/SearchBar.tsx b/src/components/element/functions/SearchBar.tsx index e1cef143..ba46f7e2 100644 --- a/src/components/element/functions/SearchBar.tsx +++ b/src/components/element/functions/SearchBar.tsx @@ -1,24 +1,11 @@ import type { Opportunity } from "@merkl/api"; import { Form, useLocation } from "@remix-run/react"; -import { - Divider, - Group, - Icon, - Icons, - Input, - Modal, - Title, - useShortcut, -} from "dappkit"; +import { Divider, Group, Icon, Icons, Input, Modal, Title, useShortcut } from "dappkit"; import { Button } from "dappkit"; import Scroll from "packages/dappkit/src/components/primitives/Scroll"; import { type ReactNode, useEffect, useMemo, useState } from "react"; import useOpportunity from "src/hooks/resources/useOpportunity"; -import { - type Results, - type Searchable, - useMerklSearch, -} from "src/hooks/useMerklSearch"; +import { type Results, type Searchable, useMerklSearch } from "src/hooks/useMerklSearch"; const titles: { [S in Searchable]: ReactNode } = { chain: "Chains", @@ -33,8 +20,7 @@ function OpportunityResult({ opportunity }: { opportunity: Opportunity }) { return ( <> @@ -67,10 +53,7 @@ export default function SearchBar({ icon = false }: SearchBarProps) { return ( - + {entries .filter(([_, res]) => res?.length) .map(([category, results]) => ( @@ -82,11 +65,7 @@ export default function SearchBar({ icon = false }: SearchBarProps) { case "chain": return ( <> - @@ -98,12 +77,8 @@ export default function SearchBar({ icon = false }: SearchBarProps) { case "token": return ( <> - @@ -111,10 +86,7 @@ export default function SearchBar({ icon = false }: SearchBarProps) { case "protocol": return ( <> - @@ -148,8 +120,7 @@ export default function SearchBar({ icon = false }: SearchBarProps) { /> {Results} - } - > + }>
{icon ? (