From a0d8ee76a23ed0730ce92673fa3b28d691e8dd6f Mon Sep 17 00:00:00 2001 From: indaviande Date: Tue, 3 Dec 2024 15:07:44 +0100 Subject: [PATCH 1/4] wip --- .../element/functions/SearchBar.tsx | 91 +++++++++++++++---- src/customer/assets/style/shorthands.css | 4 +- 2 files changed, 73 insertions(+), 22 deletions(-) diff --git a/src/components/element/functions/SearchBar.tsx b/src/components/element/functions/SearchBar.tsx index 9ed747d8..f797b302 100644 --- a/src/components/element/functions/SearchBar.tsx +++ b/src/components/element/functions/SearchBar.tsx @@ -1,11 +1,24 @@ import type { Opportunity } from "@merkl/api"; import { Form, useLocation } from "@remix-run/react"; -import { 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", @@ -18,9 +31,13 @@ function OpportunityResult({ opportunity }: { opportunity: Opportunity }) { const { link, icons } = useOpportunity(opportunity); return ( - + <> + + + ); } @@ -50,34 +67,61 @@ export default function SearchBar({ icon = false }: SearchBarProps) { return ( - + {entries .filter(([_, res]) => res?.length) .map(([category, results]) => ( - + {titles[category]} - + {results.map((_, i) => { switch (category) { case "chain": return ( - + <> + + + ); case "opportunity": return ; case "token": return ( - + <> + + + ); case "protocol": return ( - + <> + + + ); default: break; @@ -93,14 +137,21 @@ export default function SearchBar({ icon = false }: SearchBarProps) { return ( - + {Results} - }> + } + >
{icon ? ( - ); - })} - {canSwitchModes && ( - + {!mdScreens && ( + <> + {Object.entries(config.routes) + .filter( + ([key]) => !["homepage", "privacy", "terms"].includes(key) + ) + .map(([key, { route }]) => { + return ( + + ); + })} + + {canSwitchModes && } + + + + )} {!smScreens && } From 1bc7bb4c3333ff0d24229bc36b0346f67bcdca88 Mon Sep 17 00:00:00 2001 From: indaviande Date: Tue, 3 Dec 2024 18:09:49 +0100 Subject: [PATCH 3/4] Select + Connect wallet modal --- packages/dappkit | 2 +- src/components/element/SwitchMode.tsx | 6 +- src/components/element/Tag.tsx | 48 ++++++-- .../element/functions/SearchBar.tsx | 8 +- .../opportunity/OpportunityFilters.tsx | 43 +++---- src/components/layout/Header.tsx | 115 +++++++++--------- src/components/layout/LayerMenu.tsx | 26 ++-- 7 files changed, 138 insertions(+), 110 deletions(-) diff --git a/packages/dappkit b/packages/dappkit index d1e09d70..49cb1b4e 160000 --- a/packages/dappkit +++ b/packages/dappkit @@ -1 +1 @@ -Subproject commit d1e09d700ad9a8efa892a2e4fa1841f30ec78c32 +Subproject commit 49cb1b4e4696c5688d18a287728ea0a8fc6b4811 diff --git a/src/components/element/SwitchMode.tsx b/src/components/element/SwitchMode.tsx index 1ebe8951..b21d2495 100644 --- a/src/components/element/SwitchMode.tsx +++ b/src/components/element/SwitchMode.tsx @@ -4,7 +4,11 @@ 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 && ( - }> + } + > {status?.label} @@ -84,7 +98,8 @@ export default function Tag({ type, value, ...props }: - }> + } + > {chain?.name} @@ -116,7 +131,8 @@ export default function Tag({ type, value, ...props }: Open - }> + } + > {action?.label} @@ -159,7 +175,8 @@ export default function Tag({ type, value, ...props }: - }> + } + > {token?.symbol} @@ -193,7 +210,11 @@ export default function Tag({ type, value, ...props }: {/* {token?.description} */} - @@ -207,7 +228,8 @@ export default function Tag({ type, value, ...props }: - }> + } + > {token.chain.name} @@ -233,7 +255,12 @@ export default function Tag({ type, value, ...props }: {/* {token?.description} */} - - }> + } + > {value?.name} diff --git a/src/components/element/functions/SearchBar.tsx b/src/components/element/functions/SearchBar.tsx index f797b302..e1cef143 100644 --- a/src/components/element/functions/SearchBar.tsx +++ b/src/components/element/functions/SearchBar.tsx @@ -32,7 +32,7 @@ function OpportunityResult({ opportunity }: { opportunity: Opportunity }) { return ( <> - @@ -101,7 +101,6 @@ export default function SearchBar({ icon = false }: SearchBarProps) { ); diff --git a/src/components/layout/LayerMenu.tsx b/src/components/layout/LayerMenu.tsx index ce04ac42..9d2581ac 100644 --- a/src/components/layout/LayerMenu.tsx +++ b/src/components/layout/LayerMenu.tsx @@ -17,15 +17,11 @@ export const LayerMenu: FC<{ {Object.entries(nav) .filter(([key]) => !["privacy", "terms"].includes(key)) .map(([key, value]) => ( -
  • +
  • setOpen(false)} to={value.route} - className="flex items-center gap-md capitalize" - > + className="flex items-center gap-md capitalize"> {key}