feat: add more built-in credential templates#74
feat: add more built-in credential templates#74JosueBrenes merged 3 commits intoACTA-Team:developfrom
Conversation
|
@Josue19-08 is attempting to deploy a commit to the ACTA Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe PR adds an optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 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)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hey @JosueBrenes, PR ready! LMK |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/modules/issue/hooks/useCredentialTemplates.ts (1)
125-274: Consider extracting shared field definitions to reduce template drift.Lines 125-274 repeat the same
subject/date field blocks many times. A small helper/constant extraction will make this safer to maintain.♻️ Example refactor direction
-import type { CredentialTemplate } from '@/@types/templates'; +import type { CredentialTemplate, TemplateField } from '@/@types/templates'; +const subjectDidField: TemplateField = { + key: 'subject', + label: 'Subject DID', + type: 'did', + required: true, + placeholder: 'Wallet (G...) – we derive DID', +}; + +const expirationDateField: TemplateField = { + key: 'expirationDate', + label: 'Expiration Date', + type: 'date', +}; // inside template fields arrays -{ - key: 'subject', - label: 'Subject DID', - type: 'did', - required: true, - placeholder: 'Wallet (G...) – we derive DID', -}, +subjectDidField, ... -{ key: 'expirationDate', label: 'Expiration Date', type: 'date' }, +expirationDateField,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/modules/issue/hooks/useCredentialTemplates.ts` around lines 125 - 274, The templates in useCredentialTemplates repeat the same 'subject' and common date fields (e.g., 'issueDate', 'expirationDate') across multiple template objects (like event_attendance, payment_receipt, kyc_verification, access_pass, skill_badge, warranty); extract these into shared constants (e.g., SUBJECT_FIELD, DATE_FIELDS or COMMON_FIELDS) and reuse them in each template by spreading or concatenating (for example inside the templates' fields arrays) to avoid duplication and drift, update the template definitions (ids: 'event_attendance', 'payment_receipt', 'kyc_verification', 'access_pass', 'skill_badge', 'warranty') to reference the new constants, and ensure the shared constants are immutable/read-only to prevent accidental modification.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/modules/issue/hooks/useCredentialTemplates.ts`:
- Around line 125-274: The templates in useCredentialTemplates repeat the same
'subject' and common date fields (e.g., 'issueDate', 'expirationDate') across
multiple template objects (like event_attendance, payment_receipt,
kyc_verification, access_pass, skill_badge, warranty); extract these into shared
constants (e.g., SUBJECT_FIELD, DATE_FIELDS or COMMON_FIELDS) and reuse them in
each template by spreading or concatenating (for example inside the templates'
fields arrays) to avoid duplication and drift, update the template definitions
(ids: 'event_attendance', 'payment_receipt', 'kyc_verification', 'access_pass',
'skill_badge', 'warranty') to reference the new constants, and ensure the shared
constants are immutable/read-only to prevent accidental modification.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4a9b4d2f-f1df-41e2-bf2a-1d2c2878158e
📒 Files selected for processing (3)
src/@types/templates.tssrc/components/modules/issue/hooks/useCredentialTemplates.tssrc/components/modules/issue/ui/DynamicIssueForm.tsx
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🚀 ACTA Pull Request
Mark with an
xall the checkboxes that apply (like[x])📌 Type of Change
📝 Changes description
New Built-in Templates Added
event_attendanceEventAttendanceCredentialpayment_receiptPaymentReceiptCredentialkyc_verificationKYCVerificationCredentialaccess_passAccessPassCredentialskill_badgeSkillBadgeCredentialwarrantyWarrantyCredentialRefactoring
iconSrcoptional field toCredentialTemplatetype for scalable template visualstemplate.idchecks inDynamicIssueForm.tsxwith generictemplate.iconSrcrenderingiconSrcto existing templates (escrow→/tw.png,contributions→/gf.png)Files Modified
src/@types/templates.ts- AddediconSrcfieldsrc/components/modules/issue/hooks/useCredentialTemplates.ts- Added 6 new templates + iconSrc metadatasrc/components/modules/issue/ui/DynamicIssueForm.tsx- Refactored to use template metadata📸 Evidence (A Loom/Cap video is required as evidence, we WON'T merge if there's no proof)
Grabacion.de.pantalla.2026-03-05.a.la.s.12.53.20.p.m.mov
⏰ Time spent breakdown
🌌 Comments
npm run lintandnpm run buildpass successfullyThank you for contributing to ACTA! We hope you can continue contributing to this project.
Summary by CodeRabbit