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: Implement new collection search #6063

Merged
merged 5 commits into from
May 24, 2023
Merged

Conversation

Jarsen136
Copy link
Contributor

@Jarsen136 Jarsen136 commented May 21, 2023

Thank you for your contribution to the KodaDot - One Stop Shop for Polkadot NFTs.

👇 __ Let's make a quick check before the contribution.

PR Type

  • Bugfix
  • Feature
  • Refactoring

Context

Before submitting pull request, please make sure:

  • My contribution builds clean without any errors or warnings
  • I've merged recent default branch -- main and I've no conflicts
  • I've tried to respect high code quality standards
  • I've didn't break any original functionality

Optional

  • I've tested it at </ksm/collection>
  • I've tested PR on mobile
  • I've written unit tests 🧪
  • I've found edge cases

Had issue bounty label?

  • Fill up your KSM address: Payout

Community participation

Screenshot 📸

  • My fix has changed something on UI; a screenshot is best to understand changes for others.
image

Copilot Summary

🤖 Generated by Copilot at ed2282c

This pull request enhances the search functionality of the NFT gallery by integrating the Polysearch API for collection suggestions and displaying the network name for each collection. It also fixes a bug in the search suggestion component and adds a new chain property to the NFT metadata interface.

🤖 Generated by Copilot at ed2282c

To improve the search suggestion view
We use Polysearch API too
We add chain to Metadata
And fix the image path we get
And refactor some code we do

@kodabot
Copy link
Collaborator

kodabot commented May 21, 2023

SUCCESS @Jarsen136 PR for issue #5795 which is assigned to you. Please wait for review and don't hesitate to grab another issue in the meantime!

@netlify
Copy link

netlify bot commented May 21, 2023

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit f22d0c8
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/646c9314b7afc30008776b03
😎 Deploy Preview https://deploy-preview-6063--koda-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@reviewpad reviewpad bot added the small Pull request is small label May 21, 2023
@reviewpad
Copy link
Contributor

reviewpad bot commented May 21, 2023

AI-Generated Summary: This pull request introduces a new collection search feature. It includes the implementation in components/search/utils/collectionSearch.ts and integration with the existing SearchSuggestion.vue component. Furthermore, the patch adds a chain field in the Metadata interface in components/rmrk/service/scheme.ts and updates a URL constant in utils/constants.ts. Overall, the changes consist of 45 insertions and 19 deletions across 4 files.

@Jarsen136
Copy link
Contributor Author

Jarsen136 commented May 21, 2023

I have found something missing to implement the new collection search.

  1. For now it shows zero because there's a lack of parts in collections from api: unit and floor price.
image

API result example:
image

  1. Would we also like to bring the new collection search into collection explore page? If yes, we need to implement sortBy logic on the api side. Here are the total options of sorts.
image
  1. It seems that still has not to support searching statemine collection.

cc @vikiival I need your help on the api side.

@yangwao
Copy link
Member

yangwao commented May 22, 2023

  1. shows zero because there's a lack of parts in collections from api

we can use skeleton for now and lazy fetch it from subsquid as it was done till now if possible?

  1. Would we also like to bring the new collection search into collection explore page? If yes, we need to implement sortBy logic on the api side. Here are the total options of sorts.

We can do in separate PR

3. It seems that still has not to support searching statemine collection.

separate issue, @vikiival can add these data to be pushed from Stick to there

@yangwao
Copy link
Member

yangwao commented May 22, 2023

should work for rmrk2?

image

on bsx either

image

image

@vikiival
Copy link
Member

vikiival commented May 22, 2023

Hey @Jarsen136 I will add statemine Collections today but I had to do a smol change

{
  "id": "ksm-3cdf41f721e728d969-VARA",
  "name": "Gear Sub0 Collection",
  "image": "ipfs://ipfs/bafybeidbriqfhzj7cuz2jzcftpmk6czukjd7hunzfnmtpkffzporeee4zy",
  "media_url": "ipfs://ipfs/bafybeidbriqfhzj7cuz2jzcftpmk6czukjd7hunzfnmtpkffzporeee4zy",
  "metadata": "ipfs://ipfs/bafkreifys72uc26xqml5a3k4wbsxol6cbhypxwjikp2liwx3q4brz3i6ka",
  "chain": "ksm",
  "volume": 0,
  "collection_id": "3cdf41f721e728d969-VARA"
}

Id now need to contain chain prefix + collection id
so for routing use collection_id (if you have better naming am open to that)

we can use skeleton for now and lazy fetch it from subsquid as it was done till now if possible?

Yes, please use this

@vikiival
Copy link
Member

Statemine is there

[
	{
		"id": "stmn-1",
		"name": "Birdboy",
		"image": "ipfs://ipfs/QmaTVEBZtj6m579TuxTHc5dFDWkZXMb4rSDNXw4qVDYjYs",
		"media_url": null,
		"metadata": "ipfs://ipfs/QmeXMHxaaWRAUPAFa9KAuDLmf4w3kSYyWwjw6aDjtKncnW",
		"chain": "stmn",
		"volume": 0,
		"collection_id": "1"
	}
]

@Jarsen136
Copy link
Contributor Author

Hey @Jarsen136 I will add statemine Collections today but I had to do a smol change

{
  "id": "ksm-3cdf41f721e728d969-VARA",
  "name": "Gear Sub0 Collection",
  "image": "ipfs://ipfs/bafybeidbriqfhzj7cuz2jzcftpmk6czukjd7hunzfnmtpkffzporeee4zy",
  "media_url": "ipfs://ipfs/bafybeidbriqfhzj7cuz2jzcftpmk6czukjd7hunzfnmtpkffzporeee4zy",
  "metadata": "ipfs://ipfs/bafkreifys72uc26xqml5a3k4wbsxol6cbhypxwjikp2liwx3q4brz3i6ka",
  "chain": "ksm",
  "volume": 0,
  "collection_id": "3cdf41f721e728d969-VARA"
}

Id now need to contain chain prefix + collection id so for routing use collection_id (if you have better naming am open to that)

we can use skeleton for now and lazy fetch it from subsquid as it was done till now if possible?

Yes, please use this

Ok, I will check it

@Jarsen136 Jarsen136 marked this pull request as ready for review May 23, 2023 04:01
@Jarsen136 Jarsen136 requested a review from a team as a code owner May 23, 2023 04:01
@Jarsen136 Jarsen136 requested review from preschian and vikiival and removed request for a team May 23, 2023 04:01
@reviewpad reviewpad bot added waiting-for-review medium Pull request is medium and removed small Pull request is small labels May 23, 2023
@Jarsen136
Copy link
Contributor Author

should work for rmrk2?

yes

image

@Jarsen136
Copy link
Contributor Author

shows zero because there's a lack of parts in collections from api.

we can use skeleton for now and lazy fetch it from subsquid as it was done till now if possible?

✅ Updated

image

@codeclimate
Copy link

codeclimate bot commented May 23, 2023

Code Climate has analyzed commit f22d0c8 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

Copy link
Member

@preschian preschian left a comment

Choose a reason for hiding this comment

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

is this related? I've got CORS error when I try to search collection

image

@yangwao
Copy link
Member

yangwao commented May 23, 2023

I've got CORS error when I try to search collection

Yes, I think it's related, cc @vikiival

we should add

  • *-koda-canary.netlify.app
  • canary.kodadot.xyz
  • beta.kodadot.xyz
  • kodadot.xyz

image

@vikiival
Copy link
Member

Uploaded polysearch (3.09 sec)
Published polysearch (1.23 sec)
  https://polysearch.kodadot.workers.dev
Current Deployment ID: 2f514dfa-b1f2-434b-bf7d-20c8d0c21cb7

@Jarsen136 should work now

@yangwao
Copy link
Member

yangwao commented May 24, 2023

some works some not, interesting

image

image

but on second it fetches fast apparently.

some collections are not there? cc @vikiival

image

I have zero errors in console.

Do we have some full-text search magic inside/over it?
I think does not match if someone types everything low caps and collection has capital letter in collection name.

@yangwao
Copy link
Member

yangwao commented May 24, 2023

pay 50 usd
works, yet I spotted some glitches, maybe bc of workers?

Let's inspect in

@yangwao
Copy link
Member

yangwao commented May 24, 2023

pay 50 usd

@yangwao
Copy link
Member

yangwao commented May 24, 2023

😍 Perfect, I’ve sent the payout
💵 $50 @ 25.01 USD/KSM ~ 1.999 $KSM
🧗 Caiv9TbPz68q5dC8EcHu5xKYPRnremimGzqmEejDFNpWWLG
🔗 0x062b7adb929d522dac8b93ba96fe40c39f76d540130432f4fb142e78e2de30de

🪅 Let’s grab another issue and get rewarded!
🪄 github.com/kodadot/nft-gallery/issues

@yangwao yangwao added the paid pull-request has been paid label May 24, 2023
@yangwao
Copy link
Member

yangwao commented May 24, 2023

Wrap text when no collection and item is found in search
Mind the mobile version as well to be done well

image
image

@yangwao yangwao merged commit 84d1288 into kodadot:main May 24, 2023
18 of 19 checks passed
Comment on lines +606 to +613
await Promise.all([
...collectionWithImages.map(async (collection) => {
return this.fetchCollectionStats(collection)
}),
]).then(() => {
this.collectionResult = collectionWithImages
this.isCollectionResultLoading = false
})
Copy link
Member

Choose a reason for hiding this comment

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

This should be lazyloaded

This was referenced May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium Pull request is medium paid pull-request has been paid waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement new collection search into the KodaDot // super charged search
5 participants