|
|
@@ -1,14 +1,13 @@
|
|
|
"use client";
|
|
|
|
|
|
-import { MagnifyingGlass } from "@phosphor-icons/react/dist/ssr/MagnifyingGlass";
|
|
|
import { XCircle } from "@phosphor-icons/react/dist/ssr/XCircle";
|
|
|
import { Badge } from "@pythnetwork/component-library/Badge";
|
|
|
import type { Props as ButtonProps } from "@pythnetwork/component-library/Button";
|
|
|
import { Button } from "@pythnetwork/component-library/Button";
|
|
|
import { NoResults } from "@pythnetwork/component-library/NoResults";
|
|
|
+import { SearchButton as SearchButtonComponent } from "@pythnetwork/component-library/SearchButton";
|
|
|
import { SearchInput } from "@pythnetwork/component-library/SearchInput";
|
|
|
import { SingleToggleGroup } from "@pythnetwork/component-library/SingleToggleGroup";
|
|
|
-import { Skeleton } from "@pythnetwork/component-library/Skeleton";
|
|
|
import {
|
|
|
ListLayout,
|
|
|
Virtualizer,
|
|
|
@@ -23,7 +22,6 @@ import { useLogger } from "@pythnetwork/component-library/useLogger";
|
|
|
import { matchSorter } from "match-sorter";
|
|
|
import type { ReactNode } from "react";
|
|
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
|
-import { useIsSSR } from "react-aria";
|
|
|
|
|
|
import { Cluster, ClusterToName } from "../../services/pyth";
|
|
|
import { AssetClassBadge } from "../AssetClassBadge";
|
|
|
@@ -74,31 +72,7 @@ const ResolvedSearchButton = (props: ResolvedSearchButtonProps) => {
|
|
|
|
|
|
const SearchButtonImpl = (
|
|
|
props: Omit<ButtonProps<typeof UnstyledButton>, "children">,
|
|
|
-) => (
|
|
|
- <div className={styles.searchButton}>
|
|
|
- <Button
|
|
|
- className={styles.largeScreenSearchButton ?? ""}
|
|
|
- variant="outline"
|
|
|
- beforeIcon={<MagnifyingGlass />}
|
|
|
- size="sm"
|
|
|
- rounded
|
|
|
- {...props}
|
|
|
- >
|
|
|
- <SearchShortcutText />
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- className={styles.smallScreenSearchButton ?? ""}
|
|
|
- hideText
|
|
|
- variant="ghost"
|
|
|
- beforeIcon={<MagnifyingGlass />}
|
|
|
- size="sm"
|
|
|
- rounded
|
|
|
- {...props}
|
|
|
- >
|
|
|
- Search
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
-);
|
|
|
+) => <SearchButtonComponent size="sm" {...props} />;
|
|
|
|
|
|
const useSearchDrawer = ({ feeds, publishers }: ResolvedSearchButtonProps) => {
|
|
|
const drawer = useDrawer();
|
|
|
@@ -152,16 +126,6 @@ const useSearchHotkey = (openSearchDrawer: () => void) => {
|
|
|
}, [handleKeyDown]);
|
|
|
};
|
|
|
|
|
|
-const SearchShortcutText = () => {
|
|
|
- const isSSR = useIsSSR();
|
|
|
- return isSSR ? <Skeleton width={7} /> : <SearchTextImpl />;
|
|
|
-};
|
|
|
-
|
|
|
-const SearchTextImpl = () => {
|
|
|
- const isMac = useMemo(() => navigator.userAgent.includes("Mac"), []);
|
|
|
- return isMac ? "⌘ K" : "Ctrl K";
|
|
|
-};
|
|
|
-
|
|
|
type SearchDialogContentsProps = ResolvedSearchButtonProps;
|
|
|
|
|
|
const SearchDialogContents = ({
|