Skip to content

feat: add global search, mobile drawer navigation, and View Transitions fixes#44

Merged
lyj715824 merged 1 commit into
mainfrom
feat-search
Jul 3, 2026
Merged

feat: add global search, mobile drawer navigation, and View Transitions fixes#44
lyj715824 merged 1 commit into
mainfrom
feat-search

Conversation

@dongjiang1989

Copy link
Copy Markdown
Contributor

Summary

  • Global Search: Add Ctrl+K / ⌘K search modal powered by Fuse.js with lazy-loaded build-time index (/search-index.json), fuzzy matching across blog posts, projects, adopters, events, and static
    pages, bilingual support (zh/en), keyboard navigation, match highlighting, and View Transitions compatibility
  • Mobile Drawer Navigation: Replace hamburger-expanded nav with a slide-in drawer panel featuring tree-structured 2-level navigation, theme/language toggles in drawer footer, backdrop overlay,
    ESC/backdrop/link-click dismiss, and auto-close on desktop resize
  • Adopter Modal Reliability: Move adopter modal to Layout-level component to fix View Transitions breakage; add retry mechanism and data reload on every open/swap for multi-cycle reliability
  • Landscape Mobile Fix: Replace CSS-only transform: scale() with JS dynamic wrapper height to eliminate excess scroll space on mobile
  • Project Detail Icons: Render project icon images on detail pages with first-letter gradient fallback

Changes

Added

  • SearchModal.astro — global search with Fuse.js, lazy-loaded index, grouped results, <mark> highlighting, ↑↓/Enter/Esc
  • SearchButton.astro — header search trigger button
  • search-index.json.ts — build-time endpoint aggregating 5 content sources (posts, projects, adopters, events, pages)
  • AdopterModal.astro — Layout-level adopter detail modal with hash routing and retry mechanism
  • events.ts — shared event data source for events page and search index
  • Mobile drawer (#mobile-drawer) with tree-structured nav, connector dots, backdrop blur
  • Project detail page icon rendering (data.icon<img>, fallback → gradient circle)

Changed

  • Header.astro — mobile drawer with tree nav; ToggleTheme/ToggleLanguage wrapped in hidden md:flex
  • Layout.astro — include AdopterModal at Layout level
  • BasicScripts.astro — remove conflicting mobile menu handlers (h-screen/bg-page/overflow-hidden)
  • adopters.astro — remove inline modal HTML/JS (moved to AdopterModal.astro)
  • landscape.astro — JS scaleLandscape() with dynamic wrapper height on resize/swap
  • navigation.ts — add href to "博客" nav link
  • .cache/ — refresh project stats (⭐18,727) and contributors (170 from 60 repos)

Fixed

  • Search modal DOM refs stale after View Transitions page swap → refreshRefs() + attachElementListeners()
  • Adopter modal broken after navigation/multi-cycle → loadAdopterData() on every open + astro:after-swap
  • Adopter direct URL hash not showing card → retry mechanism (20 × 50ms)
  • Same-page hash navigation from search results → preventDefault() + manual window.location.hash
  • aria-hidden focus warning → blur() before hiding modal
  • Window resize losing search box → removed offending hidden class toggle in BasicScripts
  • Desktop theme/language toggles visible on mobile → hidden md:flex wrapper divs
  • "博客" nav link not navigating → added href: getBlogPermalink()
  • Astro hints → added is:inline to AdopterModal JSON script, removed deprecated position="right"

Which issue(s) this PR fixes:

Fixes #

Special notes for reviewers:

Add global search, mobile drawer navigation, and View Transitions fixes

Signed-off-by: dongjiang <dongjiang1989@126.com>
@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Jul 3, 2026 6:02am

@lyj715824 lyj715824 merged commit e7188ba into main Jul 3, 2026
12 checks passed
@dongjiang1989 dongjiang1989 deleted the feat-search branch July 3, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants