Skip to content

feat(web): restore header search icon on non-home pages#249

Merged
mrviduus merged 2 commits into
mainfrom
feat/header-search-icon
May 24, 2026
Merged

feat(web): restore header search icon on non-home pages#249
mrviduus merged 2 commits into
mainfrom
feat/header-search-icon

Conversation

@mrviduus
Copy link
Copy Markdown
Owner

Summary

User-reported regression: search is no longer discoverable on inner pages.

"пожалуйста добавить иконку поиска и поиск в хедер я знаю мы его удаляли но по моему он нам нужен потому что сейчас не очевидно где его искать"

Search icon was removed in 3e53e3e ("clean header") on the assumption that the hero search input on home was enough. It wasn't — on every other page (library, discover, vocabulary, reader, book detail, …) the hero is gone and users have no entry point to search.

Changes

  • Header.tsx — re-import MobileSearchOverlay, add useLocation + isHomePage regex (/^\/(en|uk)?\/?$/ — covers /, /en, /en/, /uk, /uk/), render search icon button only when !isHomePage. Clicking opens the overlay (was orphaned in Search.tsx, now wired back up). Wired to existing emit('header.click', { item: 'search' }) telemetry channel.
  • en.jsonnav.search i18n key.
  • Header.test.tsx — +10 cases:
    • icon hidden on /, /en, /en/, /uk (home variants)
    • icon visible on /en/library, /en/discover, /en/vocabulary, /en/books/foo (inner pages)
    • clicking icon opens overlay
    • overlay close button removes it

Why keep home iconless

Home's HeroSection renders a prominent full-width search input. Putting a second search icon in the header would be visual duplication and pull attention away from the hero. On every other route the hero is gone — that's where we need the chrome affordance.

Tests

  • pnpm test — 484 passed (was 474, +10 new Header cases)
  • pnpm tsc --noEmit — clean
  • Manual Playwright snapshot:
    • /en/ header: Upload + dark_mode + Sign in (no search icon ✓)
    • /en/books/ header: Upload + Search + dark_mode + Sign in (search icon present ✓)

Rollback plan

Single revert — git revert <merge-sha>. No DB / API / behaviour changes. Pure UI restore.

Notes

  • MobileSearchOverlay was already maintained in Search.tsx (used by HeroSection). This PR just adds a second call-site; no new component code.
  • The isHomePage regex matches both /en and /uk roots — if a third locale lands, extend the alternation.
  • Telemetry event header.click already exists; new item: 'search' value will start showing up in dashboards immediately after merge.

🤖 Generated with Claude Code

mrviduus and others added 2 commits May 24, 2026 14:15
Search icon was removed in 3e53e3e (clean header) on the assumption that
the hero search on home was enough. It wasn't — on every other page (library,
discover, vocabulary, reader, etc) the hero is gone and users had nowhere to
launch a search from. User report: 'не очевидно где его искать'.

Re-add the search icon to Header.tsx, but only on non-home routes. Home
keeps the prominent hero input (no duplicate UI in chrome). The icon opens
the existing MobileSearchOverlay component (was orphaned in Search.tsx
after the removal, now wired back up).

- isHomePage check: /^\/(en|uk)?\/?$/ — covers /, /en, /en/, /uk, /uk/
- nav.search i18n key added (en.json)
- Telemetry: emit('header.click', { item: 'search' })
- +10 Header tests covering visibility per route + open/close overlay flow
- Total Header tests: 4 → 14; web suite 474 → 484

Tested manually via Playwright:
- /en/ — no search icon in header (hero search present)
- /en/books/ — search icon visible, clicking it opens overlay

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mrviduus mrviduus merged commit c4423a0 into main May 24, 2026
5 checks passed
@mrviduus mrviduus deleted the feat/header-search-icon branch May 24, 2026 18:23
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