Skip to content
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

WSTEAMA-1558 - Script switch refactor #12328

Open
wants to merge 19 commits into
base: latest
Choose a base branch
from

Conversation

amoore108
Copy link
Contributor

@amoore108 amoore108 commented Jan 22, 2025

Resolves JIRA https://jira.dev.bbc.co.uk/browse/WSTEAMA-1558

Overall changes

  • Refactors the Script switch button to remove scriptSwitchId logic, as well as logic tied to react-router-dom
  • This also allows the script switch button to be rendered in the Next.js app
  • Hides the script switch button on variant service topic pages for now as the back-end does not fully support transliterated topic pages end-to-end

Code changes

  • Refactors <ScriptLink /> component to simplify variant switching
  • Updates tests to reflect simpler implementation
  • Removes path-to-regexp library

Testing

  1. Visit http://localhost:7080/serbian/cyr/srbija-68707945?renderer_env=live
  2. Hover over the script switch button and confirm the url changes cyr to lat
  3. Click the link and confirm it takes you to the correct transliterated article (you will need to re-add ?renderer_env=live)
  4. Visit http://localhost:7080/serbian/cyr/srbija-68707945.amp?renderer_env=live
  5. Repeat the steps above for AMP (the link will have .amp removed, this is expected behaviour)
  6. Visit http://localhost:7080/serbian/cyr/srbija-68707945.lite?renderer_env=live
  7. Repeat the steps above for Lite
  8. Visit http://localhost:7080/serbian/cyr?renderer_env=live
  9. Hover over the script switch button and confirm the url changes cyr to lat
  10. Click the link and confirm it takes you to the correct transliterated homepage (you will need to re-add ?renderer_env=live)
  11. Visit http://localhost:7080/serbian/articles/cy9j40v4n75o/cyr?renderer_env=live
  12. Hover over the script switch button and confirm the url changes cyr to lat
  13. Click the link and confirm it takes you to the correct transliterated article (you will need to re-add ?renderer_env=live)
  14. Visit http://localhost:7080/serbian/lat/topics/c06g87137jgt?renderer_env=live
  15. Confirm the script switch button is not displayed

Helpful Links

Add Links to useful resources related to this PR if applicable.

Coding Standards

Repository use guidelines

@amoore108 amoore108 self-assigned this Jan 22, 2025
@amoore108 amoore108 changed the title Wsteama 1558 script switch refactor WSTEAMA-1558 - Script switch refactor Jan 22, 2025
src/server/index.jsx Outdated Show resolved Hide resolved
@amoore108 amoore108 changed the title WSTEAMA-1558 - Script switch refactor [DNM] WSTEAMA-1558 - Script switch refactor Jan 22, 2025
@amoore108 amoore108 marked this pull request as ready for review January 22, 2025 14:56
@amoore108 amoore108 changed the title [DNM] WSTEAMA-1558 - Script switch refactor WSTEAMA-1558 - Script switch refactor Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants