Skip to content

Commit

Permalink
Merge pull request #6 from consolelabs/fix/stake-component
Browse files Browse the repository at this point in the history
fix: stake component
  • Loading branch information
leduyhien152 authored Mar 27, 2024
2 parents 9253aad + aebbf8e commit a509a61
Show file tree
Hide file tree
Showing 14 changed files with 707 additions and 369 deletions.
35 changes: 0 additions & 35 deletions app/dwarves/earn/fixed-yield/page.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions app/dwarves/earn/flexible-yield/page.tsx

This file was deleted.

49 changes: 36 additions & 13 deletions app/dwarves/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Footer } from "@/components/footer";
import { LoginPopover } from "@/components/login-popover";
import { Logo } from "@/components/logo";
import ProfileDropdown from "@/components/profile-dropdown";
import { FixedStakeModal } from "@/components/stake/fixed/fixed-stake-modal";
import { ROUTES } from "@/constants/routes";
import {
Badge,
Expand All @@ -26,10 +27,22 @@ import { useLoginWidget } from "@mochi-web3/login-widget";
import Image from "next/image";
import Link from "next/link";
import { Suspense, useState } from "react";
import { useDisclosure } from "@dwarvesf/react-hooks";
import { FlexibleStakeModal } from "@/components/stake/flexible/flexible-stake-modal";

const Overview = () => {
const { isLoggedIn } = useLoginWidget();
const [showInfo, setShowInfo] = useState(false);
const {
isOpen: isOpenFixedStakeModal,
onOpenChange: onOpenChangeFixedStakeModal,
onOpen: onOpenFixedStakeModal,
} = useDisclosure();
const {
isOpen: isOpenFlexibleStakeModal,
onOpenChange: onOpenChangeFlexibleStakeModal,
onOpen: onOpenFlexibleStakeModal,
} = useDisclosure();

return (
<div className="overflow-y-auto h-[calc(100vh-56px)]">
Expand Down Expand Up @@ -134,11 +147,13 @@ const Overview = () => {
},
},
action: (
<Link href={ROUTES.EARN.FLEXIBLE_YIELD}>
<Button size="lg" className="w-full">
Stake
</Button>
</Link>
<Button
size="lg"
className="w-full"
onClick={onOpenFlexibleStakeModal}
>
Stake
</Button>
),
},
{
Expand All @@ -163,11 +178,13 @@ const Overview = () => {
},
},
action: (
<Link href={ROUTES.EARN.FIXED_YIELD}>
<Button size="lg" className="w-full">
Stake
</Button>
</Link>
<Button
size="lg"
className="w-full"
onClick={onOpenFixedStakeModal}
>
Stake
</Button>
),
},
{
Expand Down Expand Up @@ -371,9 +388,7 @@ const Overview = () => {
</>
),
action: (
<Link href={ROUTES.EARN.FLEXIBLE_YIELD}>
<Button>Stake tokens</Button>
</Link>
<Button onClick={onOpenFlexibleStakeModal}>Stake tokens</Button>
),
},
{
Expand Down Expand Up @@ -434,6 +449,14 @@ const Overview = () => {
))}
</div>
<Footer />
<FixedStakeModal
open={isOpenFixedStakeModal}
onOpenChange={onOpenChangeFixedStakeModal}
/>
<FlexibleStakeModal
open={isOpenFlexibleStakeModal}
onOpenChange={onOpenChangeFlexibleStakeModal}
/>
</div>
);
};
Expand Down
Loading

0 comments on commit a509a61

Please sign in to comment.