Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR adds basePath configuration to the Footer component and compliance badge exports, enabling dynamic asset URLs for theme-aware (light/dark) badge rendering. Footer accepts an optional basePath prop, badge functions now accept basePath to build image sources, and the blog layout passes basePath="/blog" to Footer. ChangesFooter basePath Theme Badges
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/ui/src/components/footer-badges.tsx (1)
1-83: ⚡ Quick winNormalize
basePathbefore composing badge URLs.On Line 4 (and the equivalent
srclines), raw concatenation can generate double-slash paths when callers pass a trailing slash (e.g./blog/). Normalizing once also removes duplication across all badge builders.Proposed refactor
+const normalizeBasePath = (basePath = "") => basePath.replace(/\/+$/, ""); +const badgeSrc = (basePath: string, fileName: string) => + `${normalizeBasePath(basePath)}/badges/${fileName}`; + export const gdpr = (basePath = "") => ( <> <img - src={`${basePath}/badges/gdpr.svg`} + src={badgeSrc(basePath, "gdpr.svg")} alt="GDPR" width={26} height={26} loading="lazy" className="hidden dark:block" /> <img - src={`${basePath}/badges/gdpr_light.svg`} + src={badgeSrc(basePath, "gdpr_light.svg")} alt="GDPR" width={26} height={26} className="block dark:hidden" loading="lazy" /> </> );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui/src/components/footer-badges.tsx` around lines 1 - 83, Trim any trailing slashes from the incoming basePath once and reuse the normalized value in all badge builders to avoid double slashes; add a small helper (e.g., normalizeBasePath) that does basePath = (basePath || "").replace(/\/+$/, "") and then in gdpr, hipaa, iso27, and soc2 compute const p = normalizeBasePath(basePath) and use `${p}/badges/...` for src, so callers passing "/blog/" or "/blog" both produce "/blog/badges/..." while an empty basePath still yields "/badges/...".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/ui/src/components/footer-badges.tsx`:
- Around line 1-83: Trim any trailing slashes from the incoming basePath once
and reuse the normalized value in all badge builders to avoid double slashes;
add a small helper (e.g., normalizeBasePath) that does basePath = (basePath ||
"").replace(/\/+$/, "") and then in gdpr, hipaa, iso27, and soc2 compute const p
= normalizeBasePath(basePath) and use `${p}/badges/...` for src, so callers
passing "/blog/" or "/blog" both produce "/blog/badges/..." while an empty
basePath still yields "/badges/...".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9f6fb9ea-cabd-4602-aba7-dc2a2e34d4d6
⛔ Files ignored due to path filters (8)
apps/blog/public/badges/gdpr.svgis excluded by!**/*.svgapps/blog/public/badges/gdpr_light.svgis excluded by!**/*.svgapps/blog/public/badges/hipaa.svgis excluded by!**/*.svgapps/blog/public/badges/hipaa_light.svgis excluded by!**/*.svgapps/blog/public/badges/iso27.svgis excluded by!**/*.svgapps/blog/public/badges/iso27_light.svgis excluded by!**/*.svgapps/blog/public/badges/soc2.svgis excluded by!**/*.svgapps/blog/public/badges/soc2_light.svgis excluded by!**/*.svg
📒 Files selected for processing (3)
apps/blog/src/app/(blog)/layout.tsxpackages/ui/src/components/footer-badges.tsxpackages/ui/src/components/footer.tsx
Fixes #DR-8495
Summary by CodeRabbit