Skip to content

feat: add more built-in credential templates#74

Merged
JosueBrenes merged 3 commits intoACTA-Team:developfrom
Josue19-08:feat/add-credential-templates
Mar 11, 2026
Merged

feat: add more built-in credential templates#74
JosueBrenes merged 3 commits intoACTA-Team:developfrom
Josue19-08:feat/add-credential-templates

Conversation

@Josue19-08
Copy link
Contributor

@Josue19-08 Josue19-08 commented Mar 5, 2026

🚀 ACTA Pull Request

Mark with an x all the checkboxes that apply (like [x])


📌 Type of Change

  • Documentation (updates to README, docs, or comments)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

📝 Changes description

New Built-in Templates Added

ID Title vcType
event_attendance Event Attendance EventAttendanceCredential
payment_receipt Payment Receipt PaymentReceiptCredential
kyc_verification KYC Verification KYCVerificationCredential
access_pass Access Pass AccessPassCredential
skill_badge Skill Badge SkillBadgeCredential
warranty Warranty WarrantyCredential

Refactoring

  • Added iconSrc optional field to CredentialTemplate type for scalable template visuals
  • Replaced hardcoded template.id checks in DynamicIssueForm.tsx with generic template.iconSrc rendering
  • Added iconSrc to existing templates (escrow/tw.png, contributions/gf.png)

Files Modified

  • src/@types/templates.ts - Added iconSrc field
  • src/components/modules/issue/hooks/useCredentialTemplates.ts - Added 6 new templates + iconSrc metadata
  • src/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

  • Research & analysis: 10 min
  • Implementation: 20 min
  • Testing & verification: 10 min

🌌 Comments

  • All existing templates continue to work as before
  • Custom templates functionality is preserved
  • npm run lint and npm run build pass successfully

Thank you for contributing to ACTA! We hope you can continue contributing to this project.

Summary by CodeRabbit

  • New Features
    • Added six new credential template types: Event Attendance, Payment Receipt, KYC Verification, Access Pass, Skill Badge, and Warranty
    • Implemented icon support for credential templates, with visual icons now displayed for applicable credentials

@vercel
Copy link
Contributor

vercel bot commented Mar 5, 2026

@Josue19-08 is attempting to deploy a commit to the ACTA Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

The PR adds an optional iconSrc property to the CredentialTemplate type, augments two existing built-in templates (Escrow and Contributions) with icon metadata, introduces six new credential templates (Event Attendance, Payment Receipt, KYC Verification, Access Pass, Skill Badge, Warranty), and refactors image rendering in DynamicIssueForm from hardcoded template ID checks to metadata-driven conditional display.

Changes

Cohort / File(s) Summary
Type Definition
src/@types/templates.ts
Added optional iconSrc?: string property to CredentialTemplate to support per-template icon metadata.
Template Data & Logic
src/components/modules/issue/hooks/useCredentialTemplates.ts
Enhanced Escrow and Contributions templates with iconSrc paths; added six new built-in credential templates (Event Attendance, Payment Receipt, KYC Verification, Access Pass, Skill Badge, Warranty) with complete field definitions; mirrored new templates in custom templates array with identical field structures.
UI Rendering Refactor
src/components/modules/issue/ui/DynamicIssueForm.tsx
Replaced hardcoded template-specific image renders (for escrow and contributions) with generic conditional rendering driven by template.iconSrc, eliminating template ID checks from the component.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • JosueBrenes

Poem

🐰 Six templates hop into view,
Icons shine where escrow once grew,
No hardcoding checks anymore—
Metadata opens the door! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: add more built-in credential templates' directly summarizes the primary change—adding six new credential templates to expand the built-in template catalog.
Linked Issues check ✅ Passed All coding objectives from issue #46 are met: six new templates added with proper ids, vcTypes, and fields; iconSrc metadata introduced to CredentialTemplate type; hardcoded template.id checks replaced with generic iconSrc rendering in DynamicIssueForm; existing templates remain unchanged; TypeScript and lint compliance maintained.
Out of Scope Changes check ✅ Passed All code changes directly support the linked issue objectives: template type extension, new template definitions, and visual refactoring. No unrelated modifications detected outside the stated scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Josue19-08
Copy link
Contributor Author

Hey @JosueBrenes, PR ready! LMK

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.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7deb15a and 7671043.

📒 Files selected for processing (3)
  • src/@types/templates.ts
  • src/components/modules/issue/hooks/useCredentialTemplates.ts
  • src/components/modules/issue/ui/DynamicIssueForm.tsx

@vercel
Copy link
Contributor

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dapp Ready Ready Preview, Comment Mar 5, 2026 7:59pm

Request Review

@JosueBrenes JosueBrenes merged commit b936ff3 into ACTA-Team:develop Mar 11, 2026
6 checks passed
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.

Add more built-in credential templates

2 participants