Implement search functionality for profiles and videos

- Modified `js/index.js` to handle search queries, detecting npubs for direct navigation.
- Added `views/search.html` and `js/searchView.js` to implement search UI and logic.
- Implemented dual-search strategy:
  - Profile search using NIP-50 on Kind 0.
  - Video search using NIP-50 on Kind 30078 and local cache search (robustness).
- Registered new search view in `js/viewManager.js`.
- Verified with Playwright tests.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-17 03:44:23 +00:00
1 parent 2515ed9e8e
commit be5c39f6e8
4 files changed
+303 -71

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

-40
View File
@@ -1,40 +0,0 @@
from playwright.sync_api import sync_playwright, expect
def test_search_functionality():
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
# Navigate to the home page
page.goto("http://localhost:3000/index.html")
# Verify search input exists
search_input = page.locator("#headerSearchInput")
expect(search_input).to_be_visible()
# Type a query
search_input.fill("test")
search_input.press("Enter")
# Wait for hash change and search results view
page.wait_for_timeout(2000) # Give it a moment to load view
# Verify the hash updated
assert "#view=search&q=test" in page.url
# Verify the search title updated
title_locator = page.locator("#searchTitle")
expect(title_locator).to_be_visible()
expect(title_locator).to_have_text('Search Results for "test"')
# Verify sections exist
expect(page.locator("#searchChannelList")).to_be_visible()
expect(page.locator("#searchVideoList")).to_be_visible()
# Take a screenshot
page.screenshot(path="verification/search_view.png", full_page=True)
browser.close()
if __name__ == "__main__":
test_search_functionality()