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

feat: nicer message for buy/sell if unavailable region #1787

Merged
merged 1 commit into from
Feb 6, 2025
Merged
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { XCircleIcon } from "@talismn/icons"
import { useTranslation } from "react-i18next"
import { InfoIcon } from "@talismn/icons"
import { FC, PropsWithChildren } from "react"
import { Trans, useTranslation } from "react-i18next"
import { Button, Drawer } from "talisman-ui"

type BuyTokensNotAvailableDrawerProps = {
Expand All @@ -17,13 +18,36 @@ export const BuyTokensNotAvailableDrawer = ({

return (
<Drawer anchor="bottom" isOpen={isOpen} containerId={containerId} onDismiss={onDismiss}>
<div className="bg-grey-800 flex w-full flex-col items-center gap-4 rounded-t-xl p-12">
<XCircleIcon className={"text-alert-error text-[3rem]"} />
{t("This service is not available in your region yet")}
<div className="bg-grey-800 text-body-secondary flex w-full flex-col items-center gap-4 rounded-t-xl p-12">
<InfoIcon className={"text-body mb-4 text-[3rem]"} />

<p className="text-center">
<Trans
t={t}
defaults="This service is not available in your region yet. <Link>Learn more</Link>"
components={{
Link: <LearnMoreButton />,
}}
/>
</p>

<Button className="mt-8 w-full" primary onClick={onDismiss}>
{t("Close")}
</Button>
</div>
</Drawer>
)
}

const UNSUPPORTED_REGIONS_DOCS_URL =
"https://support.ramp.network/en/articles/433-unsupported-countries-territories-and-us-states-for-buying-and-selling-crypto"

const LearnMoreButton: FC<PropsWithChildren> = ({ children }) => (
<button
type="button"
className="inline text-white underline"
onClick={() => window.open(UNSUPPORTED_REGIONS_DOCS_URL, "_blank", "noopener noreferrer")}
>
{children}
</button>
)
Loading