fix: duplicate page title on /app and scroll-to-top on privacy/terms - #194
Conversation
ROUTE_TITLE_KEYS['/app'] pointed to 'header.title', the same i18n key used as the baseTitle prefix, producing 'Bayan Flow - Bayan Flow'. Added a new 'app.pageTitle' i18n key with locale-specific values and updated DocumentTitle.jsx to reference it.
LegalDocument component (shared by PrivacyPolicy and TermsOfUse) was missing a scroll-to-top on mount. Added useEffect with window.scrollTo(0, 0) to match Roadmap behavior.
✅ Deploy Preview for dev-bayanflow ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Changesapp.pageTitle i18n key, DocumentTitle fix, and LegalDocument scroll
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: dependency version conflict. Check your lock file or package.json. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Preview for Bayan Flow Staging ready!
Preview alias |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/components/LegalDocument.jsx`:
- Around line 20-22: The useEffect in LegalDocument is always scrolling to the
top, which overrides deep-link anchors. Update the scroll reset logic in
LegalDocument so it only calls window.scrollTo(0, 0) when window.location.hash
is empty, preserving section jumps for URLs like /privacy#some-section while
keeping the existing anchor ids working.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: bce9d00f-faeb-49a6-b248-b19c2226b4b1
📒 Files selected for processing (8)
README.mdsrc/components/DocumentTitle.jsxsrc/components/DocumentTitle.test.jsxsrc/components/LegalDocument.jsxsrc/components/LegalDocument.test.jsxsrc/i18n/locales/ar/translation.jsonsrc/i18n/locales/en/translation.jsonsrc/i18n/locales/fr/translation.json
Scroll-to-top now checks window.location.hash first, so URLs like /privacy#section jump to the anchor instead of being overridden.
Contribution workflow
develop: This PR targetsdevelop, notmain.Description
Three small UX bugs fixed:
1. Duplicate "Bayan Flow" in
/apppage title —ROUTE_TITLE_KEYS[/app]pointed toheader.title, the same key used asbaseTitle, producing"Bayan Flow - Bayan Flow". Added a newapp.pageTitlei18n key across all three locales and wired it inDocumentTitle.jsx.2. Privacy & Terms pages scroll to bottom on navigation —
LegalDocument(shared byPrivacyPolicyandTermsOfUse) had nouseEffectto scroll to top on mount. Addedwindow.scrollTo(0, 0)matching the pattern already used inRoadmap.3. Deep-link anchors broken by scroll-to-top — The scroll reset in
LegalDocumentalways fired, overriding URL hash jumps like/privacy#section. Added a check forwindow.location.hashso anchors are preserved.Type of Change
Related Issues
Fixes #
Changes Made
app.pageTitlei18n key in en/fr/ar translation files with locale-specific valuesROUTE_TITLE_KEYS[/app]fromheader.titletoapp.pageTitleinDocumentTitle.jsx/apptitle is"Bayan Flow - Interactive Algorithm Visualizer"useEffectwithwindow.scrollTo(0, 0)toLegalDocument.jsxfor Privacy and Terms pagesif (!window.location.hash)to preserve deep-link anchorswindow.scrollToinLegalDocument.test.jsxto suppress jsdom warningTesting
pnpm test:run)Test Results
Code Quality
pnpm lint)pnpm format)Breaking Changes
Checklist
Summary by CodeRabbit
New Features
Bug Fixes
/appdocument title so it displays the correct route-specific text.Documentation