Skip to content

feat: hide LA promo banner on authentication screens - #3558

Open
dcschreiber wants to merge 5 commits into
masterfrom
chore/sc-46176/remove-la-promo-from-login-and-register
Open

feat: hide LA promo banner on authentication screens#3558
dcschreiber wants to merge 5 commits into
masterfrom
chore/sc-46176/remove-la-promo-from-login-and-register

Conversation

@dcschreiber

@dcschreiber dcschreiber commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

(Claude and Codex writing on Daniel's behalf)

What

Hides the Library Assistant promo banner (ChatbotExperimentBanner) on authentication and password-recovery screens:

  • /login
  • /register
  • the complete /password/reset/... route family

Shortcut story: https://app.shortcut.com/sefaria/story/46176

Why

These screens should remain focused on authentication or account recovery. The Library Assistant already opens automatically after successful login or registration, so promoting it there is redundant.

How

The banner keeps a small, product-specific path policy local to SiteWideBanner.jsx. It gets the path from the existing SSR-safe Sefaria.util.currentPath(), resolves it with the native URL parser against Sefaria.getModuleURL() (the configured active-module/interface-language domain), and checks one array of excluded route roots with a segment boundary. This covers the password-reset family while leaving unrelated paths such as /password/resetting eligible.

There is no existing reusable frontend auth-path classifier. The broader headerMode abstraction was deliberately not used because it also covers ordinary static/about pages where sitewide banners remain valid.

How tested

Focused Jest coverage verifies:

  • login and registration, including trailing slashes and query strings
  • reset form, confirmation, done, and complete paths
  • similarly named non-auth paths are not accidentally excluded

npx jest static/js/tests/siteWideBanner.test.js --runInBand --no-watchman --roots static/js __mocks__ passes: 23 tests.

The Library Assistant opens automatically after login/registration, so
promoting it on the auth screens is redundant. The banner gate now
excludes /login and /register (tolerating trailing slashes and query
strings) via an SSR-safe path check.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dcschreiber
dcschreiber marked this pull request as ready for review July 29, 2026 15:32
@gitvelocity-reviewer

Copy link
Copy Markdown

📊 Code Quality Score: 7/100

26 × 0.25 = 6.5, rounded to 7

Category Score Factors
🔭 Scope 4/20 2 files, single component, localized banner suppression logic
🏗️ Architecture 3/20 Extracts small utility function, exports it for testability; no new patterns or dependencies
⚙️ Implementation 5/20 Path normalization with regex (split on [?#], strip trailing slash, fallback to /); early return guard after hooks
⚠️ Risk 3/20 Additive change, easily reversible, no data or API changes; minor case-sensitivity assumption
✅ Quality 10/15 30-line test file covering exact matches, trailing slashes, query strings, hashes, and non-excluded paths; clear inline comment explaining rationale
🔒 Perf / Security 1/5 No performance or security concerns; minimal regex on every render is negligible

Was this score accurate? 👍 Yes · 👎 No

Scored by GitVelocity · How are scores calculated?

@dcschreiber dcschreiber changed the title feat: hide LA promo banner on login and register screens feat: hide LA promo banner on authentication screens Jul 30, 2026
dcschreiber and others added 3 commits July 30, 2026 14:08
getModuleURL returns false when it cannot construct a URL, and during
server-side rendering apiHost is empty, so new URL(path, false) would
throw inside the component render and crash SSR for the page. Fall back
to a static base (only the pathname is used) and fail open on
unparseable input.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dcschreiber
dcschreiber requested a review from akiva10b July 30, 2026 11:49
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.

1 participant