-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/transfer-balance
- Loading branch information
Showing
25 changed files
with
350 additions
and
95 deletions.
There are no files selected for viewing
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
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,30 @@ | ||
import { Stack } from "@namada/components"; | ||
import clsx from "clsx"; | ||
|
||
type AssetsModalCard = { | ||
title: string; | ||
icon: React.ReactNode; | ||
onClick: () => void; | ||
} & React.PropsWithChildren; | ||
|
||
export const AssetsModalCard = ({ | ||
title, | ||
icon, | ||
children, | ||
onClick, | ||
}: AssetsModalCard): JSX.Element => { | ||
return ( | ||
<Stack | ||
gap={6} | ||
onClick={onClick} | ||
className={clsx( | ||
"w-[220px] h-full items-stretch pb-8 pt-2.5 px-4 border rounded-md border-transparent transition-colors cursor-pointer", | ||
"items-center text-white text-center hover:border-yellow" | ||
)} | ||
> | ||
<h3 className="text-xl font-medium">{title}</h3> | ||
<aside className="max-w-[78px]">{icon}</aside> | ||
<div className="text-base/tight">{children}</div> | ||
</Stack> | ||
); | ||
}; |
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,46 @@ | ||
import { Modal } from "@namada/components"; | ||
import { AssetsModalCard } from "./AssetsModalCard"; | ||
import { ModalContainer } from "./ModalContainer"; | ||
|
||
type Entry = { | ||
title: string; | ||
onClick: () => void; | ||
icon: React.ReactNode; | ||
children: React.ReactNode; | ||
}; | ||
|
||
type SelectOptionModalProps = { | ||
title: string; | ||
onClose: () => void; | ||
items: Entry[]; | ||
}; | ||
|
||
export const SelectOptionModal = ({ | ||
title, | ||
onClose, | ||
items, | ||
}: SelectOptionModalProps): JSX.Element => { | ||
return ( | ||
<Modal onClose={onClose}> | ||
<ModalContainer | ||
header={title} | ||
onClose={onClose} | ||
containerProps={{ className: "!w-auto !h-auto bg-rblack" }} | ||
contentProps={{ className: "pt-0 mt-3" }} | ||
> | ||
<ul className="grid grid-cols-[1fr_1px_1fr] gap-4 pt-1"> | ||
{items.map((item, index) => ( | ||
<> | ||
<li key={index}> | ||
<AssetsModalCard {...item}>{item.children}</AssetsModalCard> | ||
</li> | ||
{index + 1 < items.length && ( | ||
<li className="w-px bg-white -my-1" /> | ||
)} | ||
</> | ||
))} | ||
</ul> | ||
</ModalContainer> | ||
</Modal> | ||
); | ||
}; |
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,45 @@ | ||
import { routes } from "App/routes"; | ||
import { wallets } from "integrations"; | ||
import { getAssetImageUrl } from "integrations/utils"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { namadaAsset } from "utils"; | ||
import { SelectOptionModal } from "./SelectOptionModal"; | ||
|
||
type ShieldAssetsModal = { | ||
onClose: () => void; | ||
}; | ||
|
||
export const ShieldAssetsModal = ({ | ||
onClose, | ||
}: ShieldAssetsModal): JSX.Element => { | ||
const navigate = useNavigate(); | ||
const goTo = (url: string): void => { | ||
navigate(url); | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<SelectOptionModal | ||
title="Shield Assets" | ||
onClose={onClose} | ||
items={[ | ||
{ | ||
title: "IBC Shield", | ||
icon: <img src={wallets.keplr.iconUrl} className="w-full" />, | ||
onClick: () => goTo(routes.ibc), | ||
children: "Shield external assets over IBC to Namada", | ||
}, | ||
{ | ||
title: "Internal Shield", | ||
icon: ( | ||
<span className="flex w-full bg-yellow rounded-md"> | ||
<img src={getAssetImageUrl(namadaAsset())} className="w-full" /> | ||
</span> | ||
), | ||
onClick: () => goTo(routes.maspShield), | ||
children: "Shield Assets from your Namada transparent account", | ||
}, | ||
]} | ||
/> | ||
); | ||
}; |
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,24 @@ | ||
import { queryClient } from "App/Common/QueryProvider"; | ||
import { getDefaultStore } from "jotai"; | ||
import { queryClientAtom } from "jotai-tanstack-query"; | ||
import { Provider as JotaiProvider } from "jotai/react"; | ||
import { useHydrateAtoms } from "jotai/utils"; | ||
|
||
type StorageProviderProps = { children: JSX.Element }; | ||
|
||
const HydrateAtoms = (props: { children: JSX.Element }): JSX.Element => { | ||
useHydrateAtoms([[queryClientAtom, queryClient]]); | ||
return props.children; | ||
}; | ||
|
||
export const defaultStore = getDefaultStore(); | ||
|
||
export const StorageProvider = ({ | ||
children, | ||
}: StorageProviderProps): JSX.Element => { | ||
return ( | ||
<JotaiProvider store={defaultStore}> | ||
<HydrateAtoms>{children}</HydrateAtoms> | ||
</JotaiProvider> | ||
); | ||
}; |
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,46 @@ | ||
import { routes } from "App/routes"; | ||
import { wallets } from "integrations"; | ||
import { getAssetImageUrl } from "integrations/utils"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { namadaAsset } from "utils"; | ||
import { SelectOptionModal } from "./SelectOptionModal"; | ||
|
||
type UnshieldAssetsModal = { | ||
onClose: () => void; | ||
}; | ||
|
||
export const UnshieldAssetsModal = ({ | ||
onClose, | ||
}: UnshieldAssetsModal): JSX.Element => { | ||
const navigate = useNavigate(); | ||
const goTo = (url: string): void => { | ||
navigate(url); | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<SelectOptionModal | ||
title="Unshield Assets" | ||
onClose={onClose} | ||
items={[ | ||
{ | ||
title: "IBC Unshield", | ||
icon: <img src={wallets.keplr.iconUrl} className="w-full" />, | ||
onClick: () => goTo(routes.ibcWithdraw), | ||
children: "Unshield assets over IBC to an IBC chain", | ||
}, | ||
{ | ||
title: "Internal Unshield", | ||
icon: ( | ||
<span className="flex w-full bg-yellow rounded-md"> | ||
<img src={getAssetImageUrl(namadaAsset())} className="w-full" /> | ||
</span> | ||
), | ||
onClick: () => goTo(routes.maspUnshield), | ||
children: | ||
"Unshield assets from your Namada shielded to transparent account", | ||
}, | ||
]} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.