-
Notifications
You must be signed in to change notification settings - Fork 5
feat(console): encourage users to move to Ar.io Console #973
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8fd15c1
docs(claude): document ACL drift, query invalidation, CI gaps and e2e…
vilenarios 1ba35e1
feat(console): encourage users to move to Ar.io Console
vilenarios 356e7fc
fix(console): close popup on suppressed routes and focus it on open
vilenarios e4dd691
docs(claude): note that Playwright and Jest don't gate PRs
vilenarios b9b2dd7
feat(console): tell users their names come with them
vilenarios e798ec5
feat(console): say "building on Ar.io" in the popup copy
vilenarios File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
141 changes: 141 additions & 0 deletions
141
src/components/modals/ConsoleMigrationModal/ConsoleMigrationModal.tsx
This file contains hidden or 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,141 @@ | ||
| import { | ||
| CONSOLE_MIGRATION_NOTICE_KEY, | ||
| getConsoleLink, | ||
| } from '@src/utils/constants'; | ||
| import { ExternalLinkIcon, XIcon } from 'lucide-react'; | ||
| import { Dialog } from 'radix-ui'; | ||
| import { useEffect, useState } from 'react'; | ||
| import { useLocation } from 'react-router-dom'; | ||
|
|
||
| // Routes where a popup would interrupt a purchase or on-chain action. The | ||
| // top banner still shows there; the popup waits until the user lands on a | ||
| // browsing page. | ||
| const SUPPRESSED_ROUTES = [ | ||
| /^\/transaction/, | ||
| /^\/register\//, | ||
| /^\/checkout/, | ||
| /^\/connect/, | ||
| /^\/manage\/names\/[^/]+\/(extend|upgrade-undernames)/, | ||
| ]; | ||
|
|
||
| // localStorage can throw (private mode, blocked site data). Failing open | ||
| // means the popup may show again, which is better than breaking the page. | ||
| function isDismissed(): boolean { | ||
| try { | ||
| return localStorage.getItem(CONSOLE_MIGRATION_NOTICE_KEY) !== null; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| function markDismissed() { | ||
| try { | ||
| localStorage.setItem(CONSOLE_MIGRATION_NOTICE_KEY, `${Date.now()}`); | ||
| } catch { | ||
| // ignore — see isDismissed | ||
| } | ||
| } | ||
|
|
||
| const CONSOLE_FEATURES = [ | ||
| 'Search, buy, and manage ArNS names', | ||
| 'Upload files to Arweave', | ||
| 'Deploy pages and websites', | ||
| ]; | ||
|
|
||
| function ConsoleMigrationModal() { | ||
| const { pathname } = useLocation(); | ||
| const [open, setOpen] = useState(false); | ||
|
|
||
| useEffect(() => { | ||
| if (isDismissed()) return; | ||
| // Close without recording a dismissal (e.g. Back button into checkout), | ||
| // so the popup can return on the next browsing page. | ||
| if (SUPPRESSED_ROUTES.some((route) => route.test(pathname))) { | ||
| setOpen(false); | ||
| return; | ||
| } | ||
| setOpen(true); | ||
| }, [pathname]); | ||
|
|
||
| function handleOpenChange(next: boolean) { | ||
| if (!next) markDismissed(); | ||
| setOpen(next); | ||
| } | ||
|
|
||
| return ( | ||
| <Dialog.Root open={open} onOpenChange={handleOpenChange}> | ||
| <Dialog.Portal> | ||
| {/* z-[2100] sits above antd notifications (2050) so error toasts | ||
| can't cover the buttons on small screens. */} | ||
| <Dialog.Overlay className="fixed inset-0 z-[2100] bg-black/60 backdrop-blur-[2px]" /> | ||
| <Dialog.Content | ||
| data-testid="console-migration-modal" | ||
| // Focus the dialog itself rather than Radix's default (the close | ||
| // button), which would paint a focus ring before any interaction. | ||
| onOpenAutoFocus={(e) => { | ||
| e.preventDefault(); | ||
| (e.currentTarget as HTMLElement).focus(); | ||
| }} | ||
| className="fixed left-1/2 top-1/2 z-[2100] flex max-h-[calc(100dvh-32px)] w-[calc(100%-32px)] max-w-[440px] -translate-x-1/2 -translate-y-1/2 flex-col gap-5 overflow-y-auto rounded-lg outline-none border border-dark-grey bg-metallic-grey p-6 text-white shadow-one sm:p-8" | ||
| > | ||
| <Dialog.Close | ||
| aria-label="Close" | ||
| className="absolute right-4 top-4 rounded p-1 text-grey transition-colors hover:text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary" | ||
| > | ||
| <XIcon size={20} /> | ||
| </Dialog.Close> | ||
|
|
||
| <div className="flex flex-col gap-2 pr-6"> | ||
| <span className="text-xs font-medium uppercase tracking-wider text-primary"> | ||
| New home for ArNS | ||
| </span> | ||
| <Dialog.Title className="text-xl font-bold leading-snug sm:text-2xl"> | ||
| Try Ar.io Console | ||
| </Dialog.Title> | ||
| </div> | ||
|
|
||
| <Dialog.Description className="text-sm leading-relaxed text-light-grey"> | ||
| Everything you do here now lives in Ar.io Console, along with more | ||
| tools for building on Ar.io. | ||
| </Dialog.Description> | ||
|
|
||
| <ul className="flex flex-col gap-2 text-sm text-white"> | ||
| {CONSOLE_FEATURES.map((feature) => ( | ||
| <li key={feature} className="flex items-center gap-3"> | ||
| <span className="size-1.5 shrink-0 rounded-full bg-primary" /> | ||
| {feature} | ||
| </li> | ||
| ))} | ||
| </ul> | ||
|
|
||
| <p className="text-sm leading-relaxed text-light-grey"> | ||
| Your names come with you. Just connect the same wallet. | ||
| </p> | ||
|
|
||
| <p className="rounded-md border border-dark-grey bg-foreground px-4 py-3 text-sm leading-relaxed text-light-grey"> | ||
| This app still works, but we'll stop supporting it in the coming | ||
| months. | ||
| </p> | ||
|
|
||
| <div className="flex flex-col-reverse gap-3 sm:flex-row sm:justify-end"> | ||
| <Dialog.Close className="rounded-md border border-dark-grey px-5 py-3 text-sm font-medium text-light-grey transition-colors hover:border-grey hover:text-white"> | ||
| Not now | ||
| </Dialog.Close> | ||
| <a | ||
| href={getConsoleLink('popup')} | ||
| target="_blank" | ||
| rel="noreferrer" | ||
| onClick={() => handleOpenChange(false)} | ||
| className="flex items-center justify-center gap-2 rounded-md bg-primary px-5 py-3 text-sm font-bold text-black transition-opacity hover:opacity-90" | ||
| > | ||
| Go to Console | ||
| <ExternalLinkIcon size={16} /> | ||
| </a> | ||
| </div> | ||
| </Dialog.Content> | ||
| </Dialog.Portal> | ||
| </Dialog.Root> | ||
| ); | ||
| } | ||
|
|
||
| export default ConsoleMigrationModal; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.