From 286d9feeaa541c07781066458a983b3f744da49e Mon Sep 17 00:00:00 2001 From: sheykei <47207681+clmntsnr@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:49:28 +0100 Subject: [PATCH] update: merkl-app (#7) * Sync Merkl-app (#55) * Sync Merkl-app * lint * Sync/rebased (#57) * Fork rebasing * chore: update @merkl/api version and refactor various components and services * Puffer Branding (#3) * chore: update app * fix: lint * Merge remote-tracking branch 'merkl-app/main' (#4) * Merge remote-tracking branch 'merkl-app/main' * update dappkit * lint * update config for puffer (#5) * clean hero * update: config * revert * restore --------- Co-authored-by: hugolxt <87241914+hugolxt@users.noreply.github.com> Co-authored-by: Viande <33333630+indaviande@users.noreply.github.com> Co-authored-by: picodes --- .vscode/settings.json | 1 - merkl.config.ts | 55 +++--- package.json | 2 +- src/api/services/reward.service.ts | 7 +- src/api/services/zyfi.service.ts | 4 +- src/assets/images/etherscan.svg | 11 ++ src/components/composite/Hero.tsx | 174 ++++++++++-------- .../composite/LiFiWidget.client.tsx | 2 +- .../element/campaign/CampaignTableRow.tsx | 4 +- .../HistoricalClaimsRow.tsx | 5 +- .../leaderboard/LeaderboardLibrary.tsx | 2 +- .../leaderboard/LeaderboardTableRow.tsx | 6 +- .../element/opportunity/OpportunityButton.tsx | 2 +- .../opportunity/OpportunityFilters.tsx | 154 ++++++++-------- .../opportunity/OpportunityLibrary.tsx | 8 +- .../opportunity/OpportunityShortCard.tsx | 6 +- .../element/opportunity/OpportunityTable.tsx | 30 ++- .../opportunity/OpportunityTableRow.tsx | 9 +- .../element/participate/Participate.tsx | 15 +- .../element/protocol/ProtocolCell.tsx | 6 +- .../element/protocol/ProtocolLibrary.tsx | 2 +- .../rewards/ClaimRewardsChainTableRow.tsx | 1 + src/components/layout/Header.tsx | 9 +- src/config/type.ts | 25 ++- src/hooks/resources/useOpportunity.tsx | 2 +- src/hooks/resources/useReward.tsx | 2 +- src/routes/_merkl.(home).tsx | 2 +- src/routes/_merkl.chains.(all).tsx | 13 +- ...rtunities.$chain.$type.$id.leaderboard.tsx | 12 +- .../_merkl.opportunities.$chain.$type.$id.tsx | 4 +- src/routes/_merkl.tokens.(all).tsx | 13 +- src/routes/_merkl.users.$address.claims.tsx | 3 +- .../_merkl.users.$address.liquidity.tsx | 29 +++ src/routes/_merkl.users.$address.tsx | 39 +++- src/routes/_merkl.users.(none).tsx | 2 +- src/routes/claim.$address.tsx | 6 + 36 files changed, 395 insertions(+), 272 deletions(-) create mode 100644 src/assets/images/etherscan.svg create mode 100644 src/routes/_merkl.users.$address.liquidity.tsx create mode 100644 src/routes/claim.$address.tsx diff --git a/.vscode/settings.json b/.vscode/settings.json index 214a785c..1310dfcf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,6 @@ "[javascript]": { "editor.defaultFormatter": "biomejs.biome" }, - "editor.formatOnSave": true, "editor.formatOnType": false, "editor.foldingImportsByDefault": true, "editor.foldingHighlight": true, diff --git a/merkl.config.ts b/merkl.config.ts index fc11174a..50ec4064 100644 --- a/merkl.config.ts +++ b/merkl.config.ts @@ -56,8 +56,24 @@ export default createConfig({ opportunityLibraryDefaultView: "table", // opportunityLibraryExcludeFilters: ["protocol","action"], opprtunityPercentage: true, - hideLayerMenuHomePage: false, + opportunityLibrary: { + defaultView: "table", + views: ["table"], // If you want only one view, this is where you can specify it. + cells: { + hideTags: ["token", "action"], + }, + excludeFilters: ["protocol", "tvl"], + }, supplyCredits: [], + hero: { + bannerOnAllPages: false, // show banner on all pages + invertColors: true, // Light mode: light text on dark background (instead of dark text on light background) + }, + opportunityFilters: { + minimumTVL: false, + protocols: false, + displaySelector: false, + }, walletOptions: { hideInjectedWallets: ["phantom", "coinbase wallet"], sponsorTransactions: true, @@ -71,6 +87,13 @@ export default createConfig({ enabled: false, length: 6, }, + library: { + columns: { + action: { + enabled: true, + }, + }, + }, }, bridge: { helperLink: "", @@ -91,27 +114,6 @@ export default createConfig({ dollar: "$0,0.##a", }, themes: { - ignite: { - base: createColoring(["#2A35BD", "#BFFF37", "#FFFFFF"], ["#2A35BD", "#BFFF37", "#FFFFFF"]), - info: createColoring(["#2ABDFF", "#2ABDFF", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - good: createColoring(["#40B66B", "#40B66B", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - warn: createColoring(["#ff9600", "#ff9600", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - harm: createColoring(["#d22e14", "#d22e14", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - }, - merkl: { - base: createColoring(["#1755F4", "#FF7900", "#0D1530"], ["#1755F4", "#FF7900", "#FFFFFF"]), - info: createColoring(["#2ABDFF", "#2ABDFF", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - good: createColoring(["#40B66B", "#40B66B", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - warn: createColoring(["#ff9600", "#ff9600", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - harm: createColoring(["#d22e14", "#d22e14", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - }, - backoffice: { - base: createColoring(["#8B8D98", "#9984D2", "#000000"], ["#8B8D98", "#9984D2", "#FFFFFF"]), - info: createColoring(["#2ABDFF", "#2ABDFF", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - good: createColoring(["#40B66B", "#40B66B", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - warn: createColoring(["#ff9600", "#ff9600", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - harm: createColoring(["#d22e14", "#d22e14", "#131620"], ["#FFFFFF", "#40B66B", "white"]), - }, puffer: { base: createColoring(["#2A35BD", "#BFFF37", "#FFFFFF"], ["#2A35BD", "#BFFF37", "#FFFFFF"]), info: createColoring(["#2ABDFF", "#2ABDFF", "#131620"], ["#FFFFFF", "#40B66B", "white"]), @@ -146,11 +148,6 @@ export default createConfig({ route: "/protocols", key: crypto.randomUUID(), }, - bridge: { - icon: "RiCompassesLine", - route: "/bridge", - key: crypto.randomUUID(), - }, docs: { icon: "RiFile4Fill", external: true, @@ -181,7 +178,7 @@ export default createConfig({ enabled: false, }, bridge: { - enabled: false, + enabled: true, }, }, socials: { @@ -256,4 +253,4 @@ export default createConfig({ }), ], }, -}); +}); \ No newline at end of file diff --git a/package.json b/package.json index bb84b090..ab95e4e9 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@elysiajs/eden": "^1.1.3", "@emotion/css": "^11.13.4", "@lifi/widget": "^3.13.1", - "@merkl/api": "0.10.262", + "@merkl/api": "0.10.277", "@radix-ui/react-accordion": "^1.2.1", "@radix-ui/react-scroll-area": "^1.2.0", "@remix-run/dev": "^2.11.2", diff --git a/src/api/services/reward.service.ts b/src/api/services/reward.service.ts index 791dccdf..bc358917 100644 --- a/src/api/services/reward.service.ts +++ b/src/api/services/reward.service.ts @@ -45,11 +45,14 @@ export abstract class RewardService { return query; } - static async getForUser(request: Request, address: string, chainId: number) { + static async getForUser(request: Request, address: string) { const url = new URL(request.url); + const chainIds = config.chains?.map(({ id }) => id).join(","); + + // biome-ignore lint/suspicious/noExplicitAny: TODO const query: Record = { - chainId: chainId.toString(), + chainId: url.searchParams.get("chainId") ?? undefined, test: config.alwaysShowTestTokens ? true : (url.searchParams.get("test") ?? false), }; if (chainIds) query.chainIds = chainIds; diff --git a/src/api/services/zyfi.service.ts b/src/api/services/zyfi.service.ts index 302bab32..6d0532ae 100644 --- a/src/api/services/zyfi.service.ts +++ b/src/api/services/zyfi.service.ts @@ -102,9 +102,11 @@ export abstract class ZyfiService { value, }); + if (!check.txData) return null; + return { account: from, - to: check.txData.to, + to: check.txData?.to, value: BigInt(check.txData.value!), chain: zksync, gas: BigInt(check.txData.gasLimit), diff --git a/src/assets/images/etherscan.svg b/src/assets/images/etherscan.svg new file mode 100644 index 00000000..b57d6585 --- /dev/null +++ b/src/assets/images/etherscan.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/components/composite/Hero.tsx b/src/components/composite/Hero.tsx index 3ab49d78..db44882d 100644 --- a/src/components/composite/Hero.tsx +++ b/src/components/composite/Hero.tsx @@ -1,5 +1,18 @@ import { useLocation } from "@remix-run/react"; -import { Container, Divider, Group, Icon, type IconProps, Icons, Tabs, Text, Title, Value } from "dappkit"; +import { + Container, + Divider, + Group, + Icon, + type IconProps, + Icons, + OverrideTheme, + Tabs, + Text, + Title, + Value, + useTheme, +} from "dappkit"; import { Button } from "dappkit"; import config from "merkl.config"; import type { PropsWithChildren, ReactNode } from "react"; @@ -34,90 +47,99 @@ export default function Hero({ children, }: HeroProps) { const location = useLocation(); + const { mode } = useTheme(); + return ( <> - + - - - - - {breadcrumbs?.map(breadcrumb => { - if (breadcrumb.component) return <>{breadcrumb.component}; - return ( - - ); - })} - - - - - {!!icons && ( - - {icons?.length > 1 - ? icons?.map(icon => ( - - )) - : icons?.map(icon => ( - - ))} - + : location?.pathname === "/" || location?.pathname === "/opportunities" + ? `url('${config.images.hero}')` + : "none", + }}> + + + + + {breadcrumbs?.map(breadcrumb => { + if (breadcrumb.component) return <>{breadcrumb.component}; + return ( + + ); + })} + + + + + {!!icons && ( + + {icons?.length > 1 + ? icons?.map(icon => ( + + )) + : icons?.map(icon => ( + + ))} + + )} + + {title} + + + + {!!description && ( + <> + + + {description} + + )} - - {title} - + {!!tags && {tags}} + {!!sideDatas && ( + + {sideDatas.map(data => ( + + + {data.data} + - {!!description && ( - <> - - - {description} - - + + {data.label} + + + ))} + )} - {!!tags && {tags}} - {!!sideDatas && ( - - {sideDatas.map(data => ( - - - {data.data} - - - - {data.label} - - - ))} - - )} - - - + + + {!!tabs?.length && } diff --git a/src/components/composite/LiFiWidget.client.tsx b/src/components/composite/LiFiWidget.client.tsx index a11e6d92..b0a79ede 100644 --- a/src/components/composite/LiFiWidget.client.tsx +++ b/src/components/composite/LiFiWidget.client.tsx @@ -58,5 +58,5 @@ const LiFiWidgetLazy = lazy(async () => { }); export function LiFiWidget() { - return ; + return ; } diff --git a/src/components/element/campaign/CampaignTableRow.tsx b/src/components/element/campaign/CampaignTableRow.tsx index 991040c3..8da31a07 100644 --- a/src/components/element/campaign/CampaignTableRow.tsx +++ b/src/components/element/campaign/CampaignTableRow.tsx @@ -8,6 +8,7 @@ import { Group, Hash, Icon, + Image, OverrideTheme, PrimitiveTag, Space, @@ -20,6 +21,7 @@ import Time from "packages/dappkit/src/components/primitives/Time"; import Tooltip from "packages/dappkit/src/components/primitives/Tooltip"; import { type ReactNode, useCallback, useMemo, useState } from "react"; import type { Opportunity } from "src/api/services/opportunity/opportunity.model"; +import EtherScan from "src/assets/images/etherscan.svg"; import useCampaign from "src/hooks/resources/useCampaign"; import { v4 as uuidv4 } from "uuid"; import Tag from "../Tag"; @@ -78,7 +80,7 @@ export default function CampaignTableRow({ {campaign.creatorAddress} , ], diff --git a/src/components/element/historicalClaimsLibrary/HistoricalClaimsRow.tsx b/src/components/element/historicalClaimsLibrary/HistoricalClaimsRow.tsx index 006eed68..3fa15217 100644 --- a/src/components/element/historicalClaimsLibrary/HistoricalClaimsRow.tsx +++ b/src/components/element/historicalClaimsLibrary/HistoricalClaimsRow.tsx @@ -3,7 +3,6 @@ import Time from "packages/dappkit/src/components/primitives/Time"; import { useWalletContext } from "packages/dappkit/src/context/Wallet.context"; import { useMemo } from "react"; import type { ClaimsService } from "src/api/services/claims.service"; -import { parseUnits } from "viem"; import Chain from "../chain/Chain"; import Token from "../token/Token"; import { HistoricalClaimsRow } from "./HistoricalClaimsTable"; @@ -17,8 +16,6 @@ export default function HistoricalClaimsTableRow({ claim, className, ...props }: const chain = useMemo(() => chains?.find(c => c.id === claim?.token?.chainId), [chains, claim]); - const claimedAmount = useMemo(() => parseUnits(claim?.amount ?? 0, claim.token.decimals), [claim]); - return ( } tokenColumn={ !!claim?.token && ( - + ) } dateColumn={