-
Notifications
You must be signed in to change notification settings - Fork 274
fix: duplicate testimonials in startup caraousal for infinite scroll #2401
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe PR updates src/routes/startups/+page.svelte by replacing Zach Handley’s testimonial from a helper-generated entry to an inline object using a .jpg image path. It removes the previous reference in that position and adds a second {#each testimonials as t} block within the same carousel, duplicating testimonial rendering. No exported or public API signatures are changed. Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
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 |
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: 0
🧹 Nitpick comments (2)
src/routes/startups/+page.svelte (2)
175-180
: Unify testimonial image handling; prefer using the helper with an extension optionInline object is fine, but it diverges from the
testimonial()
pattern and will drift over time. Extend the helper to support non‑PNG assets and use it here for consistency.Also, please confirm the company spelling in handle: "Socialaize" vs "Socialize".
Apply these diffs:
Helper update (add optional extension, default png):
@@ - const testimonial = (name: string, handle: string, text: string, image: string) => { - return { - name, - handle, - text, - image: `/images/testimonials/${image}.png` - }; - }; + const testimonial = ( + name: string, + handle: string, + text: string, + image: string, + ext: 'png' | 'jpg' | 'webp' = 'png' + ) => { + return { + name, + handle, + text, + image: `/images/testimonials/${image}.${ext}` + }; + };Use the helper for Zach (keeps data shape uniform):
@@ - { - name: 'Zach Handley', - handle: 'CTO // Socialaize', - text: "We have somewhere between 200,000 to 600,000 function executions per day. It's especially nice that you guys have to deal with the scaling now and not me.", - image: '/images/testimonials/zach-handley.jpg' - } + testimonial( + 'Zach Handley', + 'CTO // Socialaize', + "We have somewhere between 200,000 to 600,000 function executions per day. It's especially nice that you guys have to deal with the scaling now and not me.", + 'zach-handley', + 'jpg' + )
572-596
: Make the duplicated loop accessible and lighter: keys, aria-hidden, dynamic alt, lazy imagesThe second loop duplicates interactive content for animation but will be read twice by screen readers and eagerly loads images again. Add a keyed each, hide duplicates from a11y, fix alt text, and lazy‑load.
Note: The first loop still uses a hardcoded alt; consider aligning it too (see additional diff).
Apply this diff to the second loop:
- {#each testimonials as t} + {#each testimonials as t, i (t.name + '-dup-' + i)} - <li> + <li aria-hidden="true"> <div class="web-card is-white web-u-margin-block-start-64 e-mt-12-mobile gap-5" style="inline-size:23.625rem" > <p class="aw-sub-body-500">{t.text}</p> <div class="web-user-box"> - <img + <img loading="lazy" decoding="async" class="web-user-box-image" src={t.image} - alt="Avatar of Kap.ts" + alt={`Avatar of ${t.name}`} width="48" height="48" />Optional alignments for the first loop (recommended):
- {#each testimonials as t} + {#each testimonials as t, i (t.name + '-orig-' + i)} @@ - <img + <img loading="lazy" decoding="async" class="web-user-box-image" src={t.image} - alt="Avatar of Kap.ts" + alt={`Avatar of ${t.name}`} width="48" height="48" />Optional: reduce markup duplication by doubling the data instead of the template:
<script lang="ts"> // ... const testimonialsLoop = [...testimonials, ...testimonials]; </script> <!-- then use a single loop --> {#each testimonialsLoop as t, i (t.name + '-' + i)} <!-- card --> {/each}Verification: the CSS animation uses translate(calc(-50% - 1rem)) which assumes gap: 2rem; if the gap changes, adjust the offset to remain seamless.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/routes/startups/+page.svelte
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: tests
- GitHub Check: build
<img | ||
class="web-user-box-image" | ||
src={t.image} | ||
alt="Avatar of Kap.ts" |
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.
wrong alt
{ | ||
name: 'Zach Handley', | ||
handle: 'CTO // Socialaize', | ||
text: "We have somewhere between 200,000 to 600,000 function executions per day. It's especially nice that you guys have to deal with the scaling now and not me.", | ||
image: '/images/testimonials/zach-handley.jpg' | ||
} |
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.
why an object and not the testimonial method used like others?
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.
by default it was .png, so image wasn’t rendering. This one’s .jpeg.
What does this PR do?
Test Plan
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
yes
Summary by CodeRabbit