-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
557 additions
and
294 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { | ||
Button, | ||
DialogBody, | ||
DialogFooter, | ||
DialogHeader, | ||
Loader, | ||
} from "@babylonlabs-io/bbn-core-ui"; | ||
import { PropsWithChildren } from "react"; | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
import { ResponsiveDialog } from "./ResponsiveDialog"; | ||
|
||
interface ConfirmationModalProps { | ||
className?: string; | ||
processing: boolean; | ||
open: boolean; | ||
title: string; | ||
onClose: () => void; | ||
onSubmit: () => void; | ||
} | ||
|
||
export const ConfirmationModal = ({ | ||
className, | ||
processing, | ||
open, | ||
title, | ||
children, | ||
onClose, | ||
onSubmit, | ||
}: PropsWithChildren<ConfirmationModalProps>) => ( | ||
<ResponsiveDialog | ||
className={twMerge("max-w-[660px]", className)} | ||
open={open} | ||
onClose={onClose} | ||
> | ||
<DialogHeader | ||
title={title} | ||
className="text-primary-dark" | ||
onClose={onClose} | ||
/> | ||
|
||
<DialogBody className="text-primary-dark">{children}</DialogBody> | ||
|
||
<DialogFooter className="flex gap-4"> | ||
<Button | ||
variant="outlined" | ||
color="primary" | ||
onClick={onClose} | ||
className="flex-1" | ||
> | ||
Cancel | ||
</Button> | ||
|
||
<Button | ||
disabled={processing} | ||
variant="contained" | ||
onClick={onSubmit} | ||
className="flex-1" | ||
> | ||
{processing ? <Loader size={16} className="text-white" /> : "Proceed"} | ||
</Button> | ||
</DialogFooter> | ||
</ResponsiveDialog> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Dialog, DialogProps, MobileDialog } from "@babylonlabs-io/bbn-core-ui"; | ||
|
||
import { useIsMobileView } from "@/app/hooks/useBreakpoint"; | ||
|
||
export function ResponsiveDialog(props: DialogProps) { | ||
const isMobileView = useIsMobileView(); | ||
const DialogComponent = isMobileView ? MobileDialog : Dialog; | ||
|
||
return <DialogComponent {...props} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Text } from "@babylonlabs-io/bbn-core-ui"; | ||
|
||
import { ConfirmationModal } from "./ConfirmationModal"; | ||
|
||
interface UnbondModalProps { | ||
processing: boolean; | ||
open: boolean; | ||
onClose: () => void; | ||
onSubmit: () => void; | ||
} | ||
|
||
export const SlashingModal = (props: UnbondModalProps) => { | ||
return ( | ||
<ConfirmationModal title="Withdraw Non-Slashed Balance" {...props}> | ||
<Text variant="body1" className="pt-8 pb-10"> | ||
The Finality Provider you delegated to has been slashed and removed from | ||
the network. You can withdraw your non-slashed balance after the | ||
timelock period ends. Slashed funds cannot be recovered. | ||
</Text> | ||
</ConfirmationModal> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { MdEditNote } from "react-icons/md"; | ||
|
||
import { SubmitModal } from "./SubmitModal"; | ||
|
||
interface StakeModalProps { | ||
processing?: boolean; | ||
open: boolean; | ||
onClose: () => void; | ||
onSubmit: () => void; | ||
} | ||
|
||
export function StakeModal({ | ||
processing, | ||
open, | ||
onClose, | ||
onSubmit, | ||
}: StakeModalProps) { | ||
return ( | ||
<SubmitModal | ||
processing={processing} | ||
open={open} | ||
icon={<MdEditNote size={52} />} | ||
title="Sign and Send to BTC" | ||
onClose={onClose} | ||
onSubmit={onSubmit} | ||
> | ||
Lorem ipsum dolor sit amet consectetur. Eget ut sagittis vitae hendrerit | ||
tempus non pellentesque. Amet enim justo vel quam pharetra sem. Id in arcu | ||
dignissim. | ||
</SubmitModal> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { | ||
Button, | ||
DialogBody, | ||
DialogFooter, | ||
Heading, | ||
Loader, | ||
Text, | ||
} from "@babylonlabs-io/bbn-core-ui"; | ||
import type { JSX, PropsWithChildren } from "react"; | ||
import { twMerge } from "tailwind-merge"; | ||
|
||
import { ResponsiveDialog } from "./ResponsiveDialog"; | ||
|
||
interface SubmitModalProps { | ||
className?: string; | ||
processing?: boolean; | ||
open: boolean; | ||
icon: JSX.Element; | ||
title: string; | ||
buttons?: { | ||
cancel?: string; | ||
submit?: string; | ||
}; | ||
onClose: () => void; | ||
onSubmit: () => void; | ||
} | ||
|
||
const DEFAULT_BUTTONS = { | ||
cancel: "Cancel", | ||
submit: "Submit", | ||
}; | ||
|
||
export const SubmitModal = ({ | ||
className, | ||
processing = false, | ||
icon, | ||
title, | ||
children, | ||
open, | ||
buttons, | ||
onClose, | ||
onSubmit, | ||
}: PropsWithChildren<SubmitModalProps>) => ( | ||
<ResponsiveDialog | ||
className={twMerge("max-w-[660px]", className)} | ||
open={open} | ||
onClose={onClose} | ||
> | ||
<DialogBody className="text-primary-dark py-16 text-center"> | ||
<div className="inline-flex bg-primary-contrast h-20 w-20 items-center justify-center mb-6"> | ||
{icon} | ||
</div> | ||
|
||
<Heading variant="h4" className="mb-4"> | ||
{title} | ||
</Heading> | ||
|
||
<Text as="div">{children}</Text> | ||
</DialogBody> | ||
|
||
<DialogFooter className="flex gap-4"> | ||
<Button variant="outlined" className="flex-1" onClick={onClose}> | ||
{buttons?.cancel ?? DEFAULT_BUTTONS.cancel} | ||
</Button> | ||
|
||
<Button | ||
disabled={processing} | ||
variant="contained" | ||
className="flex-1" | ||
onClick={onSubmit} | ||
> | ||
{processing ? ( | ||
<Loader size={16} className="text-white" /> | ||
) : ( | ||
(buttons?.submit ?? DEFAULT_BUTTONS.submit) | ||
)} | ||
</Button> | ||
</DialogFooter> | ||
</ResponsiveDialog> | ||
); |
Oops, something went wrong.