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: sync url with filters #148

Merged
merged 7 commits into from
Dec 12, 2024
Merged

feat: sync url with filters #148

merged 7 commits into from
Dec 12, 2024

Conversation

Xaroz
Copy link
Contributor

@Xaroz Xaroz commented Dec 12, 2024

fixes #145

  • Chain picker and time picker will now sync with the URL.
  • Navigation to this URL will make it so that these filters will remain and be sent to the message query
  • For the chains, the keys are origin and destination and their value will be a domainId. Inputting an invalid domainId will prompt the SearchChainError component to show
  • For the time, the keys are startTime and endTime and their value is a number. The initial load of the values are validated by the function tryToDecimalNumber()
  • Refactor functions to allow multiple query params.

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hyperlane-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 8:36pm

Copy link
Collaborator

@jmrossy jmrossy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good!

<SearchError
show={show}
imgSrc={ErrorIcon}
text="Sorry, the origin or destination chain is invalid. Please try choosing another chain or cleaning your filters."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
text="Sorry, the origin or destination chain is invalid. Please try choosing another chain or cleaning your filters."
text="Sorry, either the origin or the destination chain is invalid. Please choose a different chain or clear your search filters."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 146 to 149
isValidInput &&
isValidOrigin &&
isValidDestination &&
isAnyMessageFound &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long list, should we make a var above to combine these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created a showMessageTable variable to combine these

@@ -21,6 +22,11 @@ export function isValidSearchQuery(input: string) {
return !!searchValueToPostgresBytea(input);
}

export function isValidDomainId(domainId: string | null, multiProvider: MultiProvider) {
if (!domainId) return false;
return !!multiProvider.tryGetDomainId(domainId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return !!multiProvider.tryGetDomainId(domainId);
return multiProvider.hasChain(domainId);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know there was a function for this, thanks!

Comment on lines 42 to 43
if (value) {
if (newQuery.get(key) !== value) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awkward structure, combine these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 47 to 48
} else {
if (newQuery.has(key)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@Xaroz Xaroz merged commit 1f9e154 into main Dec 12, 2024
6 checks passed
@Xaroz Xaroz deleted the xaroz/url-filters branch December 12, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync chain and time filters with URL
2 participants