Skip to content

fix: duplicate page title on /app and scroll-to-top on privacy/terms - #194

Merged
ayoub3bidi merged 4 commits into
developfrom
quick-fix/small-tweaks
Jun 28, 2026
Merged

fix: duplicate page title on /app and scroll-to-top on privacy/terms#194
ayoub3bidi merged 4 commits into
developfrom
quick-fix/small-tweaks

Conversation

@ayoub3bidi

@ayoub3bidi ayoub3bidi commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Contribution workflow

  • Base branch is develop: This PR targets develop, not main.
  • Guidelines and docs: I have read CONTRIBUTING.md and the docs relevant to my change.
  • This template: I kept the PR template structure and filled in the sections below that apply to this change.

Description

Three small UX bugs fixed:

1. Duplicate "Bayan Flow" in /app page titleROUTE_TITLE_KEYS[/app] pointed to header.title, the same key used as baseTitle, producing "Bayan Flow - Bayan Flow". Added a new app.pageTitle i18n key across all three locales and wired it in DocumentTitle.jsx.

2. Privacy & Terms pages scroll to bottom on navigationLegalDocument (shared by PrivacyPolicy and TermsOfUse) had no useEffect to scroll to top on mount. Added window.scrollTo(0, 0) matching the pattern already used in Roadmap.

3. Deep-link anchors broken by scroll-to-top — The scroll reset in LegalDocument always fired, overriding URL hash jumps like /privacy#section. Added a check for window.location.hash so anchors are preserved.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)

Related Issues

Fixes #

Changes Made

  • Added app.pageTitle i18n key in en/fr/ar translation files with locale-specific values
  • Changed ROUTE_TITLE_KEYS[/app] from header.title to app.pageTitle in DocumentTitle.jsx
  • Added test asserting /app title is "Bayan Flow - Interactive Algorithm Visualizer"
  • Added useEffect with window.scrollTo(0, 0) to LegalDocument.jsx for Privacy and Terms pages
  • Guarded scroll reset behind if (!window.location.hash) to preserve deep-link anchors
  • Added tests for both hash and no-hash scroll behavior
  • Mocked window.scrollTo in LegalDocument.test.jsx to suppress jsdom warning

Testing

  • All existing tests pass (pnpm test:run)
  • New tests added for new functionality

Test Results

 Test Files  133 passed (133)
      Tests  1656 passed (1656)

Code Quality

  • Code follows the project's coding standards
  • ESLint passes (pnpm lint)
  • Prettier formatting applied (pnpm format)
  • No console errors or warnings
  • Code is properly documented with JSDoc (if applicable)

Breaking Changes

  • None

Checklist

  • I have completed the Contribution workflow checklist at the top of this template
  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • New Features

    • Updated the browser page title for the app route to use a dedicated app title in English, French, and Arabic.
    • Legal pages now scroll to the top when opened normally, while preserving anchored links.
  • Bug Fixes

    • Refined the /app document title so it displays the correct route-specific text.
  • Documentation

    • Improved the README wording and clarified the feature table labels.

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.
@netlify

netlify Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploy Preview for dev-bayanflow ready!

Name Link
🔨 Latest commit fca457c
🔍 Latest deploy log https://app.netlify.com/projects/dev-bayanflow/deploys/6a413e8a1b953300086bc1c5
😎 Deploy Preview https://deploy-preview-194--dev-bayanflow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added documentation Improvements or additions to documentation style Improve styling, design, and animation tests labels Jun 28, 2026
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f1e310e4-03ad-4b59-bbe1-420c9809ac1a

📥 Commits

Reviewing files that changed from the base of the PR and between 54cff7a and fca457c.

📒 Files selected for processing (2)
  • src/components/LegalDocument.jsx
  • src/components/LegalDocument.test.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/LegalDocument.jsx

📝 Walkthrough

Walkthrough

Adds app.pageTitle translation keys for English, Arabic, and French. Updates DocumentTitle to use app.pageTitle for /app. Adds mount-time scroll-to-top behavior in LegalDocument. Updates README feature table labels from “Mode” to “Category”.

Changes

app.pageTitle i18n key, DocumentTitle fix, and LegalDocument scroll

Layer / File(s) Summary
app.pageTitle translation keys
src/i18n/locales/en/translation.json, src/i18n/locales/ar/translation.json, src/i18n/locales/fr/translation.json
Adds a new top-level app.pageTitle key to all three locale files.
DocumentTitle /app route update and test
src/components/DocumentTitle.jsx, src/components/DocumentTitle.test.jsx
Changes ROUTE_TITLE_KEYS['/app'] from header.title to app.pageTitle and adds a test asserting the resulting document.title.
LegalDocument scroll-to-top and test mock
src/components/LegalDocument.jsx, src/components/LegalDocument.test.jsx
Imports useEffect and adds a mount effect calling window.scrollTo(0, 0) when no hash is present; mocks window.scrollTo in tests.
README table labels
README.md
Updates the features table header row from “Mode” to “Category” framing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐇 New title keys hop into place,
The app gets named in every case,
A gentle scroll, a table tune,
And rabbit thumbs-up to the moon! 🌙

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 title accurately summarizes the two main fixes: the /app page title duplication and scroll-to-top behavior on privacy/terms pages.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch quick-fix/small-tweaks

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


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

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown

Preview for Bayan Flow Staging ready!

Name Link
🔨 Latest commit fca457c
🔍 Latest deploy log https://github.com/ayoub3bidi/bayan-flow/actions/runs/28327125187
😎 Deploy Preview https://pr-194-bayan-flow-staging.ayoub3bidi.workers.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

Preview alias pr-194 on the staging worker. Updates automatically with new commits.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 647c45b and 54cff7a.

📒 Files selected for processing (8)
  • README.md
  • src/components/DocumentTitle.jsx
  • src/components/DocumentTitle.test.jsx
  • src/components/LegalDocument.jsx
  • src/components/LegalDocument.test.jsx
  • src/i18n/locales/ar/translation.json
  • src/i18n/locales/en/translation.json
  • src/i18n/locales/fr/translation.json

Comment thread src/components/LegalDocument.jsx
Scroll-to-top now checks window.location.hash first, so URLs
like /privacy#section jump to the anchor instead of being
overridden.
@ayoub3bidi ayoub3bidi self-assigned this Jun 28, 2026
@ayoub3bidi
ayoub3bidi merged commit 99f4a31 into develop Jun 28, 2026
16 checks passed
@ayoub3bidi
ayoub3bidi deleted the quick-fix/small-tweaks branch June 28, 2026 15:34
@ayoub3bidi ayoub3bidi mentioned this pull request Jul 16, 2026
35 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation style Improve styling, design, and animation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant