refactor: search

This commit is contained in:
codytseng 2025-08-31 22:43:47 +08:00
parent 88567c2c13
commit 0153465e29
24 changed files with 785 additions and 345 deletions

View file

@ -1,18 +1,19 @@
import { useSecondaryPage } from '@/PageManager'
import BookmarkList from '@/components/BookmarkList'
import PostEditor from '@/components/PostEditor'
import { Button } from '@/components/ui/button'
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout'
import { toSearch } from '@/lib/link'
import { useFeed } from '@/providers/FeedProvider'
import { useNostr } from '@/providers/NostrProvider'
import { useScreenSize } from '@/providers/ScreenSizeProvider'
import { TPageRef } from '@/types'
import { PencilLine } from 'lucide-react'
import { PencilLine, Search } from 'lucide-react'
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import FeedButton from './FeedButton'
import FollowingFeed from './FollowingFeed'
import RelaysFeed from './RelaysFeed'
import SearchButton from './SearchButton'
const NoteListPage = forwardRef((_, ref) => {
const { t } = useTranslation()
@ -76,10 +77,12 @@ function NoteListPageTitlebar() {
return (
<div className="flex gap-1 items-center h-full justify-between">
<FeedButton className="flex-1 max-w-fit w-0" />
<div className="shrink-0 flex gap-1 items-center">
<SearchButton />
{isSmallScreen && <PostButton />}
</div>
{isSmallScreen && (
<div className="shrink-0 flex gap-1 items-center">
<SearchButton />
<PostButton />
</div>
)}
</div>
)
}
@ -106,3 +109,13 @@ function PostButton() {
</>
)
}
function SearchButton() {
const { push } = useSecondaryPage()
return (
<Button variant="ghost" size="titlebar-icon" onClick={() => push(toSearch())}>
<Search />
</Button>
)
}