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: custom mandatory domain popup #293

Merged
merged 2 commits into from
Oct 29, 2023
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
32 changes: 22 additions & 10 deletions pages/quest/[questPage].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import useHasRootDomain from "../../hooks/useHasRootDomain";
import { useAccount } from "@starknet-react/core";
import { starknetIdAppLink } from "../../utils/links";
import BannerPopup from "../../components/UI/menus/bannerPopup";
import { useDomainFromAddress } from "../../hooks/naming";

const QuestPage: NextPage = () => {
const router = useRouter();
Expand Down Expand Up @@ -44,6 +45,7 @@ const QuestPage: NextPage = () => {
const { address } = useAccount();
const [showDomainPopup, setShowDomainPopup] = useState<boolean>(false);
const hasRootDomain = useHasRootDomain(quest.mandatory_domain, address);
const { domain } = useDomainFromAddress(address);

// this fetches quest data
useEffect(() => {
Expand All @@ -70,16 +72,26 @@ const QuestPage: NextPage = () => {
/>
) : (
<div className={homeStyles.screen}>
{showDomainPopup && (
<BannerPopup
title="Mandatory Starknet Domain"
banner="/visuals/profile.webp"
description="To access Starknet Quest, you must own a Starknet domain. It's your passport to the Starknet ecosystem. Get yours now."
buttonName="Get a Starknet Domain"
onClick={() => window.open(starknetIdAppLink)}
onClose={() => setShowDomainPopup(false)}
/>
)}
{showDomainPopup &&
(domain ? (
<BannerPopup
title="Subdomains are not allowed"
banner="/visuals/profile.webp"
description="To access Starknet Quest you need a Root Starknet domain (not a subdomain like .braavos.stark or .xplorer.stark)."
buttonName="Get a Starknet Domain"
onClick={() => window.open(starknetIdAppLink)}
onClose={() => setShowDomainPopup(false)}
/>
) : (
<BannerPopup
title="Mandatory Starknet Domain"
banner="/visuals/profile.webp"
description="To access Starknet Quest, you must own a Starknet domain. It's your passport to the Starknet ecosystem. Get yours now."
buttonName="Get a Starknet Domain"
onClick={() => window.open(starknetIdAppLink)}
onClose={() => setShowDomainPopup(false)}
/>
))}
<div className={homeStyles.backButton}>
<BackButton onClick={() => router.back()} />
</div>
Expand Down