-
Notifications
You must be signed in to change notification settings - Fork 607
Clusters Feature Integration #2816
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
Open
ayv8er
wants to merge
84
commits into
blockscout:main
Choose a base branch
from
ayv8er:clusters-page
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.
+4,691
−17
Open
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
09aff98
adds clusters api configs
ayv8er 18eeee5
adds clusters api configs
ayv8er 3e8c016
adds api types
ayv8er 073ff24
adds props routes and titles for cluster pages
ayv8er 98c2ac4
adds query param enum for clusters api
ayv8er ebc3b21
adds clusters svg
ayv8er 416e1ac
adds dynamic page routes
ayv8er 489f650
adds clusters entity ui in ui/shared/entities
ayv8er 3c78b55
adds functions to detect input type; will be used to check whether a …
ayv8er bcc9f55
adds stubs for loading skeleton view
ayv8er ba2481a
adds pagination hook
ayv8er 6e82802
adds query param hooks for clusters trpc endpoints
ayv8er e3176db
adds query param hooks for clusters trpc endpoints
ayv8er f51fb65
adds components that make up the /clusters ui
ayv8er 7abf89a
adds components for /cluster ui
ayv8er 283ca0a
adds clusters api endpoint to query by cluster id
ayv8er 31d0ae5
implements call to cluster id endpoint to get ac
ayv8er 7603627
adds clusters search types and in api category
ayv8er 0f30607
creates clusters search hook and wraps useQuickSearchQuery hook
ayv8er c5698ff
replaces useQuickSearchQuery for useSearchWithClusters hook for both …
ayv8er a2e02f1
add search suggestion ui
ayv8er b75739b
adds optional chaining to handle react re-render when search type cha…
ayv8er f50021c
adds cluster ui to ui/pages/address on address details
ayv8er 912538f
prevents clicking on cluster suggestion if address is non EVM
ayv8er 5c66c45
adds util functions for testability along with tests, for action bar …
ayv8er d74ebe0
refactor - extract clusters display logic wit
ayv8er 370a674
refactor: extract page utilities from Clusters.tsx with tests
ayv8er 9a11dc3
adds jest testing infra for react components
ayv8er 265788d
adds hook testing coverage
ayv8er 5176607
adds component and integration tests
ayv8er 182daae
adds detectInputType util tests
ayv8er fb4f80a
removes generic parameters from clusters pagination types
ayv8er 1603710
replaces any type with proper cluster config types
ayv8er aaa02d1
adds cluster routes to metadata and analytics mappings
ayv8er a21d2fd
updates order and stacks action bar items vertically when mobile view
ayv8er 9888e77
repositions clusters logo
ayv8er 88af76f
refactors search logic to render community clusters in search sugge
ayv8er 75133fc
adding clusters env vars
ayv8er d37f17d
centers directory/leaderboard toggle in mobile view
ayv8er 057d8e6
resizes and sets proper color to logo in entity component
ayv8er 304766d
hides clusters nav when clusters env is missing
ayv8er ae4a40e
removes duplicate trailing slashes in cluster community names
ayv8er cfdba44
merge upstream/main into clusters-page
ayv8er ba5828a
replaces jest-dom matchers with standard matchers
ayv8er 3f2d7a4
makes /clusters page default view the directory instead of leaderboar…
ayv8er 0e91fe5
updates columnn name from backing to total backing, in leaderboard di…
ayv8er 4e201c0
alphabetically reorders clusters export
ayv8er 4312c3e
adds Cluster section to the Table of Cont
ayv8er d6ff530
removes redundant Flex component wrapper around ClustersEntity
ayv8er 066e495
uses standard toolkit values for border radius and color
ayv8er 35eaed3
uses getFeaturePayload util instead of type coercion
ayv8er 9bcfc47
extends ImageProps interface to ClusterIconProps, and uses getFeature…
ayv8er 95ae994
adds evm address regexp in regexp.ts as single source of truth
ayv8er 6820d73
updates imports for files that used form validator address regexp to …
ayv8er 059c369
removes unused args, unnecessary type coercions and memoizations. upp…
ayv8er 1afccf2
sets correct action bar height using ACTION_BAR_HEIGHT_DESKTOP constant
ayv8er 6a99480
implements TimeFormatToggle to Joined column
ayv8er 83c2b62
simplifies conditionals and removes unnecessary Box component wrapper
ayv8er 08fca04
displays standard 404 error screen on erroneous ClusterDetails query
ayv8er bfbf904
standardizes details page to display ETH value and time in line with …
ayv8er 09b634a
removes redundant debouncing
ayv8er 8212d88
moves useQueryParams hook to lib/router and updates imports and test …
ayv8er 0c4fbb9
moves config.features.cluster
ayv8er 861ac38
removes unnecessary 3rd column and isContractVerified since it is alw…
ayv8er 8111308
checks clusters enable for placeholder
ayv8er ebcdc8e
makes isClusterClickable condition more generic for future repurpose
ayv8er 7ad3305
splits isEvmAddress out to general purpose utility in lib/address, up…
ayv8er 5582662
moves all cluster hooks and tests to lib/clusters folder
ayv8er 0c4f0a0
wraps action bar with standard button wrapper
ayv8er a63f526
makes nextjs-routes mock condition stricter
ayv8er de99aa9
removes NEXT_PUBLIC_METADATA_API_HOST from main schema as it is now i…
ayv8er d7960c9
adds mock clusters api data
ayv8er b1956a3
adds pw tests for cluster detail page
ayv8er 321b12a
adds pw tests for clusters directory page
ayv8er 34e4d0f
adds pw tests for clustersentity ui component
ayv8er 88646c1
adds mock envs for pw tests
ayv8er c668ad9
adds clusters api host and cdn url to env.pw
ayv8er 93cec58
fixes resolve react-hooks/rules-of-hooks violation in cluster search …
ayv8er 7b76822
throws error instead of using app error component
ayv8er 854441e
uses semantic token to reference color as per standard method in chak…
ayv8er 3c8239f
removes empty or loading state pw tests
ayv8er 4fb6d7c
pw tests - uses mockAssetResponse for icons, removes redundant tests,…
ayv8er f1763cd
migrates all clusters pw tests from page.route to mockApiResponse
ayv8er a928634
updates docker generated pw screenshots
ayv8er 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { Feature } from './types'; | ||
|
||
import apis from '../apis'; | ||
import { getEnvValue } from '../utils'; | ||
|
||
const title = 'Clusters Universal Name Service'; | ||
|
||
const config: Feature<{ cdnUrl: string }> = (() => { | ||
const cdnUrl = getEnvValue('NEXT_PUBLIC_CLUSTERS_CDN_URL') || 'https://cdn.clusters.xyz'; | ||
|
||
if (apis.clusters) { | ||
return Object.freeze({ | ||
title, | ||
isEnabled: true, | ||
cdnUrl, | ||
}); | ||
} | ||
|
||
return Object.freeze({ | ||
title, | ||
isEnabled: false, | ||
cdnUrl, | ||
}); | ||
})(); | ||
|
||
export default config; |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
route: jest.fn((opts) => { | ||
const pathname = opts?.pathname; | ||
const query = opts?.query || {}; | ||
|
||
if (pathname === '/address/[hash]') { | ||
return `/address/${ query.hash || 'test-hash' }`; | ||
} | ||
if (pathname === '/tx/[hash]') { | ||
return `/tx/${ query.hash || 'test-hash' }`; | ||
} | ||
if (pathname === '/clusters/[name]') { | ||
return `/clusters/${ query.name || 'test-cluster' }`; | ||
} | ||
|
||
return pathname || '/'; | ||
}), | ||
}; |
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 @@ | ||
module.exports = 'test-file-stub'; |
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,12 @@ | ||
module.exports = { | ||
useClickAway: jest.fn(() => jest.fn()), | ||
useEventListener: jest.fn(), | ||
useLocalStorage: jest.fn(() => [ '', jest.fn() ]), | ||
useSessionStorage: jest.fn(() => [ '', jest.fn() ]), | ||
useToggle: jest.fn(() => [ false, jest.fn() ]), | ||
useDebounce: jest.fn((value) => value), | ||
useThrottle: jest.fn((value) => value), | ||
usePrevious: jest.fn(), | ||
useCounter: jest.fn(() => ({ count: 0, increment: jest.fn(), decrement: jest.fn(), reset: jest.fn() })), | ||
useCopyToClipboard: jest.fn(() => [ '', jest.fn() ]), | ||
}; |
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,6 @@ | ||
import { ADDRESS_REGEXP } from 'toolkit/utils/regexp'; | ||
|
||
export function isEvmAddress(address: string): boolean { | ||
if (!address) return false; | ||
return ADDRESS_REGEXP.test(address.trim()); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import type { ApiResource } from '../types'; | ||
import type { | ||
ClustersByAddressResponse, | ||
ClusterByNameResponse, | ||
ClustersLeaderboardResponse, | ||
ClustersDirectoryResponse, | ||
ClustersByAddressQueryParams, | ||
ClusterByNameQueryParams, | ||
ClustersLeaderboardQueryParams, | ||
ClustersDirectoryQueryParams, | ||
ClusterByIdQueryParams, | ||
ClusterByIdResponse, | ||
} from 'types/api/clusters'; | ||
|
||
export const CLUSTERS_API_RESOURCES = { | ||
get_clusters_by_address: { | ||
path: '/v1/trpc/names.getNamesByOwnerAddress', | ||
pathParams: [], | ||
}, | ||
get_cluster_by_name: { | ||
path: '/v1/trpc/names.get', | ||
pathParams: [], | ||
}, | ||
get_cluster_by_id: { | ||
path: '/v1/trpc/clusters.getClusterById', | ||
pathParams: [], | ||
}, | ||
get_leaderboard: { | ||
path: '/v1/trpc/names.leaderboard', | ||
pathParams: [], | ||
}, | ||
get_directory: { | ||
path: '/v1/trpc/names.search', | ||
pathParams: [], | ||
}, | ||
} satisfies Record<string, ApiResource>; | ||
|
||
export type ClustersApiResourceName = `clusters:${ keyof typeof CLUSTERS_API_RESOURCES }`; | ||
|
||
export type ClustersApiResourcePayload<R extends ClustersApiResourceName> = | ||
R extends 'clusters:get_clusters_by_address' ? ClustersByAddressResponse : | ||
R extends 'clusters:get_cluster_by_name' ? ClusterByNameResponse : | ||
R extends 'clusters:get_cluster_by_id' ? ClusterByIdResponse : | ||
R extends 'clusters:get_leaderboard' ? ClustersLeaderboardResponse : | ||
R extends 'clusters:get_directory' ? ClustersDirectoryResponse : | ||
never; | ||
|
||
export type ClustersApiQueryParams<R extends ClustersApiResourceName> = | ||
R extends 'clusters:get_clusters_by_address' ? ClustersByAddressQueryParams : | ||
R extends 'clusters:get_cluster_by_name' ? ClusterByNameQueryParams : | ||
R extends 'clusters:get_cluster_by_id' ? ClusterByIdQueryParams : | ||
R extends 'clusters:get_leaderboard' ? ClustersLeaderboardQueryParams : | ||
R extends 'clusters:get_directory' ? ClustersDirectoryQueryParams : | ||
never; | ||
|
||
export type ClustersApiPaginationFilters = never; | ||
export type ClustersApiPaginationSorting = never; |
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.
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.