diff --git a/package-lock.json b/package-lock.json index 8470b686..61d3665f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "simple-staking", - "version": "0.3.12", + "version": "0.3.13", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "simple-staking", - "version": "0.3.12", + "version": "0.3.13", "dependencies": { "@babylonlabs-io/btc-staking-ts": "0.3.0", "@bitcoin-js/tiny-secp256k1-asmjs": "2.2.3", diff --git a/package.json b/package.json index 35aa0848..3d646b32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-staking", - "version": "0.3.12", + "version": "0.3.13", "private": true, "scripts": { "dev": "next dev", diff --git a/src/app/components/Staking/FinalityProviders/FinalityProviderSearch.tsx b/src/app/components/Staking/FinalityProviders/FinalityProviderSearch.tsx index 65f3f9b2..15c99b95 100644 --- a/src/app/components/Staking/FinalityProviders/FinalityProviderSearch.tsx +++ b/src/app/components/Staking/FinalityProviders/FinalityProviderSearch.tsx @@ -1,4 +1,5 @@ import { useDebounce } from "@uidotdev/usehooks"; +import { useSearchParams } from "next/navigation"; import React, { useEffect, useState } from "react"; import { FiSearch } from "react-icons/fi"; @@ -9,11 +10,17 @@ interface FinalityProviderSearchProps { export const FinalityProviderSearch: React.FC = ({ onSearch, }) => { - const [searchTerm, setSearchTerm] = useState(""); + // Get the finality provider from the search params + const searchParams = useSearchParams(); + const initialSearchFp = searchParams.get("fp"); + + const [searchTerm, setSearchTerm] = useState(initialSearchFp); const debouncedSearchTerm = useDebounce(searchTerm, 300); useEffect(() => { - onSearch(debouncedSearchTerm); + if (debouncedSearchTerm) { + onSearch(debouncedSearchTerm); + } }, [debouncedSearchTerm, onSearch]); const handleSearch = (e: React.ChangeEvent) => { @@ -29,7 +36,7 @@ export const FinalityProviderSearch: React.FC = ({ diff --git a/src/app/page.tsx b/src/app/page.tsx index 43ac21e7..9d63f6a0 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -3,7 +3,7 @@ import { initBTCCurve } from "@babylonlabs-io/btc-staking-ts"; import { useInfiniteQuery, useQuery } from "@tanstack/react-query"; import { networks } from "bitcoinjs-lib"; -import { useCallback, useEffect, useState } from "react"; +import { Suspense, useCallback, useEffect, useState } from "react"; import { useLocalStorage } from "usehooks-ts"; import { useTermsAcceptance } from "@/app/hooks/useAcceptTerms"; @@ -28,6 +28,7 @@ import { Delegations } from "./components/Delegations/Delegations"; import { FAQ } from "./components/FAQ/FAQ"; import { Footer } from "./components/Footer/Footer"; import { Header } from "./components/Header/Header"; +import { LoadingView } from "./components/Loading/Loading"; import { ConnectModal } from "./components/Modals/ConnectModal"; import { ErrorModal } from "./components/Modals/ErrorModal"; import { FilterOrdinalsModal } from "./components/Modals/FilterOrdinalsModal"; @@ -287,7 +288,7 @@ const Home: React.FC = () => { }); } }, - [showError, hasSeenFilterOrdinalsModal], + [showError, hasSeenFilterOrdinalsModal, logTermsAcceptance], ); // Subscribe to account changes @@ -374,19 +375,21 @@ const Home: React.FC = () => { publicKeyNoCoord={publicKeyNoCoord} /> )} - + }> + + {btcWallet && delegations && paramWithContext?.nextBlockParams.currentVersion &&