Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync merkl app to merkl lite #48

Merged
merged 42 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ef9f0ac
fix: some type errors
clmntsnr Dec 5, 2024
69eccd9
add: services model draft
clmntsnr Dec 6, 2024
910b806
change: more opportunity types
clmntsnr Dec 6, 2024
1586467
Merge remote-tracking branch 'merkl-lite/fix-errors-update-dappkit' i…
clmntsnr Dec 6, 2024
d14a6e8
fix: lint
clmntsnr Dec 6, 2024
8550018
Merge pull request #1 from AngleProtocol/sync-merkl-lite-chores
clmntsnr Dec 6, 2024
f3c7aa1
add: themes and theme switcher in dev mode (#4)
clmntsnr Dec 6, 2024
48bb14f
Tabs sync (#5)
indaviande Dec 6, 2024
6f6f09a
feat: re add CI (#6)
Picodes Dec 6, 2024
e2ce35f
Feat/leaderboard display (#7)
hugolxt Dec 9, 2024
4a37697
update: dashboard styling (#8)
clmntsnr Dec 9, 2024
473343a
add(front): modal, hero, select, tabs/tags, pagination (#9)
indaviande Dec 9, 2024
08ad823
update: opportunity campaigns/leaderboard view (#11)
clmntsnr Dec 9, 2024
33d71cf
feat: add APR modal and table components for opportunity details on h…
hugolxt Dec 10, 2024
1d89597
Feat Hero campaign and protocol (#13)
hugolxt Dec 11, 2024
1c7f143
feat(opportunity): new hero, tableRow, OpportunityFilters (#15)
indaviande Dec 11, 2024
2b5d86f
:sparkles: sum daily rewards fora protocol (#16)
hugolxt Dec 11, 2024
831344e
Fix/campaign page (#17)
hugolxt Dec 11, 2024
f768483
update: opportunities pages (#14)
clmntsnr Dec 11, 2024
2f57dcf
apr (#18)
indaviande Dec 11, 2024
d777c3f
Fix/campaign page (#20)
hugolxt Dec 13, 2024
b7f1feb
add lastSnapshot
hugolxt Dec 13, 2024
f19898d
add lastSnapshot (#21)
hugolxt Dec 13, 2024
21e1cee
Merge branch 'main' of https://github.com/AngleProtocol/merkl-app
hugolxt Dec 13, 2024
97552af
fixes: feedback, mainly opportunities & dashboard (#22)
clmntsnr Dec 13, 2024
8114fd1
add: cache on static resoruces (#23)
clmntsnr Dec 13, 2024
81ed915
Enhance opportunity data retrieval with APR and daily rewards metrics…
hugolxt Dec 13, 2024
0123bd9
fix: pagination defaulting & cache (#25)
clmntsnr Dec 13, 2024
50cd360
clean wip: comment out static sideDatas for dynamic implementation (#26)
hugolxt Dec 13, 2024
8cc70a9
fix: protocl filter (#27)
clmntsnr Dec 13, 2024
e32b466
fix: protocol desc (#28)
clmntsnr Dec 13, 2024
6e1438e
token stats + cleaning (#29)
hugolxt Dec 13, 2024
d942f68
Small APR Fix (#19)
indaviande Dec 16, 2024
39be322
Fixes on protocol, chain, token and campaign pages (#30)
hugolxt Dec 16, 2024
2d0abd2
add: depositor (#31)
clmntsnr Dec 16, 2024
d319b3f
update: dappkit (#33)
clmntsnr Dec 16, 2024
86c043e
feat(front): apr modal, layermenu, issues !!! (#32)
indaviande Dec 16, 2024
6d5358f
rename homepage to home (#34)
indaviande Dec 16, 2024
cf2ead8
feat(front): change header logo & selects (#35)
indaviande Dec 16, 2024
03337fe
fix: update Dropdown component to use onHover for APR and TVL columns…
hugolxt Dec 16, 2024
8a29459
Merge remote-tracking branch 'merkl-app/main' into sync-merkl-app
indaviande Dec 16, 2024
4ca8562
remove workflows
indaviande Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions merkl.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default createConfig({
harm: createColoring(["#d22e14", "#d22e14", "#131620"], ["#FFFFFF", "#40B66B", "white"]),
},
puffer: {
base: createColoring(["#2A35BD", "#3D3D3D", "#0E1035"], ["#2A35BD", "#F5F9FF", "#FFFFFF"]),
base: createColoring(["#2A35BD", "#BFFF38", "#FFFFFF"], ["#2A35BD", "#BFFF38", "#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"]),
Expand All @@ -85,7 +85,7 @@ export default createConfig({
hero: hero,
},
routes: {
homepage: {
home: {
icon: "RiHomeFill",
route: "/",
key: crypto.randomUUID(),
Expand All @@ -100,6 +100,22 @@ export default createConfig({
// route: "/protocols",
// key: crypto.randomUUID(),
// },
// bridge: {
// icon: "RiCompassesLine",
// route: "/bridge",
// key: crypto.randomUUID(),
// },
docs: {
icon: "RiFile4Fill",
external: true,
route: "https://docs.merkl.xyz/",
key: crypto.randomUUID(),
},
faq: {
icon: "RiQuestionFill",
route: "/faq",
key: crypto.randomUUID(),
},
// terms: {
// icon: "RiCompassesLine",
// route: "/terms",
Expand All @@ -118,6 +134,7 @@ export default createConfig({
github: "",
},
links: {
docs: "https://docs.merkl.xyz/",
merkl: "https://merkl.xyz/",
merklTermsConditions: "https://app.merkl.xyz/merklTerms.pdf",
merklPrivacy: "https://privacy.angle.money",
Expand Down
2 changes: 1 addition & 1 deletion packages/dappkit
Submodule dappkit updated 58 files
+0 −25 .github/workflows/build.yml
+28 −0 .github/workflows/code_quality.yml
+1 −1 README.md
+76 −0 biome.json
+ bun.lockb
+6 −2 package.json
+4 −0 src/assets/walletCoinbase.svg
+20 −0 src/assets/walletConnect.svg
+4 −0 src/components.ts
+18 −0 src/components/dapp/Connected.tsx
+1 −1 src/components/dapp/Countdown.tsx
+3 −5 src/components/dapp/TransactionButton.tsx
+1 −1 src/components/dapp/TransactionHelper.tsx
+24 −56 src/components/dapp/WalletButton.tsx
+45 −14 src/components/dapp/WalletConnectors.tsx
+2 −2 src/components/extenders/Card.tsx
+1 −0 src/components/extenders/Dropdown.tsx
+1 −1 src/components/extenders/Group.tsx
+6 −14 src/components/extenders/Icons.tsx
+7 −37 src/components/extenders/Modal.tsx
+61 −92 src/components/extenders/Select.tsx
+3 −3 src/components/primitives/Accordion.tsx
+25 −1 src/components/primitives/Box.tsx
+11 −23 src/components/primitives/Button.tsx
+15 −7 src/components/primitives/Checkbox.tsx
+3 −5 src/components/primitives/Divider.tsx
+0 −4 src/components/primitives/EventBlocker.tsx
+2 −4 src/components/primitives/Hash.tsx
+24 −28 src/components/primitives/Icon.tsx
+3 −2 src/components/primitives/Image.tsx
+25 −47 src/components/primitives/Input.tsx
+26 −6 src/components/primitives/List.tsx
+5 −2 src/components/primitives/PrimitiveTag.tsx
+1 −1 src/components/primitives/Scroll.tsx
+1 −1 src/components/primitives/Slider.tsx
+2 −2 src/components/primitives/Space.tsx
+39 −78 src/components/primitives/Table.tsx
+185 −0 src/components/primitives/Tabs.tsx
+7 −7 src/components/primitives/Text.tsx
+9 −8 src/components/primitives/Time.tsx
+16 −9 src/components/primitives/Title.tsx
+3 −3 src/components/primitives/Tooltip.tsx
+3 −3 src/components/primitives/Value.tsx
+8 −7 src/context/Dapp.context.tsx
+4 −4 src/context/Theme.context.tsx
+8 −5 src/context/Wallet.context.tsx
+22 −0 src/hooks/events/useOverflowing.tsx
+1 −1 src/hooks/events/useShortcut.tsx
+1 −1 src/hooks/theming/useThemedVariables.tsx
+6 −9 src/hooks/useClipboard.tsx
+6 −8 src/hooks/useWalletState.tsx
+106 −1 src/utils/css.ts
+1 −0 src/utils/event.ts
+0 −14 src/utils/format.ts
+42 −0 src/utils/formatter.service.ts
+10 −2 src/utils/tailwind.ts
+1 −2 src/utils/types.ts
+28 −0 tsconfig.json
29 changes: 15 additions & 14 deletions src/components/element/apr/AprModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Opportunity } from "@merkl/api";
import { Group, PrimitiveTag, Title, Value } from "packages/dappkit/src";
import { Divider, Group, PrimitiveTag, Title, Value } from "dappkit";
import TvlRowAllocation from "../tvl/TvlRowAllocation";
import TvlSection from "../tvl/TvlSection";
import AprSection from "./AprSection";
Expand All @@ -12,22 +12,23 @@ export default function AprModal(props: IProps) {
const { opportunity } = props;

return (
<>
<Group className="flex-col -my-md">
<Group className="justify-between items-center">
<Title look="soft" h={5}>
AVERAGE APR
</Title>
<PrimitiveTag noClick look="bold" size="lg">
<Value value format="0a%">
{opportunity.apr / 100}
</Value>
</PrimitiveTag>
</Group>
<Group className="flex-col -my-md">
<Group className="justify-between items-center">
<Title look="soft" h={5}>
AVERAGE APR
</Title>
<PrimitiveTag noClick look="tint" size="lg">
<Value value format="0a%">
{opportunity.apr / 100}
</Value>
</PrimitiveTag>
</Group>
<Divider look="hype" className="-mx-xl w-[calc(100%+2*var(--spacing-xl))]" />
<Group className="flex-col" size="lg">
<TvlRowAllocation opportunity={opportunity} />
<AprSection opportunity={opportunity} />
<TvlSection opportunity={opportunity} />
</Group>
</>
</Group>
);
}
50 changes: 26 additions & 24 deletions src/components/element/apr/AprSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Opportunity } from "@merkl/api";
import { Divider, Group, Hash, PrimitiveTag, Text, Value } from "packages/dappkit/src";
import { Fragment, useMemo } from "react";
import { Divider, Group, Hash, Icon, PrimitiveTag, Text, Value } from "packages/dappkit/src";
import { useMemo } from "react";

type AprSectionProps = {
opportunity: Opportunity;
Expand All @@ -17,10 +17,10 @@ export default function AprSection({ opportunity }: AprSectionProps) {
switch (breakdown?.type) {
case "CAMPAIGN":
return (
<Group>
<Group className="items-center">
Campaign
<PrimitiveTag look="soft" size="xs">
<Hash size="sm" format="short" copy className="text-main-12">
<Hash size="xs" format="short" copy className="text-main-12">
{breakdown.identifier}
</Hash>
</PrimitiveTag>
Expand All @@ -30,7 +30,7 @@ export default function AprSection({ opportunity }: AprSectionProps) {
return (
<Group>
{breakdown.identifier.split(" ")[0]}
<Hash format="short" copy>
<Hash format="short" copy size="xs">
{breakdown.identifier.split(" ")[1]}
</Hash>
</Group>
Expand All @@ -39,35 +39,37 @@ export default function AprSection({ opportunity }: AprSectionProps) {
return breakdown.identifier;
default:
return (
<Hash format="short" copy>
<Hash format="short" size="xs" copy>
{breakdown.identifier}
</Hash>
);
}
};

return (
<>
<Divider className="-mx-xl w-[calc(100%+2*var(--spacing-xl))]" />
<Text size="sm">APR details</Text>
<Divider className="-mx-xl w-[calc(100%+2*var(--spacing-xl))]" />
<Group className="flex-col mt-md">
<Group className="items-center" size="sm">
<Icon className="text-main-11" remix="RiFileList3Line" />
<Text size="sm" bold>
APR details
</Text>
</Group>

<Divider />
<Group className="flex-col">
{breakdowns.map(breakdown => (
<Fragment key={breakdown.id}>
<Group className="items-center justify-between" size="sm">
<Text size="sm" look="bold">
{getAprName(breakdown)}
</Text>
<PrimitiveTag noClick look="bold" size="sm">
<Value value format="0a%">
{breakdown.value / 100}
</Value>
</PrimitiveTag>
</Group>
<Divider className="last:hidden" look="tint" />
</Fragment>
<Group key={breakdown.id} className="items-center justify-between" size="sm">
<Text size="sm" look="bold">
{getAprName(breakdown)}
</Text>
<PrimitiveTag noClick look="bold" size="sm">
<Value value format="0a%">
{breakdown.value / 100}
</Value>
</PrimitiveTag>
</Group>
))}
</Group>
</>
</Group>
);
}
6 changes: 3 additions & 3 deletions src/components/element/opportunity/OpportunityFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@ export default function OpportunityFilters({ only, protocols, exclude, chains }:
)}
{((canApply && !clearing && navigation.state === "idle") ||
(applying && !clearing && navigation.state === "loading")) && (
<Button onClick={onApplyFilters} look="hype">
<Button onClick={onApplyFilters} look="bold">
Apply
{navigation.state === "loading" ? (
<Icon className="animate-spin" remix="RiLoader2Line" />
) : (
<Icon remix="RiArrowRightUpLine" />
<Icon remix="RiArrowRightLine" />
)}
Apply
</Button>
)}
<Button onClick={onClearFilters} look="soft">
Expand Down
6 changes: 3 additions & 3 deletions src/components/element/opportunity/OpportunityTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ export const [OpportunityTable, OpportunityRow, opportunityColumns] = createTabl
name: "APR",
size: "minmax(min-content,150px)",
compactSize: "minmax(min-content,1fr)",
className: "justify-center",
className: "md:justify-center",
},
tvl: {
name: "TVL",
size: "minmax(min-content,150px)",
compactSize: "minmax(min-content,1fr)",
className: "justify-center",
className: "md:justify-center",
},
rewards: {
name: "Daily rewards",
size: "minmax(min-content,150px)",
compactSize: "minmax(min-content,1fr)",
className: "justify-center",
className: "md:justify-center",
},
});
6 changes: 3 additions & 3 deletions src/components/element/opportunity/OpportunityTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export default function OpportunityTableRow({ hideTags, opportunity, className,
<OpportunityRow
size="lg"
content="sm"
className={mergeClass("dim", className)}
className={mergeClass("cursor-pointer", className)}
{...props}
aprColumn={
<Dropdown size="xl" content={<AprModal opportunity={opportunity} />}>
<Dropdown size="xl" onHover content={<AprModal opportunity={opportunity} />}>
<PrimitiveTag look="tint" size="lg">
<Value value format="0a%">
{opportunity.apr / 100}
Expand All @@ -37,7 +37,7 @@ export default function OpportunityTableRow({ hideTags, opportunity, className,
</Dropdown>
}
tvlColumn={
<Dropdown size="xl" content={<AprModal opportunity={opportunity} />}>
<Dropdown size="xl" onHover content={<AprModal opportunity={opportunity} />}>
<PrimitiveTag look="base" className="font-mono">
<Value value format="$0,0.0a">
{opportunity.tvl ?? 0}
Expand Down
3 changes: 0 additions & 3 deletions src/components/element/participate/Participate.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ export default function Participate({ opportunity }: ParticipateProps) {
const [amount, setAmount] = useState<bigint>(0n);
const {
target,
targets,
balance,
token: inputToken,
approve,
deposit,
transaction,
} = useParticipate(opportunity.chainId, opportunity.protocol?.id, opportunity.identifier, tokenAddress, amount);

Expand Down
35 changes: 22 additions & 13 deletions src/components/element/tvl/TvlRowAllocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ export default function TvlRowAllocation({ opportunity }: IProps) {
<Group className="flex-col" size="sm">
<Group className="items-center" size="sm">
<Icon src={opportunity.tokens[0].icon} />
<Value value format="0.0a">
{tvlBreakdownToken0?.value}
</Value>
<Text size="sm" look="bold">
<Text size="sm" look="bold" bold>
<Value value format="0.0a">
{tvlBreakdownToken0?.value}
</Value>
</Text>
<Text size="sm" look="bold" bold>
{token0.name}
</Text>

Expand All @@ -41,10 +43,12 @@ export default function TvlRowAllocation({ opportunity }: IProps) {
</Group>
<Group className="items-center" size="sm">
<Icon src={opportunity.tokens[1].icon} />
<Value value format="0.0a">
{tvlBreakdownToken1?.value}
</Value>
<Text size="sm" look="bold">
<Text size="sm" look="bold" bold>
<Value value format="0.0a">
{tvlBreakdownToken1?.value}
</Value>
</Text>
<Text size="sm" look="bold" bold>
{token1.name}
</Text>

Expand All @@ -70,11 +74,16 @@ export default function TvlRowAllocation({ opportunity }: IProps) {
}
if (!content) return null;
return (
<>
<Divider className="-mx-xl w-[calc(100%+2*var(--spacing-xl))]" />
<Text size="sm">TVL allocation</Text>
<Divider className="-mx-xl w-[calc(100%+2*var(--spacing-xl))]" />
<Group className="flex-col">
<Group className="items-center" size="sm">
<Icon className="text-main-11" remix="RiContractRightFill" />
<Text size="sm" bold>
TVL allocation
</Text>
</Group>

<Divider />
{content}
</>
</Group>
);
}
40 changes: 25 additions & 15 deletions src/components/element/tvl/TvlSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@ export default function TvlSection({ opportunity }: TvlSectionProps) {
<Text look="bold" size="sm">
{breakdown.identifier.split(" ")[0]}
</Text>
<Hash format="short" copy size="sm">
{breakdown.identifier.split(" ")[1]}
</Hash>
<PrimitiveTag look="soft" size="xs">
<Hash format="short" look="bold" copy size="xs">
{breakdown.identifier.split(" ")[1]}
</Hash>
</PrimitiveTag>
</Group>
);
default:
return (
<Hash format="short" copy>
{breakdown.identifier}
</Hash>
<PrimitiveTag look="soft" size="xs">
<Hash format="short" look="bold" copy>
{breakdown.identifier}
</Hash>
</PrimitiveTag>
);
}
};
Expand All @@ -52,21 +56,25 @@ export default function TvlSection({ opportunity }: TvlSectionProps) {
<>
{hasForwarders && (
<>
<Divider className="-mx-xl w-[calc(100%+2*var(--spacing-xl))]" />
<Group
className="grid"
className="grid mt-md"
style={{
gridTemplateColumns: "minmax(350px, 1fr) minmax(min-content, 100px) minmax(min-content, 100px)",
}}>
<Text size="sm">Forwarder details</Text>
<Group className="items-center" size="sm">
<Icon className="text-main-11" remix="RiForwardEndFill" />
<Text size="sm" bold>
Forwarder details
</Text>
</Group>
<Text size="sm" className="inline-flex justify-end">
APR
</Text>
<Text size="sm" className="inline-flex justify-end">
TVL
</Text>
</Group>
<Divider className="-mx-xl w-[calc(100%+2*var(--spacing-xl))]" />
<Divider />
</>
)}
<Group className="flex-col" size="sm">
Expand Down Expand Up @@ -97,17 +105,19 @@ export default function TvlSection({ opportunity }: TvlSectionProps) {
</Value>
</Text>
</Group>
<Divider className="last:hidden" look="tint" />
</Fragment>
);
})}
</Group>

{tvlFiltered.length >= DEFAULT_ARRAY_SIZE && (
<Button size="sm" className="mx-auto my-sm" look="soft" onClick={() => setIsShowingMore(!isShowingMore)}>
Show {isShowingMore ? "Less" : "More"}
<Icon remix={isShowingMore ? "RiArrowUpLine" : "RiArrowDownLine"} />
</Button>
<>
<Divider look="soft" />
<Button size="sm" className="mx-auto my-sm" look="soft" onClick={() => setIsShowingMore(!isShowingMore)}>
Show {isShowingMore ? "Less" : "More"}
<Icon remix={isShowingMore ? "RiArrowUpLine" : "RiArrowDownLine"} />
</Button>
</>
)}
</>
);
Expand Down
Loading
Loading