From f0a2244816881ffcabab51a5da1bde15be7da050 Mon Sep 17 00:00:00 2001 From: ilya Date: Wed, 13 Nov 2024 16:34:46 +0200 Subject: [PATCH 01/32] change SetOptions --- .../AccountInfo/TransactionIcon/ui/index.tsx | 6 ++++-- src/views/Layout/layout.tsx | 14 ++++---------- src/widgets/OperationTypes/SetOptions/ui/index.tsx | 13 ++++++++++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/entities/AccountInfo/TransactionIcon/ui/index.tsx b/src/entities/AccountInfo/TransactionIcon/ui/index.tsx index a23834b..bd7bc48 100644 --- a/src/entities/AccountInfo/TransactionIcon/ui/index.tsx +++ b/src/entities/AccountInfo/TransactionIcon/ui/index.tsx @@ -76,7 +76,7 @@ const TransactionIcon: FC = ({ }), ...(sourceAccount && { sourceAccountForSetOptions: sourceAccount }), ...(weight != null && { weight: weight.toString() }), - ...(masterWeight != null && { masterWeight: masterWeight.toString() }), + ...(operationThresholds && { operationThresholds: [ operationThresholds.low_threshold != null ? operationThresholds.low_threshold.toString() : "", @@ -91,7 +91,9 @@ const TransactionIcon: FC = ({ ...(flags?.auth_revocable && { auth_revocable: "true" }), }; - + if (typeof masterWeight === 'number' && !isNaN(masterWeight)) { + params.masterWeight = masterWeight.toString(); + } if (baseFee !== previousBaseFee.current) { params.baseFee = baseFee?.toString() || ""; } diff --git a/src/views/Layout/layout.tsx b/src/views/Layout/layout.tsx index a26ed62..af2e924 100644 --- a/src/views/Layout/layout.tsx +++ b/src/views/Layout/layout.tsx @@ -91,7 +91,6 @@ const PageLayout: FC = ({ children }) => { useEffect(() => { let intervalId: ReturnType | null = null; - let timeoutId: ReturnType | null = null; const fetchLatestCommitHash = async () => { if (!isDomainAllowed()) { @@ -119,15 +118,10 @@ const PageLayout: FC = ({ children }) => { setCommitHash(latestHash); if (lastFetchedHash && latestHash !== lastFetchedHash) { - console.log("Version changed"); - console.log(latestHash); - console.log(lastFetchedHash); - if (timeoutId) clearTimeout(timeoutId); - - timeoutId = setTimeout(() => { - setShowPopup(true); - }, 60000); + console.log("Version changed. Reloading page..."); + window.location.reload(); // Перезагрузка страницы при обнаружении новой версии } + setLastFetchedHash(latestHash); } catch (error) { console.warn("Error fetching commit hash (maybe, your token is wrong):", error); @@ -160,7 +154,7 @@ const PageLayout: FC = ({ children }) => { document.addEventListener("visibilitychange", handleVisibilityChange); - fetchLatestCommitHash(); + fetchLatestCommitHash(); // Изначальный запуск проверки startPolling(); return () => { diff --git a/src/widgets/OperationTypes/SetOptions/ui/index.tsx b/src/widgets/OperationTypes/SetOptions/ui/index.tsx index 00afb93..095b2d6 100644 --- a/src/widgets/OperationTypes/SetOptions/ui/index.tsx +++ b/src/widgets/OperationTypes/SetOptions/ui/index.tsx @@ -307,7 +307,7 @@ const SetOptions: FC = ({ id }) => { useEffect(() => { const params = new URLSearchParams(window.location.search); - params.set("masterWeight", masterWeight ? masterWeight.toString() : "none"); + params.set("masterWeight", masterWeight ? masterWeight.toString() : ""); window.history.replaceState({}, "", `?${params.toString()}`); }, [masterWeight]); @@ -339,9 +339,16 @@ const SetOptions: FC = ({ id }) => { useEffect(() => { const params = new URLSearchParams(window.location.search); - params.set("masterWeight", masterWeightValue); + + // Проверяем, что значение является числом, прежде чем добавлять его в параметры + if (typeof masterWeight === 'number' && !isNaN(masterWeight)) { + params.set("masterWeight", masterWeight?.toString() ?? ""); + } else { + params.delete("masterWeight"); // Удаляем параметр, если он невалиден + } + window.history.replaceState({}, "", `?${params.toString()}`); - }, [masterWeightValue]); + }, [masterWeight]); return ( <> From e9b1d25a093cf6a36fa68be984c96169f76f7a66 Mon Sep 17 00:00:00 2001 From: ilya Date: Wed, 13 Nov 2024 16:36:59 +0200 Subject: [PATCH 02/32] fix deploy --- src/views/Layout/layout.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/Layout/layout.tsx b/src/views/Layout/layout.tsx index af2e924..530c3c4 100644 --- a/src/views/Layout/layout.tsx +++ b/src/views/Layout/layout.tsx @@ -27,7 +27,7 @@ const PageLayout: FC = ({ children }) => { process.env.NEXT_PUBLIC_COMMIT_HASH ?? "" ); const pathname = usePathname(); - const [showPopup, setShowPopup] = useState(false); + // const [showPopup, setShowPopup] = useState(false); const [lastFetchedHash, setLastFetchedHash] = useState(null); const { theme, @@ -154,7 +154,7 @@ const PageLayout: FC = ({ children }) => { document.addEventListener("visibilitychange", handleVisibilityChange); - fetchLatestCommitHash(); // Изначальный запуск проверки + fetchLatestCommitHash(); startPolling(); return () => { @@ -227,7 +227,7 @@ const PageLayout: FC = ({ children }) => { {children}