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

ENG-4849 feat(portal): replace combobox search in create claim with graphql equivalent #945

Conversation

Vitalsine85
Copy link
Member

Affected Packages

Apps

  • data populator
  • portal
  • template

Packages

  • 1ui
  • api
  • graphql
  • protocol
  • sdk

Tools

  • tools

Overview

  • Replaces the combobox search in Create Claim flow with new GraphQL powered search, courtesy of the lovely @0xjojikun. Added a bit of salt and pepper but he did a beautiful job on these new components!

Screen Captures

https://www.loom.com/share/450e9ce606f44e9caaf785995035caa5?sid=40b26455-6a42-467c-97b8-842b10f8e739

Declaration

  • I hereby declare that I have abided by the rules and regulations as outlined in the CONTRIBUTING.md

Copy link

linear bot commented Nov 22, 2024

@Vitalsine85 Vitalsine85 changed the title ENG-4849 feat(portal): replace combobox search in create claim with graphql ENG-4849 feat(portal): replace combobox search in create claim with graphql equivalent Nov 22, 2024
@github-actions github-actions bot added the feat Feature label Nov 22, 2024
Copy link
Member

@jonathanprozzi jonathanprozzi left a comment

Choose a reason for hiding this comment

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

Great job! A few comments for our future selves -- one about being able to use the useGetConnectionsCountQuery for the stats and another about our utils.

@@ -45,6 +45,7 @@ fragment AtomVaultDetails on atoms {
vault {
positionCount
totalShares
currentSharePrice
Copy link
Member

Choose a reason for hiding this comment

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

Good addition!

@@ -7510,6 +7510,7 @@ export type AtomVaultDetailsFragment = {
__typename?: 'vaults'
positionCount: number
totalShares: any
currentSharePrice: any
Copy link
Member

Choose a reason for hiding this comment

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

We still have a good bit of any in our code gen types. As we get closer to migration we'll have to see what we need to tighten up at the schema level.

@@ -427,6 +428,106 @@ export const getAtomId = (atom: IdentityPresenter) => {
return atom.identity_id
}

// atom GQL helpers
export const getAtomImageGQL = (
Copy link
Member

Choose a reason for hiding this comment

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

Amazing! I started adding some of these in the branch for Explore (my open PR). We can streamline once both are merged in and see if there are duplicates.

@@ -0,0 +1,12 @@
import { useEffect, useState } from 'react'
Copy link
Member

Choose a reason for hiding this comment

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

Great! If we decide we want to adopt using lodash in the future for our utils we can update to use lodash's debounce but this is great until then.

avatarSrc={getAtomImageGQL(selectedIdentity)}
name={getAtomLabelGQL(selectedIdentity)}
id={getAtomIdGQL(selectedIdentity)}
stats={undefined} // TODO: add stats when available
Copy link
Member

Choose a reason for hiding this comment

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

This is available on another query. I split the queries out for revalidation and optimization purposes. It can be obtained via useGetConnectionsCountQuery and passed in.

It's an aggregate query so it's pretty quick. We can update that in a future PR though


const { data: atomsData, isLoading } = useGetAtomsQuery(
{
where: {
Copy link
Member

Choose a reason for hiding this comment

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

Great! I'm glad this is working -- thanks for pulling the debounce into it's own hook. This is how I approached it in the playground tests so I'm glad it works and that you abstracted it into a hook!

@Vitalsine85 Vitalsine85 merged commit 7ea60b1 into feature/graphql-migration Nov 25, 2024
3 checks passed
@Vitalsine85 Vitalsine85 deleted the vital/eng-4849-replace-combobox-search-in-create-claim-with-graphql branch November 25, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants