gamma.io support#2392
Conversation
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds Gamma.io URL recognition and curation validation, renders gamma.io images with a pixelated fixed-height frame, centralizes preview rendering in MarketplacePreview (with per-marketplace wrappers delegating to it), updates related tests, adjusts markdown blank-line rendering, and treats .jpg as static in the proxy. ChangesGamma.io Marketplace Preview Support
Sequence Diagram: sequenceDiagram
participant Page
participant MarketplacePreview
participant useMarketplacePreviewState
participant MarketplaceGammaioPreview
Page->>MarketplacePreview: render(href, mode?, compact?)
MarketplacePreview->>useMarketplacePreviewState: resolve preview state for href
MarketplacePreview->>MarketplaceGammaioPreview: delegate render(href, compact) when kind startsWith "gammaio."
Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
__tests__/components/waves/utils/validateCurationDropUrl.test.ts (1)
17-24: ⚡ Quick winAdd a negative regression case for
gamma.io/collections/<slug>/tokens.Please add an explicit rejection assertion for the no-token-id path so the generic collection matcher cannot regress and accept this section URL as a valid item URL.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@__tests__/components/waves/utils/validateCurationDropUrl.test.ts` around lines 17 - 24, Add a negative test case in validateCurationDropUrl.test.ts that asserts the no-token-id path "gamma.io/collections/example-collection/tokens" is rejected by the validator to prevent the generic collection matcher from accepting it; update the existing test array (near the entries with `gamma.io/collections/example-collection/${id}` and `gamma.io/collections/example-collection/tokens/${id}`) to include the standalone "gamma.io/collections/example-collection/tokens" string and add an explicit expect/assert that validateCurationDropUrl (or the tested function used in this file) returns false / rejects for that input.__tests__/components/waves/marketplace/urlKind.test.ts (1)
69-73: ⚡ Quick winAdd
https://gamma.io/collections/example-collection/tokensto unsupported URLs.This is the key ambiguity case for the collection matcher and should be pinned in the negative matrix.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@__tests__/components/waves/marketplace/urlKind.test.ts` around lines 69 - 73, Add the ambiguous collection URL "https://gamma.io/collections/example-collection/tokens" to the unsupported URLs test matrix: update the unsupported URLs array in urlKind.test.ts (the array containing "https://gamma.io/collections", "https://gamma.io/ordinals/collections/example-collection", etc.) to include that exact URL so the collection matcher is asserted negative for this case.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@components/waves/marketplace/MarketplaceItemPreviewCard.utils.ts`:
- Around line 43-50: The displayName for Gamma should use proper branding:
change the return value in the switch cases handling "gammaio.collection",
"gammaio.collection-token", "gammaio.inscription", "gammaio.ordinal",
"gammaio.ordinal-inscription", "gammaio.ordinal-collection-inscription", and
"gammaio.stacks-nft" so that displayName is "Gamma.io" (not "gammaio") and keep
logoSrc as "/gammaio.jpg"; update any consumers that derive CTA/ARIA text from
displayName (e.g., code that renders "Open on {displayName}") to ensure they
pick up the new branded text.
In `@components/waves/marketplace/urlKind.ts`:
- Around line 28-30: The GAMMAIO_COLLECTION_PATH_PATTERN currently matches
/collections/<slug>/tokens (missing token id); update the regex in the constant
GAMMAIO_COLLECTION_PATH_PATTERN so the second path segment cannot be the literal
"tokens" (e.g. use a negative lookahead like /(?!tokens$)/ for that segment)
while keeping GAMMAIO_COLLECTION_TOKEN_PATH_PATTERN as the explicit
tokens-with-id pattern; replace the existing pattern with one such as
^\/collections\/[^\/?#]+\/(?!tokens$)[^\/?#]+\/?$ (preserve the i flag).
In `@components/waves/utils/validateCurationDropUrl.ts`:
- Around line 96-101: The first collection regex in validateCurationDropUrl
allows the literal segment "tokens" to be matched as the second path part (so
/collections/<slug>/tokens is wrongly accepted); update the RegExp that uses
SLUG_ID_PART_REGEX and GAMMAIO_ID_PART_REGEX so the segment matched by
GAMMAIO_ID_PART_REGEX is not the literal "tokens" (e.g. add a negative lookahead
before GAMMAIO_ID_PART_REGEX or otherwise exclude the exact string "tokens");
modify the RegExp expression(s) where SLUG_ID_PART_REGEX and
GAMMAIO_ID_PART_REGEX are combined to enforce that exclusion.
---
Nitpick comments:
In `@__tests__/components/waves/marketplace/urlKind.test.ts`:
- Around line 69-73: Add the ambiguous collection URL
"https://gamma.io/collections/example-collection/tokens" to the unsupported URLs
test matrix: update the unsupported URLs array in urlKind.test.ts (the array
containing "https://gamma.io/collections",
"https://gamma.io/ordinals/collections/example-collection", etc.) to include
that exact URL so the collection matcher is asserted negative for this case.
In `@__tests__/components/waves/utils/validateCurationDropUrl.test.ts`:
- Around line 17-24: Add a negative test case in validateCurationDropUrl.test.ts
that asserts the no-token-id path
"gamma.io/collections/example-collection/tokens" is rejected by the validator to
prevent the generic collection matcher from accepting it; update the existing
test array (near the entries with
`gamma.io/collections/example-collection/${id}` and
`gamma.io/collections/example-collection/tokens/${id}`) to include the
standalone "gamma.io/collections/example-collection/tokens" string and add an
explicit expect/assert that validateCurationDropUrl (or the tested function used
in this file) returns false / rejects for that input.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 35194f66-876e-4ce6-b863-fb89ec3f4b5f
⛔ Files ignored due to path filters (1)
public/gammaio.jpgis excluded by!**/*.jpg
📒 Files selected for processing (10)
__tests__/components/waves/MarketplaceItemPreviewCard.test.tsx__tests__/components/waves/marketplace/urlKind.test.ts__tests__/components/waves/utils/validateCurationDropUrl.test.tscomponents/waves/MarketplacePreview.tsxcomponents/waves/marketplace/MarketplaceGammaioPreview.tsxcomponents/waves/marketplace/MarketplaceItemPreviewCard.utils.tscomponents/waves/marketplace/MarketplaceItemPreviewMediaLink.tsxcomponents/waves/marketplace/previewLayout.tscomponents/waves/marketplace/urlKind.tscomponents/waves/utils/validateCurationDropUrl.ts
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
|



Summary by CodeRabbit
New Features
Bug Fixes
Tests