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

fix(leaderboard): campaign select + address explorer #22

Merged
merged 5 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion packages/dappkit
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function HistoricalClaimsLibrary(props: HistoricalClaimsLibraryPr
<Group className="flex-row w-full [&>*]:flex-grow">
{rows?.length > 0 ? (
<HistoricalClaimsTable
responsive
dividerClassName={index => (index < 2 ? "bg-accent-8" : "bg-main-8")}
header={
<Title h={5} className="!text-main-11 w-full">
Expand Down
1 change: 1 addition & 0 deletions src/components/element/leaderboard/LeaderboardLibrary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default function LeaderboardLibrary(props: LeaderboardLibraryProps) {
<Group className="flex-row w-full [&>*]:flex-grow">
{!!rows?.length ? (
<Table
responsive
dividerClassName={index => (index < 2 ? "bg-accent-8" : "bg-main-8")}
header={
<Title h={5} className="!text-main-11 w-full">
Expand Down
2 changes: 1 addition & 1 deletion src/components/element/leaderboard/LeaderboardTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const [LeaderboardTable, LeaderboardRow, LeaderboardColumns] = createTabl
},
protocol: {
name: "Via",
size: "minmax(100px,1fr)",
size: "minmax(200px,1fr)",
className: "justify-end",
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default function ClaimRewardsByOpportunity({ from, rewards }: claimReward

return (
<ClaimRewardsTableByOpportunity
responsive
className="[&>*]:bg-main-4"
look="soft"
dividerClassName={index => (index < 2 ? "bg-accent-8" : "bg-main-8")}
Expand Down
8 changes: 4 additions & 4 deletions src/components/element/user/User.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Chain } from "@merkl/api";
import { Divider, Dropdown, Group, Hash, Icon, PrimitiveTag } from "dappkit";
import { Button, Divider, Dropdown, Group, Hash, Icon, PrimitiveTag } from "dappkit";

export type UserProps = { address: string; chain: Chain };

export default function User({ address }: UserProps) {
export default function User({ address, chain }: UserProps) {
return (
<Dropdown
size="lg"
Expand All @@ -18,7 +18,7 @@ export default function User({ address }: UserProps) {
</Group>
<Divider className="border-main-6" horizontal />
{/* <Text size="xs">{token?.description}</Text> */}
{/* <Group className="flex-col" size="md">
<Group className="flex-col" size="md">
<Button to={`/users/${address}`} size="xs" look="soft">
<Icon remix="RiArrowRightLine" />
Check user claims
Expand All @@ -36,7 +36,7 @@ export default function User({ address }: UserProps) {
</Button>
);
})}
</Group> */}
</Group>
</Group>
}>
<PrimitiveTag look="soft">
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { api as clientApi } from "./../api";

type Transaction = Awaited<ReturnType<typeof clientApi.v4.interaction.transaction.get>>["data"];

// biome-ignore lint/suspicious/noExplicitAny: <explanation>
export default function useTransaction(chainId: number, payload: any, txFunctionName: "deposit" | "approve") {
const { sponsorTransactions } = useWalletContext();

Expand Down
34 changes: 22 additions & 12 deletions src/modules/interaction/components/Participate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import TokenSelect from "@core/modules/token/components/element/TokenSelect";
import { TokenService } from "@core/modules/token/token.service";
import type { Opportunity } from "@merkl/api";
import { useLocation } from "@remix-run/react";
import { Button, Group, Icon, Input, PrimitiveTag, Text, Value } from "dappkit";
import { Button, Group, Icon, Input, PrimitiveTag, Space, Text, Value } from "dappkit";
import { Box, Collapsible } from "dappkit";
import { useWalletContext } from "dappkit";
import { Fmt } from "dappkit";
Expand Down Expand Up @@ -187,30 +187,40 @@ export default function Participate({

return (
<>
{displayOpportunity && <OpportunityShortCard opportunity={opportunity} displayLinks={displayLinks} />}
{displayOpportunity && (
<>
<Space />
<OpportunityShortCard opportunity={opportunity} displayLinks={displayLinks} />
</>
)}

{displayLinks && !isOnOpportunityPage && (
<Group className="w-full py-md">
<Button to={link} look="soft" size="sm">
<>
<Space />
<Button to={link} className="mt-sm" look="soft" size="sm">
Opportunity overview <Icon remix="RiArrowRightLine" />
</Button>
</Group>
</>
)}

{!loading && !!interactor && (
<Box look="soft" className="gap-xs bg-main-5">
<Group className="flex flex-nowrap">
<Icon coloring={"warn"} remix="RiErrorWarningFill" className="text-accent-11 flex-shrink-0" />
<Text size="sm">{I18n.trad.get.pages.home.depositInformation}</Text>
</Group>
</Box>
<>
<Space />
<Box look="soft" className="gap-xs bg-main-5">
<Group className="flex flex-nowrap">
<Icon coloring={"warn"} remix="RiErrorWarningFill" className="text-accent-11 flex-shrink-0" />
<Text size="sm">{I18n.trad.get.pages.home.depositInformation}</Text>
</Group>
</Box>
</>
)}
{loading && !!merklConfig.deposit && (
<Group className="w-full justify-center">
<Group className="w-full justify-center mt-md">
<Icon remix="RiLoader2Line" className="animate-spin" />
</Group>
)}
<Collapsible state={[!!interactor, () => {}]}>{interactor}</Collapsible>

<Collapsible state={[success, () => {}]}>
<Box look="soft" className="gap-xs bg-main-5">
<Group>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Opportunity } from "@merkl/api";
import { Button, Divider, Group, Image, Modal, Text, Title } from "dappkit";
import { Button, Divider, Image, Modal, Text, Title } from "dappkit";
import type { PropsWithChildren } from "react";
import React from "react";

Expand All @@ -15,7 +15,7 @@ export default function OpportunityParticipateModal({ opportunity, children }: O
<Modal
title={<Title h={3}>SUPPLY</Title>}
modal={
<Group className="flex-col">
<div>
<Divider horizontal look="bold" className="mb-xl" />
<Participate
opportunity={opportunity}
Expand All @@ -25,7 +25,7 @@ export default function OpportunityParticipateModal({ opportunity, children }: O
hideInteractor={!merklConfig?.deposit}
/>
{merklConfig.deposit && !!merklConfig.supplyCredits && merklConfig.supplyCredits.length > 0 && (
<Text look="bold" className="flex gap-md items-center mx-auto">
<Text look="bold" className="flex mt-md gap-md items-center mx-auto">
Powered by{" "}
{merklConfig.supplyCredits.map(credit => (
<React.Fragment key={credit.id}>
Expand All @@ -37,7 +37,7 @@ export default function OpportunityParticipateModal({ opportunity, children }: O
))}
</Text>
)}
</Group>
</div>
}>
{children}
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default function OpportunityLibrary({
case "table":
return (
<OpportunityTable
responsive
exclude={["tvl"]}
opportunityHeader={
<Title className="!text-main-11" h={5}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@ export default function Index() {
<Icon className={isActive ? "text-accent-10" : "text-main-10"} remix="RiCircleFill" />
</OverrideTheme>

<PrimitiveTag look={isActive ? "bold" : "soft"}>
<PrimitiveTag size="sm" look={isActive ? "bold" : "soft"}>
{isActive && <Icon remix="RiFlashlightFill" />}
{"End "}
<Time timestamp={Number(campaign.endTimestamp) * 1000} />
</PrimitiveTag>

<Group>
<Token token={campaign.rewardToken} amount={dailyRewards(campaign)} format="amount_price" value />
</Group>
<Token token={campaign.rewardToken} amount={dailyRewards(campaign)} format="amount_price" value />
</Group>
);
return options;
Expand Down Expand Up @@ -157,15 +155,15 @@ export default function Index() {

return (
<Container>
<Box content="xl" size="md">
<Select
size="xl"
look="bold"
options={campaignsOptions}
state={[campaignId, id => setCampaignIds(id as string)]}
placeholder={!!campaignId ? "Campaign Selected" : "Please select a campaign"}
/>
</Box>
<Select
className="w-full"
size="xl"
look="tint"
options={campaignsOptions}
state={[campaignId, id => setCampaignIds(id as string)]}
placeholder={!!campaignId ? "Campaign Selected" : "Please select a campaign"}
/>

<Space size="lg" />
<Group size="lg">{metrics}</Group>
<Space size="lg" />
Expand Down