diff --git a/src/components/Preloader.tsx b/src/components/Preloader.tsx new file mode 100644 index 0000000..4316ce8 --- /dev/null +++ b/src/components/Preloader.tsx @@ -0,0 +1,44 @@ +import React, { useState, useEffect } from 'react'; + +interface PreloaderProps { + onLoadingComplete?: () => void; +} + +const Preloader: React.FC = ({ onLoadingComplete }) => { + const [isVisible, setIsVisible] = useState(true); + + useEffect(() => { + const timer = setTimeout(() => { + setIsVisible(false); + setTimeout(() => onLoadingComplete?.(), 500); // Wait for fade out + }, 2000); + + return () => clearTimeout(timer); + }, [onLoadingComplete]); + + if (!isVisible) return null; + + return ( +
+
Loading...
+
+ ); +}; + +export default Preloader; diff --git a/src/components/addresses/ContextualAddress.tsx b/src/components/addresses/ContextualAddress.tsx index 386731a..116eee2 100644 --- a/src/components/addresses/ContextualAddress.tsx +++ b/src/components/addresses/ContextualAddress.tsx @@ -34,6 +34,7 @@ noLink?: boolean; noTooltip?: boolean; className?: string; + children?: React.ReactNode; } export function ContextualAddress({ diff --git a/src/components/addresses/picker/AddressHint.tsx b/src/components/addresses/picker/AddressHint.tsx index efb19a6..dae90ef 100644 --- a/src/components/addresses/picker/AddressHint.tsx +++ b/src/components/addresses/picker/AddressHint.tsx @@ -12,6 +12,7 @@ nameHint?: boolean; stake?: number; wallet?: Wallet; + children?: React.ReactNode; } export function AddressHint({ address, nameHint, stake, wallet}: Props): JSX.Element { diff --git a/src/components/addresses/picker/AddressPicker.tsx b/src/components/addresses/picker/AddressPicker.tsx index ad196fc..3a7a6de 100644 --- a/src/components/addresses/picker/AddressPicker.tsx +++ b/src/components/addresses/picker/AddressPicker.tsx @@ -47,6 +47,7 @@ className?: string; tabIndex?: number; inputRef?: Ref; + children?: React.ReactNode; } export function AddressPicker({ diff --git a/src/pages/addresses/AddressPage.tsx b/src/pages/addresses/AddressPage.tsx index c8bf7b0..e0bb7f3 100644 --- a/src/pages/addresses/AddressPage.tsx +++ b/src/pages/addresses/AddressPage.tsx @@ -182,7 +182,7 @@ // Used to refresh the address data on syncNode change const syncNode = api.useSyncNode(); - const { address } = useParams(); + const { address } = useParams(); const [tenebraAddress, setTenebraAddress] = useState(); const [tenebraStake, setTenebraStake] = useState(); const [error, setError] = useState(); diff --git a/src/pages/blocks/BlockPage.tsx b/src/pages/blocks/BlockPage.tsx index b2eda8d..d091240 100644 --- a/src/pages/blocks/BlockPage.tsx +++ b/src/pages/blocks/BlockPage.tsx @@ -142,7 +142,7 @@ const syncNode = api.useSyncNode(); const { t } = useTranslation(); - const { id } = useParams(); + const { id } = useParams(); const [tenebraBlock, setTenebraBlock] = useState(); const [error, setError] = useState(); diff --git a/src/pages/names/NamePage.tsx b/src/pages/names/NamePage.tsx index df7a2b3..342a70c 100644 --- a/src/pages/names/NamePage.tsx +++ b/src/pages/names/NamePage.tsx @@ -186,7 +186,7 @@ const syncNode = api.useSyncNode(); const nameSuffix = useNameSuffix(); - const { name } = useParams(); + const { name } = useParams(); const [tenebraName, setTenebraName] = useState(); const [error, setError] = useState(); diff --git a/src/pages/names/NamesPage.tsx b/src/pages/names/NamesPage.tsx index 8ebf328..bb56f4d 100644 --- a/src/pages/names/NamesPage.tsx +++ b/src/pages/names/NamesPage.tsx @@ -66,7 +66,7 @@ export function NamesPage({ listingType, sortNew }: Props): JSX.Element { const { t } = useTranslation(); - const { address } = useParams(); + const { address } = useParams(); // If there is an error (e.g. the lookup rejected the address list due to an // invalid address), the table will bubble it up to here diff --git a/src/pages/settings/translations/exportCSV.ts b/src/pages/settings/translations/exportCSV.ts index 6f5f505..697c4de 100644 --- a/src/pages/settings/translations/exportCSV.ts +++ b/src/pages/settings/translations/exportCSV.ts @@ -1,7 +1,7 @@ // Copyright (c) 2020-2021 Drew Lemmy // This file is part of TenebraWeb 2 under AGPL-3.0. // Full details: https://github.com/tmpim/TenebraWeb2/blob/master/LICENSE.txt -import csvStringify from "csv-stringify"; +import { stringify as csvStringify } from "csv-stringify"; import { AnalysedLanguage } from "./analyseLangs"; diff --git a/src/pages/transactions/TransactionPage.tsx b/src/pages/transactions/TransactionPage.tsx index 490ecd1..ea729a2 100644 --- a/src/pages/transactions/TransactionPage.tsx +++ b/src/pages/transactions/TransactionPage.tsx @@ -136,7 +136,7 @@ const syncNode = api.useSyncNode(); const { t } = useTranslation(); - const { id } = useParams(); + const { id } = useParams(); const [tenebraTransaction, setTenebraTransaction] = useState(); const [error, setError] = useState(); diff --git a/src/pages/transactions/TransactionsPage.tsx b/src/pages/transactions/TransactionsPage.tsx index 106a756..9dc4bae 100644 --- a/src/pages/transactions/TransactionsPage.tsx +++ b/src/pages/transactions/TransactionsPage.tsx @@ -179,7 +179,7 @@ const { t } = useTranslation(); // Derive the lookup parameters from the URL - const urlParams = useParams(); + const urlParams = useParams(); const location = useLocation(); const { address, name, query } = getParams(listingType, urlParams, location);