diff options
| author | MohamedBassem <me@mbassem.com> | 2024-11-23 19:28:55 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-11-23 19:28:55 +0000 |
| commit | cc84e0177753af6e0517e855187b022d80be3226 (patch) | |
| tree | 55972ef2eb4f9723d53c912cccd6fb1c60adf180 /apps/mobile/app/dashboard/(tabs)/search.tsx | |
| parent | df19d399db3a84905d1efd913fcf923cdd508bb7 (diff) | |
| download | karakeep-cc84e0177753af6e0517e855187b022d80be3226.tar.zst | |
ui(mobile): Remove the dedicated search page and add a search bar in home
Diffstat (limited to 'apps/mobile/app/dashboard/(tabs)/search.tsx')
| -rw-r--r-- | apps/mobile/app/dashboard/(tabs)/search.tsx | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/apps/mobile/app/dashboard/(tabs)/search.tsx b/apps/mobile/app/dashboard/(tabs)/search.tsx deleted file mode 100644 index d29c3b05..00000000 --- a/apps/mobile/app/dashboard/(tabs)/search.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { useState } from "react"; -import { View } from "react-native"; -import BookmarkList from "@/components/bookmarks/BookmarkList"; -import FullPageError from "@/components/FullPageError"; -import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView"; -import FullPageSpinner from "@/components/ui/FullPageSpinner"; -import { Input } from "@/components/ui/Input"; -import PageTitle from "@/components/ui/PageTitle"; -import { api } from "@/lib/trpc"; -import { keepPreviousData } from "@tanstack/react-query"; -import { useDebounce } from "use-debounce"; - -export default function Search() { - const [search, setSearch] = useState(""); - - const [query] = useDebounce(search, 10); - - const onRefresh = api.useUtils().bookmarks.searchBookmarks.invalidate; - - const { data, error, refetch, isPending } = - api.bookmarks.searchBookmarks.useQuery( - { text: query }, - { placeholderData: keepPreviousData }, - ); - - if (error) { - return <FullPageError error={error.message} onRetry={() => refetch()} />; - } - - if (!data) { - return <FullPageSpinner />; - } - - return ( - <CustomSafeAreaView> - <BookmarkList - bookmarks={data.bookmarks} - header={ - <View> - <PageTitle title="Search" /> - <Input - placeholder="Search" - className="mx-1" - value={search} - onChangeText={setSearch} - autoFocus - autoCapitalize="none" - /> - </View> - } - onRefresh={onRefresh} - isRefreshing={isPending} - /> - </CustomSafeAreaView> - ); -} |
