feat: show related testimonials on projects page#3
Conversation
- Add testimonials section to ProjectLayout that displays testimonials related to the current project - Utilize existing join field from Projects collection that connects to testimonials - Add testimonials label group to CMS for translation support - Only display testimonials section when testimonials exist for the project - Use same column layout as existing TestimonialsBlock for consistency Co-authored-by: Jens Becker <jhb-dev@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Claude finished @jhb-dev's task —— View job PR Review: Related Testimonials FeatureReviewing the implementation of the related testimonials feature on project pages. Review Tasks:
✅ Overall AssessmentThis is a solid implementation that follows repository conventions well. The feature correctly leverages the existing join field and maintains consistency with the existing 🎯 Code Quality & Best PracticesStrengths:
Code Quality Score: 9/10 🐛 Potential Issues & ImprovementsCritical Issues: NoneMinor Improvements:
⚡ Performance Considerations
Note: If customer population is added (recommendation #1), consider caching the customer lookup if multiple testimonials reference the same customer. 🔒 Security Concerns
🧪 Test CoverageCurrent State: No tests visible for this feature. Recommendations:
📝 SummaryThis is a well-implemented feature that follows established patterns. The main concern is the potential customer population issue that could cause runtime errors when Priority Actions:
Files to verify after customer population fix:
|
9b05b45 to
7d40c5c
Compare
PR Review: Related Testimonials on Project Pages✅ Overall AssessmentThis is a well-implemented feature that follows the repository's conventions. The code is clean, type-safe, and properly handles edge cases. 🎯 Strengths
🐛 Potential IssuesHigh Priority1. Missing label translations in CMS
Medium Priority2. Inconsistent show-more button behavior
3. Performance consideration
🔒 SecurityNo security concerns identified. The implementation:
⚡ Performance
📋 Recommendations
{
testimonials.length > 0 && (
<section class="mt-16">
<h2 class="text-3xl font-bold mb-8">{labels.testimonials['testimonials-title']}</h2>
<TestimonialsBlock blockType="testimonials" testimonials={testimonials} />
</section>
)
}
✅ Pre-merge ChecklistBefore merging, please verify:
Verdict: Approve with minor changes suggested. The core implementation is solid and ready for merge once the unused label is addressed. |
PR Review: Related Testimonials on Projects Page✅ Overall AssessmentGood implementation that successfully displays project-related testimonials. The code is clean and follows the repository's patterns. However, there are a few issues that should be addressed. 🐛 Critical Issues1. Unused Label Added to CMSLocation: A new label
Fix: Either:
Suggested implementation: {
testimonials.length > 0 && (
<section class="mt-16">
<h2 class="text-3xl font-bold mb-8">{labels.testimonials['testimonials-title']}</h2>
<TestimonialsBlock blockType="testimonials" testimonials={testimonials} />
</section>
)
}2. Missing Error Handling for Testimonial FetchLocation: The component fetches testimonials from the CMS but doesn't handle potential errors or empty results gracefully. Risk: If the CMS request fails or returns no documents, Fix: Add validation: const populatedTestimonials = await payloadSDK.find(/* ... */)
if (!populatedTestimonials.docs || populatedTestimonials.docs.length === 0) {
return null // or throw an error
}
|
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| if (typeof testimonial === 'string') { | ||
| return testimonial | ||
| } | ||
|
|
There was a problem hiding this comment.
Testimonial display order not preserved after refetch
The refactored code fetches testimonials using payloadSDK.find with a where.id.in filter but without a sort parameter. The database will return results in its default order (typically creation date), not the order specified in the original testimonials prop. The previous implementation used .map() on the original array to populate customer data, which preserved the intended order. This could cause testimonials to appear in an unexpected order compared to how they were arranged in the CMS.
Implements feature to display related testimonials on project pages.
Changes
Closes #2
Generated with Claude Code
Note
Show related testimonials on project pages, fetching them with depth=2 and adding CMS labels for the testimonials section.
TestimonialsBlockinweb/src/layout/collections/ProjectLayout.astrowhenproject.testimonialsexist.testimonialsby IDs withdepth: 2viapayloadSDK.find; add responsive row layout when ≤2 items; keep masonry layout and “show more” control for larger sets.project.customerfor website/name; remove unused types and add guard if customer is missing.testimonialsgroup withtestimonials-titleincms/src/globals/Labels.ts.cms/src/payload-types.tsto includelabels.testimonialsand correspondingLabelsSelectentries.Written by Cursor Bugbot for commit 801ad44. This will update automatically on new commits. Configure here.