Skip to content

feat: delete collection nfts with auto-teleport #11477

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

Merged
merged 4 commits into from
Mar 24, 2025

Conversation

hassnian
Copy link
Contributor

@hassnian hassnian commented Mar 13, 2025

PR Type

  • Bugfix
  • Feature
  • Refactoring

Context

Screenshot 📸

  • My fix has changed something on UI;
CleanShot.2025-03-13.at.11.59.19.mp4

Summary by CodeRabbit

  • New Features

    • Improved NFT deletion process with enhanced user interaction.
    • Introduced a silent mode for user cart visibility and visual cues on items.
  • Bug Fixes

    • Adjusted visibility of the cart component based on user preferences.
  • Refactor

    • Streamlined action button layouts in collection views for a cleaner interface.
    • Refined modal interactions for smoother transitions and state updates.

@hassnian hassnian requested a review from a team as a code owner March 13, 2025 07:02
@hassnian hassnian requested review from preschian and Jarsen136 and removed request for a team March 13, 2025 07:02
Copy link

coderabbitai bot commented Mar 13, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request updates several Vue components and the preferences store. The NFT deletion component has been refactored to remove the loading modal and streamline deletion through a new query mechanism. Other components have received formatting and conditional logic updates tied to the user’s silent mode preference, including button layouts, cart visibility, and styling. The user cart modal now utilizes a new closing method, and an unused localization key has been removed. Finally, the preferences store now includes a silent mode property and related methods.

Changes

File(s) Change Summary
components/collection/HeroButtonDeleteNfts.vue Refactored NFT deletion logic: removed SigningModal, updated query mechanism, and modified prop & GraphQL type definitions.
components/collection/HeroButtons.vue Consolidated button rendering into single lines with direct :collection prop assignment.
components/common/listingCart/ListingCartMini.vue Adjusted v-if condition to include a silent mode check before displaying the listing cart.
components/common/userCart/UserCartModal.vue Modified onClose to invoke setClosedUserCartModal() and reset cart modal state after animation.
components/items/ItemsGrid/ItemsGridImage.vue
components/items/ItemsGrid/ItemsGridImageTokenEntity.vue
Updated conditional logic for applying the in-cart-border class based on the user’s silent mode preference.
i18n/locales/en.json Removed the "deletingNfts": "Deleting NFTs" key from the localization entries.
stores/preferences.ts Enhanced userCartModal state with an optional silent property; added getIsUserCartSilentMode getter, updated setOpenedUserCartModal, and introduced setClosedUserCartModal().

Sequence Diagram(s)

NFT Deletion Flow

sequenceDiagram
    participant U as User
    participant HB as HeroButtonDeleteNfts
    participant GS as GraphQL Service
    participant PS as PreferencesStore

    U->>HB: Initiates NFT deletion
    HB->>HB: Compute NFT IDs
    HB->>GS: Call listNftByNftWithMetadata for each NFT
    GS-->>HB: Return NFT data
    HB->>PS: Set user cart modal to open with 'burn' action
Loading

User Cart Modal Closing Flow

sequenceDiagram
    participant U as User
    participant UCM as UserCartModal
    participant PS as PreferencesStore

    U->>UCM: Clicks close on modal
    UCM->>PS: Call setClosedUserCartModal()
    UCM->>UCM: onModalAnimation completes
    UCM->>PS: Reset userCartModal to undefined
Loading

Suggested reviewers

  • Jarsen136

Poem

I’m a little rabbit tapping away,
Hoping code flows smooth this bright day.
Changes in logic make my ears perk high,
With silent modes and queries that fly.
A celebration in each revised line,
Carrots and code—oh, how divine!
Keep on hopping in our code-design!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 6780170 and e19b545.

📒 Files selected for processing (3)
  • components/collection/HeroButtonDeleteNfts.vue (1 hunks)
  • i18n/locales/en.json (0 hunks)
  • queries/subsquid/general/nftIdListByCollection.graphql (0 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Mar 13, 2025

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit e19b545
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/67e1200e5bd1190008de9c21
😎 Deploy Preview https://deploy-preview-11477--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 configuration.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
components/common/userCart/UserCartModal.vue (1)

83-87: Improved modal closing with a dedicated method

The modal closing logic has been refactored to use a dedicated setClosedUserCartModal() method instead of directly manipulating the state. The final reset of the modal state has been moved inside the animation callback, ensuring proper sequencing of operations.

Consider combining both state updates into a single operation within the preferences store to avoid potential race conditions or inconsistent states:

 const onClose = () => {
   preferencesStore.setClosedUserCartModal()
   onModalAnimation(() => {
     listingCartStore.clearListedItems()
-    preferencesStore.userCartModal = undefined
     emit('reset')
   })
 }
stores/preferences.ts (1)

51-51: Add documentation for the optional silent property.
Introducing the optional silent flag is useful to handle silent cart operations. Consider adding a small comment or JSDoc notation to clarify its intended usage and effect.

components/collection/HeroButtonDeleteNfts.vue (2)

26-26: Validate collection.id existence.
If props.collection is ever undefined or lacks an id, these computed properties could break. Add a fallback or error-handling mechanism if needed.


36-36: Handle potential large datasets.
This map operation could become expensive if the user has many NFTs. Keep an eye on performance if large collections are common.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 43181f4 and e26bd96.

📒 Files selected for processing (8)
  • components/collection/HeroButtonDeleteNfts.vue (1 hunks)
  • components/collection/HeroButtons.vue (1 hunks)
  • components/common/listingCart/ListingCartMini.vue (1 hunks)
  • components/common/userCart/UserCartModal.vue (1 hunks)
  • components/items/ItemsGrid/ItemsGridImage.vue (1 hunks)
  • components/items/ItemsGrid/ItemsGridImageTokenEntity.vue (1 hunks)
  • i18n/locales/en.json (0 hunks)
  • stores/preferences.ts (3 hunks)
💤 Files with no reviewable changes (1)
  • i18n/locales/en.json
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: Redirect rules
  • GitHub Check: Header rules
  • GitHub Check: Pages changed
  • GitHub Check: shard (5, 10)
  • GitHub Check: build-cf
  • GitHub Check: build
  • GitHub Check: shard (3, 10)
  • GitHub Check: shard (2, 10)
  • GitHub Check: shard (8, 10)
  • GitHub Check: shard (6, 10)
  • GitHub Check: shard (7, 10)
  • GitHub Check: shard (1, 10)
  • GitHub Check: shard (10, 10)
  • GitHub Check: shard (9, 10)
  • GitHub Check: shard (4, 10)
  • GitHub Check: runner / eslint
🔇 Additional comments (10)
components/common/listingCart/ListingCartMini.vue (1)

4-4: Added silent mode support to cart visibility

The cart is now conditionally displayed based on both the item count and the user's silent mode preference. This change ensures the cart mini panel respects the user's preference for a less intrusive UI when silent mode is enabled.

components/items/ItemsGrid/ItemsGridImage.vue (1)

13-13: Added silent mode condition to cart indicator styling

The highlight border for items in the cart is now only applied when the user is not in silent mode. This change maintains UI consistency with the cart visibility preference implemented in other components.

components/collection/HeroButtons.vue (1)

98-100: Simplified component structure for collection action buttons

The component rendering has been refactored to use a more concise format with self-closing tags and inline props, improving code readability while maintaining the same functionality.

components/items/ItemsGrid/ItemsGridImageTokenEntity.vue (1)

13-15: Confirm desired behavior when silent mode is enabled.
Now, the 'in-cart-border' class is only applied if the user is not in silent mode and the NFT is in either the shopping or listing cart. This aligns with a potential UX choice to hide cart highlights in silent mode. However, if users still need a visual indication even in silent mode, you may want to revisit this condition.

stores/preferences.ts (3)

144-144: Straightforward silent mode getter.
This getter cleanly converts the optional silent property to a boolean. The approach is simple and maintainable.


242-244: Flexible approach to opening cart modal in silent mode.
Allowing an optional { silent = false } object parameter provides extra control. The default value and strongly typed method signature look good.


245-248: Consistent persistence of silent flag when closing modal.
This preserves the preexisting modal mode and silent state. The approach is straightforward and correct for maintaining context if the user reopens the modal.

components/collection/HeroButtonDeleteNfts.vue (3)

12-13: Imports aligned with new graph query approach.
Importing NFTWithMetadata and nftEntitiesByIDs is consistent with the new mechanism for retrieving NFTs via Subsquid.


23-24: Refined deletion strategy using listNftByNftWithMetadata.
This direct approach for NFT deletion (or burn listing) is concise. Confirm that all required side effects (e.g., UI updates) are handled downstream.


38-46: Appropriate use of GraphQL subquery.
Retrieving the NFT entities by IDs is a clean approach. Confirm that the GQL server can handle any large sets of IDs for bigger collections.

@vikiival
Copy link
Member

@hassnian you have some conflicts

@vikiival vikiival enabled auto-merge March 19, 2025 12:49
@vikiival vikiival added this pull request to the merge queue Mar 24, 2025
Merged via the queue into kodadot:main with commit c3c0885 Mar 24, 2025
20 of 24 checks passed
Copy link

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.

4 participants