-
Notifications
You must be signed in to change notification settings - Fork 0
feat(cms): pnk-token-page-types #27
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
Conversation
WalkthroughThis pull request introduces several new content types, components, and API structures within the Strapi CMS backend for a token page. The changes include creating new schemas for exchanges, token statistics, and various sections of a token page (hero, buy, need, and tokenomics). The implementation follows a consistent pattern of using Strapi's factory methods to generate controllers, routes, and services for each new content type, establishing a standardized approach to API development. Changes
Possibly related PRs
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for kleros-website-v2 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
🧹 Nitpick comments (10)
cms-backend/src/api/pnk-token-page-hero/controllers/pnk-token-page-hero.ts (1)
1-3
: Enhance controller documentationConsider adding more detailed JSDoc comments describing the purpose of this controller and its endpoints.
/** * pnk-token-page-hero controller + * + * @description Handles CRUD operations for the PNK token page hero section + * @endpoints + * - GET /api/pnk-token-page-hero + * - PUT /api/pnk-token-page-hero */cms-backend/src/api/pnk-token-page-hero/content-types/pnk-token-page-hero/schema.json (1)
31-40
: Restrict media types to images onlySince this is a hero section, consider limiting the media types to images only, as files, videos, and audios might not be appropriate for a hero background.
"background": { "allowedTypes": [ - "images", - "files", - "videos", - "audios" + "images" ], "type": "media", - "multiple": false + "multiple": false, + "required": true }cms-backend/src/api/pnk-token-page-buy-section/services/pnk-token-page-buy-section.ts (1)
1-7
: LGTM! Consider adding TypeScript types for better type safety.The implementation follows Strapi's recommended pattern for service creation.
Consider adding TypeScript types for better type safety:
- import { factories } from '@strapi/strapi'; + import { factories } from '@strapi/strapi'; + import { Strapi } from '@strapi/strapi'; + + export default factories.createCoreService<any>('api::pnk-token-page-buy-section.pnk-token-page-buy-section');cms-backend/src/components/pnk-token-page/buy-card.json (2)
3-6
: Add a meaningful description for the component.The description field is empty. Adding a clear description helps other developers understand the component's purpose and usage.
"info": { "displayName": "buy-card", - "description": "" + "description": "Card component for displaying PNK token purchase options with title, icon, and link" }
22-26
: Consider adding validation for the link relation.The link relation is correctly defined, but consider making it required and adding validation to ensure the linked content exists.
"link": { "type": "relation", "relation": "oneToOne", - "target": "api::link.link" + "target": "api::link.link", + "required": true }cms-backend/src/api/pnk-token-page-buy-section/content-types/pnk-token-page-buy-section/schema.json (2)
14-17
: Add field descriptions and validation rules for headerThe
header
field lacks a description and validation rules. Consider adding:
- Description to improve CMS usability
- Required field validation
- Min/max length constraints
"header": { "type": "string" + "required": true, + "minLength": 1, + "maxLength": 100, + "description": "The main heading text for the buy section" }
23-27
: Review exchange relation cardinalityThe one-to-many relationship with exchanges implies multiple exchanges can be linked. Consider:
- Should there be a limit on the number of exchanges?
- Should exchanges be ordered by preference/priority?
Consider adding:
"exchanges": { "type": "relation", "relation": "oneToMany", "target": "api::exchange.exchange" + "max": 10, + "ordered": true }cms-backend/src/api/pnk-token-page-need-section/content-types/pnk-token-page-need-section/schema.json (2)
14-19
: Add descriptions and validations for text fieldsBoth
header
andsubtitle
fields lack descriptions and validation rules."header": { "type": "string" + "required": true, + "minLength": 1, + "maxLength": 100, + "description": "The main heading text for the need section" }, "subtitle": { "type": "string" + "required": true, + "minLength": 1, + "maxLength": 200, + "description": "Supporting text below the header" }
20-24
: Consider renaming 'card' to 'cards' for consistencyThe field name
card
is singular but it's a repeatable component. For consistency with other schemas (likebuyCards
in the buy section), consider using the plural form.-"card": { +"cards": { "type": "component", "repeatable": true, "component": "content.cta-card" }cms-backend/src/api/pnk-token-page-tokenomics-section/content-types/pnk-token-page-tokenomics-section/schema.json (1)
1-32
: Consider adding SEO metadata fieldsSince this is a public-facing page section, consider adding SEO-related fields to optimize content for search engines.
{ // ... existing configuration ... "attributes": { + "seo": { + "type": "component", + "repeatable": false, + "component": "shared.seo", + "description": "SEO metadata for the tokenomics section" + }, // ... existing attributes ... } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
cms-backend/types/generated/components.d.ts
is excluded by!**/generated/**
cms-backend/types/generated/contentTypes.d.ts
is excluded by!**/generated/**
📒 Files selected for processing (26)
cms-backend/src/api/exchange/content-types/exchange/schema.json
(1 hunks)cms-backend/src/api/exchange/controllers/exchange.ts
(1 hunks)cms-backend/src/api/exchange/routes/exchange.ts
(1 hunks)cms-backend/src/api/exchange/services/exchange.ts
(1 hunks)cms-backend/src/api/pnk-token-page-buy-section/content-types/pnk-token-page-buy-section/schema.json
(1 hunks)cms-backend/src/api/pnk-token-page-buy-section/controllers/pnk-token-page-buy-section.ts
(1 hunks)cms-backend/src/api/pnk-token-page-buy-section/routes/pnk-token-page-buy-section.ts
(1 hunks)cms-backend/src/api/pnk-token-page-buy-section/services/pnk-token-page-buy-section.ts
(1 hunks)cms-backend/src/api/pnk-token-page-hero/content-types/pnk-token-page-hero/schema.json
(1 hunks)cms-backend/src/api/pnk-token-page-hero/controllers/pnk-token-page-hero.ts
(1 hunks)cms-backend/src/api/pnk-token-page-hero/routes/pnk-token-page-hero.ts
(1 hunks)cms-backend/src/api/pnk-token-page-hero/services/pnk-token-page-hero.ts
(1 hunks)cms-backend/src/api/pnk-token-page-need-section/content-types/pnk-token-page-need-section/schema.json
(1 hunks)cms-backend/src/api/pnk-token-page-need-section/controllers/pnk-token-page-need-section.ts
(1 hunks)cms-backend/src/api/pnk-token-page-need-section/routes/pnk-token-page-need-section.ts
(1 hunks)cms-backend/src/api/pnk-token-page-need-section/services/pnk-token-page-need-section.ts
(1 hunks)cms-backend/src/api/pnk-token-page-tokenomics-section/content-types/pnk-token-page-tokenomics-section/schema.json
(1 hunks)cms-backend/src/api/pnk-token-page-tokenomics-section/controllers/pnk-token-page-tokenomics-section.ts
(1 hunks)cms-backend/src/api/pnk-token-page-tokenomics-section/routes/pnk-token-page-tokenomics-section.ts
(1 hunks)cms-backend/src/api/pnk-token-page-tokenomics-section/services/pnk-token-page-tokenomics-section.ts
(1 hunks)cms-backend/src/api/token-stat/content-types/token-stat/schema.json
(1 hunks)cms-backend/src/api/token-stat/controllers/token-stat.ts
(1 hunks)cms-backend/src/api/token-stat/routes/token-stat.ts
(1 hunks)cms-backend/src/api/token-stat/services/token-stat.ts
(1 hunks)cms-backend/src/components/pnk-token-page/buy-card.json
(1 hunks)cms-backend/src/components/pnk-token-page/token-stat-display.json
(1 hunks)
✅ Files skipped from review due to trivial changes (13)
- cms-backend/src/api/exchange/routes/exchange.ts
- cms-backend/src/api/exchange/controllers/exchange.ts
- cms-backend/src/api/token-stat/controllers/token-stat.ts
- cms-backend/src/api/pnk-token-page-need-section/routes/pnk-token-page-need-section.ts
- cms-backend/src/api/pnk-token-page-buy-section/routes/pnk-token-page-buy-section.ts
- cms-backend/src/api/pnk-token-page-tokenomics-section/controllers/pnk-token-page-tokenomics-section.ts
- cms-backend/src/api/pnk-token-page-hero/routes/pnk-token-page-hero.ts
- cms-backend/src/api/pnk-token-page-tokenomics-section/services/pnk-token-page-tokenomics-section.ts
- cms-backend/src/api/exchange/services/exchange.ts
- cms-backend/src/api/pnk-token-page-hero/services/pnk-token-page-hero.ts
- cms-backend/src/api/token-stat/routes/token-stat.ts
- cms-backend/src/api/token-stat/services/token-stat.ts
- cms-backend/src/api/pnk-token-page-tokenomics-section/routes/pnk-token-page-tokenomics-section.ts
🔇 Additional comments (7)
cms-backend/src/api/pnk-token-page-hero/controllers/pnk-token-page-hero.ts (1)
5-7
: LGTM! Following Strapi's best practices
The controller implementation correctly uses Strapi's factory pattern for creating a core controller. This approach ensures consistent API behavior and maintainability.
cms-backend/src/api/pnk-token-page-hero/content-types/pnk-token-page-hero/schema.json (2)
21-25
: Verify button-link component structure
The buyButton component references "content.button-link". Let's verify this component exists and has the necessary fields.
✅ Verification successful
Button-link component structure verified and valid
The component exists at the expected location with proper structure containing:
text
field of type stringlink
field as a relation to theapi::link.link
model
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the button-link component configuration
# Check if the component exists and its structure
fd --type f "button-link.json" --exec cat {} \;
Length of output: 350
26-30
: Verify social media relation configuration
The oneToMany relation with socials needs verification to ensure it's properly configured in the referenced social model.
✅ Verification successful
Social media relation configuration is correctly set up
The oneToMany relation with socials is properly configured. The social model exists as a collection type with the correct API identifier (api::social.social
), and it contains all necessary fields for social media entries (name, icon, url). The relation is being used consistently across multiple components (pnk-token-page-hero and footer-socials-section) in the expected way.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the social model configuration
# Check if the social model exists and has the correct configuration
fd --type f "schema.json" --exec grep -l "api::social.social" {}
Length of output: 246
Script:
#!/bin/bash
# Let's check the content of the social model schema and the related configurations
# First, let's find the social model schema
fd "schema.json" --exec cat {} \; | grep -A 20 -B 20 "api::social.social"
# Also, let's specifically look for the social model schema
fd --type f "schema.json" --exec grep -l "collectionName.*social" {}
Length of output: 1987
Script:
#!/bin/bash
# Let's examine the social model schema specifically
cat ./cms-backend/src/api/social/content-types/social/schema.json
Length of output: 880
cms-backend/src/api/pnk-token-page-need-section/services/pnk-token-page-need-section.ts (1)
1-7
: LGTM! Same TypeScript enhancement recommended.
The implementation follows the same correct pattern as the buy-section service.
The same TypeScript enhancement suggestion from the buy-section service applies here.
cms-backend/src/api/pnk-token-page-buy-section/controllers/pnk-token-page-buy-section.ts (1)
1-7
: LGTM! Consider TypeScript enhancements and verify relationship handling.
The implementation follows Strapi's recommended pattern for controller creation.
Consider adding TypeScript types for better type safety:
- import { factories } from '@strapi/strapi'
+ import { factories } from '@strapi/strapi';
+ import { Strapi } from '@strapi/strapi';
+
+ export default factories.createCoreController<any>('api::pnk-token-page-buy-section.pnk-token-page-buy-section');
Let's verify the controller's relationship handling with the exchange entity:
✅ Verification successful
Let me gather more information about the schema and relationships.
LGTM! The schema correctly defines the relationships, no custom controller needed.
The schema shows proper relationship configuration:
- One-to-many relationship with exchanges is correctly defined
- Component relationship for buyCards is properly set up
- Default Strapi controller is sufficient to handle these relationships
The TypeScript suggestion remains valid for better type safety:
- import { factories } from '@strapi/strapi'
+ import { factories } from '@strapi/strapi';
+ import { Strapi } from '@strapi/strapi';
+
+ export default factories.createCoreController<any>('api::pnk-token-page-buy-section.pnk-token-page-buy-section');
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for proper relationship definition in the schema
fd --type f schema.json --exec cat {} \; | jq 'select(.info.singularName == "pnk-token-page-buy-section") | .attributes.exchange'
# Check for any custom controller methods that might handle the relationship
ast-grep --pattern 'createCoreController($_) {
$$$
}'
Length of output: 197
Script:
#!/bin/bash
# Check the complete schema for pnk-token-page-buy-section
fd --type f schema.json --exec cat {} \; | jq 'select(.info.singularName == "pnk-token-page-buy-section")'
# Search for any exchange-related fields or relationships in the schema
fd --type f schema.json --exec cat {} \; | jq 'select(.info.singularName == "pnk-token-page-buy-section") | .attributes'
# Look for any custom implementations in the controller file
cat cms-backend/src/api/pnk-token-page-buy-section/controllers/pnk-token-page-buy-section.ts
Length of output: 1452
cms-backend/src/api/pnk-token-page-need-section/controllers/pnk-token-page-need-section.ts (1)
1-7
: LGTM! Controller implementation follows Strapi best practices.
The controller is correctly implemented using Strapi's factory pattern, which ensures consistent API behavior and proper integration with Strapi's core functionalities.
Let's verify the integration with related files:
✅ Verification successful
Integration verified - all required Strapi components are in place
The verification confirms proper integration with all necessary Strapi components:
- Found corresponding service file at expected location
- Found matching routes file at expected location
- Content type schema is properly defined with correct singular/plural names
- All files follow consistent naming convention
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the presence of required related files for the controller
# Check for the existence of related route and service files
echo "Checking related files..."
fd -t f "pnk-token-page-need-section\.(ts|json)$" cms-backend/src/api -x echo "Found: {}"
# Verify schema structure
if [ -f "cms-backend/src/api/pnk-token-page-need-section/content-types/pnk-token-page-need-section/schema.json" ]; then
echo "\nSchema structure:"
cat cms-backend/src/api/pnk-token-page-need-section/content-types/pnk-token-page-need-section/schema.json | jq '.info'
fi
Length of output: 865
cms-backend/src/api/pnk-token-page-buy-section/content-types/pnk-token-page-buy-section/schema.json (1)
18-22
: Verify the buy-card component structure
The buyCards
field references the pnk-token-page.buy-card
component. Let's verify its structure and implementation.
✅ Verification successful
Component structure verified and valid
The pnk-token-page.buy-card
component exists and has a valid structure with:
title
field (string)icon
field (media, multiple)link
field (relation to api::link.link)
All fields appear properly defined and aligned with typical card component requirements.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if the referenced component exists and examine its structure
fd --type f "buy-card.json" --exec cat {}
Length of output: 539
"header": { | ||
"type": "string" | ||
}, | ||
"subtitle": { | ||
"type": "string" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add field validations for text content
The header and subtitle fields should have proper validations to ensure content quality.
"header": {
- "type": "string"
+ "type": "string",
+ "required": true,
+ "maxLength": 100,
+ "minLength": 3
},
"subtitle": {
- "type": "string"
+ "type": "string",
+ "required": true,
+ "maxLength": 200,
+ "minLength": 10
},
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"header": { | |
"type": "string" | |
}, | |
"subtitle": { | |
"type": "string" | |
}, | |
"header": { | |
"type": "string", | |
"required": true, | |
"maxLength": 100, | |
"minLength": 3 | |
}, | |
"subtitle": { | |
"type": "string", | |
"required": true, | |
"maxLength": 200, | |
"minLength": 10 | |
}, |
"icon": { | ||
"allowedTypes": [ | ||
"images", | ||
"files", | ||
"videos", | ||
"audios" | ||
], | ||
"type": "media", | ||
"multiple": false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Restrict media types to images only.
Since this is for exchange icons, we should restrict the allowed types to images only. Additionally, consider adding size and dimension constraints.
"icon": {
"allowedTypes": [
- "images",
- "files",
- "videos",
- "audios"
+ "images"
],
"type": "media",
- "multiple": false
+ "multiple": false,
+ "required": true
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"icon": { | |
"allowedTypes": [ | |
"images", | |
"files", | |
"videos", | |
"audios" | |
], | |
"type": "media", | |
"multiple": false | |
} | |
"icon": { | |
"allowedTypes": [ | |
"images" | |
], | |
"type": "media", | |
"multiple": false, | |
"required": true | |
} |
"url": { | ||
"type": "string" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add URL validation and required constraint.
The URL field should include validation to ensure proper URL format and should be marked as required since it's essential for an exchange entry.
"url": {
"type": "string"
+ "required": true,
+ "regex": "^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$"
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"url": { | |
"type": "string" | |
}, | |
"url": { | |
"type": "string", | |
"required": true, | |
"regex": "^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$" | |
}, |
"title": { | ||
"type": "string" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add required constraint to title field.
The title field should be marked as required since it's essential for the buy card display.
"title": {
- "type": "string"
+ "type": "string",
+ "required": true
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"title": { | |
"type": "string" | |
}, | |
"title": { | |
"type": "string", | |
"required": true | |
}, |
"icon": { | ||
"allowedTypes": [ | ||
"images", | ||
"files", | ||
"videos", | ||
"audios" | ||
], | ||
"type": "media", | ||
"multiple": true | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Revise icon field configuration.
The current configuration allows multiple icons and various media types, which seems unnecessary for a card icon.
"icon": {
"allowedTypes": [
- "images",
- "files",
- "videos",
- "audios"
+ "images"
],
"type": "media",
- "multiple": true
+ "multiple": false,
+ "required": true
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"icon": { | |
"allowedTypes": [ | |
"images", | |
"files", | |
"videos", | |
"audios" | |
], | |
"type": "media", | |
"multiple": true | |
}, | |
"icon": { | |
"allowedTypes": [ | |
"images" | |
], | |
"type": "media", | |
"multiple": false, | |
"required": true | |
}, |
"arrowLink": { | ||
"type": "component", | ||
"repeatable": true, | ||
"component": "content.button-link" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
The arrowLink
field should not be repeatable
Based on the codebase analysis, the button-link
component is consistently used as a non-repeatable field in other sections, particularly in the CTA card component where arrowLink
is explicitly marked as "repeatable": false
. This pattern suggests that the repeatable setting in the pnk-token-page-need-section is inconsistent with the established usage across the codebase.
cms-backend/src/api/pnk-token-page-need-section/content-types/pnk-token-page-need-section/schema.json
: Change"repeatable": true
to"repeatable": false
for thearrowLink
field
🔗 Analysis chain
Verify the button-link component implementation
The arrowLink
field is marked as repeatable, which might not be necessary for a typical CTA section. Let's verify the component structure and its usage pattern.
Let me check how the button-link component is used in other sections to make a more informed decision.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if the referenced component exists and examine its structure
fd --type f "button-link.json" --exec cat {}
# Look for other usages of this component to verify if it's typically repeatable
rg -l "content.button-link"
Length of output: 1625
Script:
#!/bin/bash
# Check the usage pattern of button-link in other schemas
fd --type f schema.json --exec rg -A 3 "content.button-link" {}
# Also check component usage in CTA sections specifically
fd --type f "cta" --exec cat {}
Length of output: 2116
"attributes": { | ||
"key": { | ||
"type": "string" | ||
}, | ||
"primaryValue": { | ||
"type": "string" | ||
}, | ||
"secondaryValue": { | ||
"type": "string" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add field validations and descriptions for better data integrity
The schema fields lack important constraints and documentation. Consider adding:
- Required field validations
- Field descriptions
- Minimum/maximum length constraints where appropriate
"attributes": {
"key": {
- "type": "string"
+ "type": "string",
+ "required": true,
+ "description": "Identifier/label for the token statistic (e.g., 'Market Cap', 'Total Supply')",
+ "minLength": 1,
+ "maxLength": 50
},
"primaryValue": {
- "type": "string"
+ "type": "string",
+ "required": true,
+ "description": "Main value to display (e.g., '$1.2M', '1,000,000 PNK')",
+ "minLength": 1
},
"secondaryValue": {
- "type": "string"
+ "type": "string",
+ "description": "Optional secondary/supplementary value"
}
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"attributes": { | |
"key": { | |
"type": "string" | |
}, | |
"primaryValue": { | |
"type": "string" | |
}, | |
"secondaryValue": { | |
"type": "string" | |
} | |
} | |
"attributes": { | |
"key": { | |
"type": "string", | |
"required": true, | |
"description": "Identifier/label for the token statistic (e.g., 'Market Cap', 'Total Supply')", | |
"minLength": 1, | |
"maxLength": 50 | |
}, | |
"primaryValue": { | |
"type": "string", | |
"required": true, | |
"description": "Main value to display (e.g., '$1.2M', '1,000,000 PNK')", | |
"minLength": 1 | |
}, | |
"secondaryValue": { | |
"type": "string", | |
"description": "Optional secondary/supplementary value" | |
} | |
} |
"stats": { | ||
"type": "relation", | ||
"relation": "oneToMany", | ||
"target": "api::token-stat.token-stat" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add validation for stats relationship
The stats relationship should be required and documented.
"stats": {
"type": "relation",
"relation": "oneToMany",
- "target": "api::token-stat.token-stat"
+ "target": "api::token-stat.token-stat",
+ "required": true,
+ "description": "Token statistics to display in this section"
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"stats": { | |
"type": "relation", | |
"relation": "oneToMany", | |
"target": "api::token-stat.token-stat" | |
} | |
"stats": { | |
"type": "relation", | |
"relation": "oneToMany", | |
"target": "api::token-stat.token-stat", | |
"required": true, | |
"description": "Token statistics to display in this section" | |
} |
"icon": { | ||
"allowedTypes": [ | ||
"images", | ||
"files", | ||
"videos", | ||
"audios" | ||
], | ||
"type": "media", | ||
"multiple": false | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Restrict icon media types to images only
The icon field currently allows unnecessary media types (files, videos, audios) which could lead to incorrect usage. Since this is for displaying statistics, only images should be allowed.
"icon": {
"allowedTypes": [
- "images",
- "files",
- "videos",
- "audios"
+ "images"
],
"type": "media",
- "multiple": false
+ "multiple": false,
+ "required": true,
+ "description": "Visual icon representing the statistic (use SVG or PNG)"
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"icon": { | |
"allowedTypes": [ | |
"images", | |
"files", | |
"videos", | |
"audios" | |
], | |
"type": "media", | |
"multiple": false | |
}, | |
"icon": { | |
"allowedTypes": [ | |
"images" | |
], | |
"type": "media", | |
"multiple": false, | |
"required": true, | |
"description": "Visual icon representing the statistic (use SVG or PNG)" | |
}, |
"attributes": { | ||
"header": { | ||
"type": "string" | ||
}, | ||
"subtitle": { | ||
"type": "string" | ||
}, | ||
"arrowLink": { | ||
"type": "component", | ||
"repeatable": false, | ||
"component": "content.button-link" | ||
}, | ||
"tokenStatDisplay": { | ||
"type": "component", | ||
"repeatable": false, | ||
"component": "pnk-token-page.token-stat-display" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance schema with validations and descriptions
The schema needs better field constraints and documentation for content editors.
"attributes": {
"header": {
- "type": "string"
+ "type": "string",
+ "required": true,
+ "description": "Main heading for the tokenomics section",
+ "minLength": 1,
+ "maxLength": 100
},
"subtitle": {
- "type": "string"
+ "type": "string",
+ "required": true,
+ "description": "Explanatory text below the header",
+ "minLength": 1,
+ "maxLength": 200
},
"arrowLink": {
"type": "component",
"repeatable": false,
- "component": "content.button-link"
+ "component": "content.button-link",
+ "required": true,
+ "description": "Call-to-action button/link for the tokenomics section"
},
"tokenStatDisplay": {
"type": "component",
"repeatable": false,
- "component": "pnk-token-page.token-stat-display"
+ "component": "pnk-token-page.token-stat-display",
+ "required": true,
+ "description": "Token statistics display component for this section"
}
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"attributes": { | |
"header": { | |
"type": "string" | |
}, | |
"subtitle": { | |
"type": "string" | |
}, | |
"arrowLink": { | |
"type": "component", | |
"repeatable": false, | |
"component": "content.button-link" | |
}, | |
"tokenStatDisplay": { | |
"type": "component", | |
"repeatable": false, | |
"component": "pnk-token-page.token-stat-display" | |
} | |
} | |
"attributes": { | |
"header": { | |
"type": "string", | |
"required": true, | |
"description": "Main heading for the tokenomics section", | |
"minLength": 1, | |
"maxLength": 100 | |
}, | |
"subtitle": { | |
"type": "string", | |
"required": true, | |
"description": "Explanatory text below the header", | |
"minLength": 1, | |
"maxLength": 200 | |
}, | |
"arrowLink": { | |
"type": "component", | |
"repeatable": false, | |
"component": "content.button-link", | |
"required": true, | |
"description": "Call-to-action button/link for the tokenomics section" | |
}, | |
"tokenStatDisplay": { | |
"type": "component", | |
"repeatable": false, | |
"component": "pnk-token-page.token-stat-display", | |
"required": true, | |
"description": "Token statistics display component for this section" | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Types added
Collection-Types
Single-Types
Components - PNK Token
Summary by CodeRabbit
New Features
exchange
,pnk-token-page-buy-section
,pnk-token-page-hero
,pnk-token-page-need-section
,pnk-token-page-tokenomics-section
, andtoken-stat
.buy-card
andTokenStatDisplay
, with defined attributes and relationships.Bug Fixes
Documentation