-
Notifications
You must be signed in to change notification settings - Fork 173
Verification Badge + filter #475
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
Draft
rsproule
wants to merge
7
commits into
main
Choose a base branch
from
rfs/verified
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
94081b8
verified filter works
rsproule 314bc86
verified on all the tables + mobile friendly
rsproule 5c8e256
global wrapper. fix docs link
rsproule f0d5ffe
add index for verified
rsproule 43d3905
rm the shake logic
rsproule 22e6892
fmt
rsproule 2d8bb9d
build
rsproule 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
24 changes: 24 additions & 0 deletions
24
apps/scan/src/app/(home)/(overview)/_components/sellers/known-sellers/container.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,24 @@ | ||
| 'use client'; | ||
|
|
||
| import { Section } from '@/app/_components/layout/page-utils'; | ||
| import { RangeSelector } from '@/app/_contexts/time-range/component'; | ||
|
|
||
| export const TopServersContainer = ({ | ||
| children, | ||
| }: { | ||
| children: React.ReactNode; | ||
| }) => { | ||
| return ( | ||
| <Section | ||
| title="Top Servers" | ||
| description="Top addresses that have received x402 transfers and are listed in the Bazaar" | ||
| actions={ | ||
| <div className="flex items-center gap-2"> | ||
| <RangeSelector /> | ||
| </div> | ||
| } | ||
| > | ||
| {children} | ||
| </Section> | ||
| ); | ||
| }; |
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
133 changes: 133 additions & 0 deletions
133
apps/scan/src/app/(home)/(overview)/_components/verified-filter-wrapper.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,133 @@ | ||
| 'use client'; | ||
|
|
||
| import { useEffect, useState } from 'react'; | ||
| import { VerifiedFilterProvider } from '@/app/_contexts/verified-filter/provider'; | ||
| import { useVerifiedFilter } from '@/app/_contexts/verified-filter/hook'; | ||
| import { | ||
| Dialog, | ||
| DialogContent, | ||
| DialogDescription, | ||
| DialogHeader, | ||
| DialogTitle, | ||
| } from '@/components/ui/dialog'; | ||
| import { Label } from '@/components/ui/label'; | ||
| import { CheckCircle } from 'lucide-react'; | ||
|
|
||
| export const VerifiedFilterWrapper = ({ | ||
| children, | ||
| }: { | ||
| children: React.ReactNode; | ||
| }) => { | ||
| return ( | ||
| <VerifiedFilterProvider> | ||
| <VerifiedFilterDialog /> | ||
| {children} | ||
| </VerifiedFilterProvider> | ||
| ); | ||
| }; | ||
|
|
||
| // Reusable toggle switch component | ||
| const VerifiedToggleSwitch = () => { | ||
| const { verifiedOnly, setVerifiedOnly } = useVerifiedFilter(); | ||
|
|
||
| const handleToggle = () => { | ||
| setVerifiedOnly(!verifiedOnly); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="flex items-center justify-between py-4"> | ||
| <Label htmlFor="verified-toggle" className="text-sm font-medium"> | ||
| Show only verified servers | ||
| </Label> | ||
| <button | ||
| id="verified-toggle" | ||
| type="button" | ||
| role="switch" | ||
| aria-checked={verifiedOnly} | ||
| onClick={handleToggle} | ||
| className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 ${ | ||
| verifiedOnly ? 'bg-green-500' : 'bg-gray-200' | ||
| }`} | ||
| > | ||
| <span | ||
| className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${ | ||
| verifiedOnly ? 'translate-x-6' : 'translate-x-1' | ||
| }`} | ||
| /> | ||
| </button> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| // Dialog with keyboard shortcut (triple tap 'v') and logo click (5 times) | ||
| const VerifiedFilterDialog = () => { | ||
| const [showModal, setShowModal] = useState(false); | ||
|
|
||
| // Keyboard shortcut (triple tap 'v') | ||
| useEffect(() => { | ||
| let tapCount = 0; | ||
| let tapTimeout: NodeJS.Timeout; | ||
|
|
||
| const handleKeyDown = (e: KeyboardEvent) => { | ||
| if (e.key === 'v' || e.key === 'V') { | ||
| tapCount++; | ||
|
|
||
| // Clear existing timeout | ||
| if (tapTimeout) { | ||
| clearTimeout(tapTimeout); | ||
| } | ||
|
|
||
| // Open modal on third tap | ||
| if (tapCount === 3) { | ||
| e.preventDefault(); | ||
| setShowModal(true); | ||
| tapCount = 0; | ||
| } else { | ||
| // Reset counter after 500ms of no taps | ||
| tapTimeout = setTimeout(() => { | ||
| tapCount = 0; | ||
| }, 500); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| document.addEventListener('keydown', handleKeyDown); | ||
| return () => { | ||
| document.removeEventListener('keydown', handleKeyDown); | ||
| if (tapTimeout) { | ||
| clearTimeout(tapTimeout); | ||
| } | ||
| }; | ||
| }, []); | ||
|
|
||
| // Listen for custom event from logo clicks | ||
| useEffect(() => { | ||
| const handleOpenModal = () => { | ||
| setShowModal(true); | ||
| }; | ||
|
|
||
| window.addEventListener('open-verified-filter-modal', handleOpenModal); | ||
| return () => { | ||
| window.removeEventListener('open-verified-filter-modal', handleOpenModal); | ||
| }; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <Dialog open={showModal} onOpenChange={setShowModal}> | ||
| <DialogContent> | ||
| <DialogHeader> | ||
| <DialogTitle className="flex items-center gap-2"> | ||
| <CheckCircle className="size-4 text-green-500" /> | ||
| Verified Servers Filter | ||
| </DialogTitle> | ||
| <DialogDescription> | ||
| Filter servers to only show those with verified accepts. Volume and | ||
| metrics are recalculated to only include transactions to verified | ||
| addresses. | ||
| </DialogDescription> | ||
| </DialogHeader> | ||
| <VerifiedToggleSwitch /> | ||
| </DialogContent> | ||
| </Dialog> | ||
| ); | ||
| }; |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout management in the logo click handler doesn't properly reset the counter. Each click creates a new timeout without clearing previous ones, which can cause the click counter to reset unexpectedly if there's a delay between clicks, making it difficult or impossible to trigger the 5-click easter egg.
View Details
📝 Patch Details
Analysis
Multiple Timeouts Prevent 5-Click Easter Egg in Logo Click Handler
What fails: The
handleLogoClick()function inapps/scan/src/app/(home)/(overview)/_components/heading.tsxcreates a new 1-second timeout on every click without clearing previous timeouts. When clicks are spaced apart, multiple timeouts accumulate and fire independently, resetting the click counter unexpectedly and preventing the user from reaching 5 clicks to trigger the easter egg event.How to reproduce:
What happens: Multiple setTimeout() calls accumulate in the event queue. Each creates its own independent timeout that will fire and call
setClickCount(0). When click 1 occurs at t=0 and click 2 at t=400ms:Expected: Only one timeout should be active at any time. When a new click occurs, the previous timeout should be cleared before creating a new one. This ensures the counter only resets after 1 second of NO clicks, allowing users to reliably reach 5 clicks to trigger the easter egg.
Fix implemented: Use a
useRefto maintain a reference to the active timeout ID, clear any previous timeout before setting a new one, and set the ref to null after the timeout fires or when the 5-click event triggers. This ensures only one timer is ever active simultaneously.