From 551dbf162b5d25cf9b11b50d1bb23298f6d6bed7 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Mon, 11 Mar 2024 12:21:19 -0400 Subject: [PATCH 01/14] Remove a useMemo which wasn't doing any expensive calculations --- .../ui/proposal/ProposalCountdown.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/components/ui/proposal/ProposalCountdown.tsx b/src/components/ui/proposal/ProposalCountdown.tsx index f73e7456eb..beff5bdb3a 100644 --- a/src/components/ui/proposal/ProposalCountdown.tsx +++ b/src/components/ui/proposal/ProposalCountdown.tsx @@ -31,16 +31,13 @@ export function ProposalCountdown({ const state: FractalProposalState | null = useMemo(() => proposal.state, [proposal]); const { isSnapshotProposal } = useSnapshotProposal(proposal); - const showCountdown = useMemo( - () => - !!secondsLeft && - secondsLeft > 0 && - (state === FractalProposalState.ACTIVE || - state === FractalProposalState.TIMELOCKED || - state === FractalProposalState.EXECUTABLE || - isSnapshotProposal), - [state, secondsLeft, isSnapshotProposal], - ); + const showCountdown = + !!secondsLeft && + secondsLeft > 0 && + (state === FractalProposalState.ACTIVE || + state === FractalProposalState.TIMELOCKED || + state === FractalProposalState.EXECUTABLE || + isSnapshotProposal); if (!showCountdown) return null; From 32478ac594b157551450e96c657fa7bd7a802a72 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Mon, 11 Mar 2024 12:27:38 -0400 Subject: [PATCH 02/14] Create simple booleans to check if segments should be shown or not Importantly, show a segment if the segment to the left is shown, OR, it's greater than 0. --- src/components/ui/proposal/ProposalCountdown.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/ui/proposal/ProposalCountdown.tsx b/src/components/ui/proposal/ProposalCountdown.tsx index beff5bdb3a..66852cf456 100644 --- a/src/components/ui/proposal/ProposalCountdown.tsx +++ b/src/components/ui/proposal/ProposalCountdown.tsx @@ -64,6 +64,11 @@ export function ProposalCountdown({ const hoursLeft = Math.floor((secondsLeft! / (60 * 60)) % 24); const minutesLeft = Math.floor((secondsLeft! / 60) % 60); + const showDays = daysLeft > 0; + const showHours = showDays || hoursLeft > 0; + const showMinutes = showHours || minutesLeft > 0; + const showSeconds = secondsLeft >= 0; + return ( - {daysLeft > 0 && `${zeroPad(daysLeft)}:`} - {hoursLeft > 0 && `${zeroPad(hoursLeft)}:`} - {minutesLeft > 0 && `${zeroPad(minutesLeft)}:`} - {secondsLeft! >= 0 && `${zeroPad(secondsLeft! % 60)}`} + {showDays && `${zeroPad(daysLeft)}:`} + {showHours && `${zeroPad(hoursLeft)}:`} + {showMinutes && `${zeroPad(minutesLeft)}:`} + {showSeconds && `${zeroPad(secondsLeft % 60)}`} From 2940014ca8de34e5d911ecdfbed88ab57eae7ef7 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Mon, 11 Mar 2024 14:20:20 -0400 Subject: [PATCH 03/14] Clean up consistency and remove unnecessary "!"s --- src/components/ui/proposal/ProposalCountdown.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/ui/proposal/ProposalCountdown.tsx b/src/components/ui/proposal/ProposalCountdown.tsx index 66852cf456..c7d0ac17c3 100644 --- a/src/components/ui/proposal/ProposalCountdown.tsx +++ b/src/components/ui/proposal/ProposalCountdown.tsx @@ -25,15 +25,15 @@ export function ProposalCountdown({ proposal: FractalProposal; showIcon?: boolean; }) { - const secondsLeft = useProposalCountdown(proposal); + const totalSecondsLeft = useProposalCountdown(proposal); const { t } = useTranslation('proposal'); const state: FractalProposalState | null = useMemo(() => proposal.state, [proposal]); const { isSnapshotProposal } = useSnapshotProposal(proposal); const showCountdown = - !!secondsLeft && - secondsLeft > 0 && + !!totalSecondsLeft && + totalSecondsLeft > 0 && (state === FractalProposalState.ACTIVE || state === FractalProposalState.TIMELOCKED || state === FractalProposalState.EXECUTABLE || @@ -60,9 +60,10 @@ export function ProposalCountdown({ ? Execute : null; - const daysLeft = Math.floor(secondsLeft! / (60 * 60 * 24)); - const hoursLeft = Math.floor((secondsLeft! / (60 * 60)) % 24); - const minutesLeft = Math.floor((secondsLeft! / 60) % 60); + const daysLeft = Math.floor(totalSecondsLeft / (60 * 60 * 24)); + const hoursLeft = Math.floor((totalSecondsLeft / (60 * 60)) % 24); + const minutesLeft = Math.floor((totalSecondsLeft / 60) % 60); + const secondsLeft = Math.floor(totalSecondsLeft % 60); const showDays = daysLeft > 0; const showHours = showDays || hoursLeft > 0; @@ -90,7 +91,7 @@ export function ProposalCountdown({ {showDays && `${zeroPad(daysLeft)}:`} {showHours && `${zeroPad(hoursLeft)}:`} {showMinutes && `${zeroPad(minutesLeft)}:`} - {showSeconds && `${zeroPad(secondsLeft % 60)}`} + {showSeconds && `${zeroPad(secondsLeft)}`} From 7511dd676167c5a7c0afde64615fe3fb56b6927e Mon Sep 17 00:00:00 2001 From: David Colon <38386583+Da-Colon@users.noreply.github.com> Date: Tue, 12 Mar 2024 11:22:59 -0400 Subject: [PATCH 04/14] remove conditional blocking multisig deployment --- .../DaoCreator/hooks/usePrepareFormData.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/DaoCreator/hooks/usePrepareFormData.ts b/src/components/DaoCreator/hooks/usePrepareFormData.ts index 4bdde0509f..33ae1832c5 100644 --- a/src/components/DaoCreator/hooks/usePrepareFormData.ts +++ b/src/components/DaoCreator/hooks/usePrepareFormData.ts @@ -85,13 +85,11 @@ export function usePrepareFormData() { if (freezeGuard) { freezeGuardData = await prepareFreezeGuardData(freezeGuard); } - if (freezeGuardData) { - return { - trustedAddresses: resolvedAddresses, - ...freezeGuardData, - ...rest, - }; - } + return { + trustedAddresses: resolvedAddresses, + ...freezeGuardData, + ...rest, + }; }, [signer, prepareFreezeGuardData], ); From 14ba6c4eb15f8549817240cd598bd065e84820e7 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 12 Mar 2024 11:21:51 -0400 Subject: [PATCH 05/14] Don't log or show Price API communication errors in development --- src/providers/App/hooks/usePriceAPI.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/providers/App/hooks/usePriceAPI.ts b/src/providers/App/hooks/usePriceAPI.ts index 28fc0f8494..1ee58adbaf 100644 --- a/src/providers/App/hooks/usePriceAPI.ts +++ b/src/providers/App/hooks/usePriceAPI.ts @@ -41,6 +41,9 @@ export default function usePriceAPI() { } } } catch (e) { + // When doing local development, it's unlikely that the Pricing Service is going to be running locally, + // so don't worry about logging or showing the error toast. + if (process.env.NODE_ENV === 'development') return; logError('Error while getting tokens prices', e); toast.warning(t('tokenPriceFetchingError')); return; From 67299edbf3227b27d7e84902831143f42e2609e5 Mon Sep 17 00:00:00 2001 From: David Colon <38386583+Da-Colon@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:43:56 -0400 Subject: [PATCH 06/14] update decent-ui version - removes background gold glow --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 825913bcf9..fa8902a0e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "@apollo/client": "^3.7.10", "@chakra-ui/next-js": "^2.2.0", "@chakra-ui/react": "^2.8.2", - "@decent-org/fractal-ui": "^0.1.23", + "@decent-org/fractal-ui": "^0.1.24", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@ethersproject/abstract-signer": "^5.7.0", @@ -3448,9 +3448,9 @@ } }, "node_modules/@decent-org/fractal-ui": { - "version": "0.1.23", - "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.23.tgz", - "integrity": "sha512-2ML5Yzj60k4faIdWQ0LRV9X4704JcOq3cRKUmqDNjFmTWRktSuQ9yeCTk6OOqBOktLVD1Ca8FcE4HUm/P/8sMg==", + "version": "0.1.24", + "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.24.tgz", + "integrity": "sha512-Yts33E3MC996k7hXDns5oNiuLG/qHw6K4ovH9TtHciKKCpRq8ZSyiq0XDvOH0cv2bcB5jdEuH9HJuWMum3Nkfw==", "peerDependencies": { "@chakra-ui/react": "^2.3.4", "react": "^16 || ^17 || ^18", @@ -30976,9 +30976,9 @@ } }, "@decent-org/fractal-ui": { - "version": "0.1.23", - "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.23.tgz", - "integrity": "sha512-2ML5Yzj60k4faIdWQ0LRV9X4704JcOq3cRKUmqDNjFmTWRktSuQ9yeCTk6OOqBOktLVD1Ca8FcE4HUm/P/8sMg==", + "version": "0.1.24", + "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.24.tgz", + "integrity": "sha512-Yts33E3MC996k7hXDns5oNiuLG/qHw6K4ovH9TtHciKKCpRq8ZSyiq0XDvOH0cv2bcB5jdEuH9HJuWMum3Nkfw==", "requires": {} }, "@emotion/babel-plugin": { diff --git a/package.json b/package.json index dcff7f09e4..23f2c85b50 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "@apollo/client": "^3.7.10", "@chakra-ui/next-js": "^2.2.0", "@chakra-ui/react": "^2.8.2", - "@decent-org/fractal-ui": "^0.1.23", + "@decent-org/fractal-ui": "^0.1.24", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@ethersproject/abstract-signer": "^5.7.0", From 088fc1660f4c5f335b60011a893cea7b4b2c15b4 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 12 Mar 2024 14:48:32 -0400 Subject: [PATCH 07/14] Display the GMT timezone offset when displaying times --- src/utils/numberFormats.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/numberFormats.ts b/src/utils/numberFormats.ts index 07194f0ba0..14987105bc 100644 --- a/src/utils/numberFormats.ts +++ b/src/utils/numberFormats.ts @@ -2,7 +2,7 @@ import { SafeBalanceUsdResponse } from '@safe-global/safe-service-client'; import { BigNumber, ethers } from 'ethers'; import bigDecimal from 'js-big-decimal'; -export const DEFAULT_DATE_TIME_FORMAT = 'MMM dd, yyyy, h:mm aa'; +export const DEFAULT_DATE_TIME_FORMAT = 'MMM dd, yyyy, h:mm aa O'; export const DEFAULT_DATE_FORMAT = 'yyyy-MM-dd'; export const formatPercentage = ( From 9f9e8c99ab5fedd74cf966e3cac6ee1c2cbae936 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 12 Mar 2024 14:48:32 -0400 Subject: [PATCH 08/14] Add `date-fns-tz` library --- package-lock.json | 15 +++++++++++++++ package.json | 1 + 2 files changed, 16 insertions(+) diff --git a/package-lock.json b/package-lock.json index 825913bcf9..f93ef11060 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "axios": "^0.27.2", "classnames": "^2.3.1", "date-fns": "^2.29.3", + "date-fns-tz": "^2.0.1", "ethers": "^5.7.2", "evm-proxy-detection": "^1.1.0", "formik": "^2.2.9", @@ -14712,6 +14713,14 @@ "url": "https://opencollective.com/date-fns" } }, + "node_modules/date-fns-tz": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-2.0.1.tgz", + "integrity": "sha512-fJCG3Pwx8HUoLhkepdsP7Z5RsucUi+ZBOxyM5d0ZZ6c4SdYustq0VMmOu6Wf7bli+yS/Jwp91TOCqn9jMcVrUA==", + "peerDependencies": { + "date-fns": "2.x" + } + }, "node_modules/dayjs": { "version": "1.11.7", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", @@ -39526,6 +39535,12 @@ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==" }, + "date-fns-tz": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-2.0.1.tgz", + "integrity": "sha512-fJCG3Pwx8HUoLhkepdsP7Z5RsucUi+ZBOxyM5d0ZZ6c4SdYustq0VMmOu6Wf7bli+yS/Jwp91TOCqn9jMcVrUA==", + "requires": {} + }, "dayjs": { "version": "1.11.7", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", diff --git a/package.json b/package.json index dcff7f09e4..0f632e1d1b 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "axios": "^0.27.2", "classnames": "^2.3.1", "date-fns": "^2.29.3", + "date-fns-tz": "^2.0.1", "ethers": "^5.7.2", "evm-proxy-detection": "^1.1.0", "formik": "^2.2.9", From bf56ab1f40ff8107017c048dc05fe035491ea397 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 12 Mar 2024 14:48:32 -0400 Subject: [PATCH 09/14] Modify InfoRow to accept an optional "tooltip" string, and display a tooltip if appropriate --- .../MultisigProposalDetails/TxDetails.tsx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx b/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx index 32d4d2a3f2..39647e75ef 100644 --- a/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx +++ b/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx @@ -1,5 +1,6 @@ -import { Box, Divider, Flex, Text } from '@chakra-ui/react'; +import { Box, Divider, Flex, Text, Tooltip } from '@chakra-ui/react'; import { format } from 'date-fns'; +import { formatInTimeZone } from 'date-fns-tz'; import { useTranslation } from 'react-i18next'; import { BACKGROUND_SEMI_TRANSPARENT } from '../../../constants/common'; import { createAccountSubstring } from '../../../hooks/utils/useDisplayName'; @@ -8,14 +9,20 @@ import { DEFAULT_DATE_TIME_FORMAT } from '../../../utils/numberFormats'; import ContentBox from '../../ui/containers/ContentBox'; import DisplayTransaction from '../../ui/links/DisplayTransaction'; +function TransactionOrText({ txHash, value }: { txHash?: string | null; value?: string }) { + return txHash ? : {value}; +} + export function InfoRow({ property, value, txHash, + tooltip, }: { property: string; value?: string; txHash?: string | null; + tooltip?: string; }) { return ( {property} - {txHash ? : {value}} + {tooltip === undefined ? ( + + ) : ( + + + + )} ); } From 70ebebde16557f5fffeb16879ccd4eca0eed89ae Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 12 Mar 2024 14:48:33 -0400 Subject: [PATCH 10/14] Pass in GMT-formatted dates to display in tooltips for proposal start/end dates --- src/components/Proposals/MultisigProposalDetails/TxDetails.tsx | 3 ++- src/components/Proposals/ProposalSummary.tsx | 3 +++ .../SnapshotProposalDetails/SnapshotProposalSummary.tsx | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx b/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx index 39647e75ef..56de394a06 100644 --- a/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx +++ b/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx @@ -73,7 +73,8 @@ export function TxDetails({ proposal }: { proposal: MultisigProposal }) { /> Date: Tue, 12 Mar 2024 14:48:33 -0400 Subject: [PATCH 11/14] Move the InfoRow component out of MultisigProposalDetails directory --- .../MultisigProposalDetails/TxDetails.tsx | 47 +------------------ src/components/Proposals/ProposalSummary.tsx | 2 +- .../SnapshotProposalSummary.tsx | 2 +- src/components/ui/proposal/InfoRow.tsx | 45 ++++++++++++++++++ 4 files changed, 49 insertions(+), 47 deletions(-) create mode 100644 src/components/ui/proposal/InfoRow.tsx diff --git a/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx b/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx index 56de394a06..45e72c0edd 100644 --- a/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx +++ b/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx @@ -1,4 +1,4 @@ -import { Box, Divider, Flex, Text, Tooltip } from '@chakra-ui/react'; +import { Box, Divider, Text } from '@chakra-ui/react'; import { format } from 'date-fns'; import { formatInTimeZone } from 'date-fns-tz'; import { useTranslation } from 'react-i18next'; @@ -7,50 +7,7 @@ import { createAccountSubstring } from '../../../hooks/utils/useDisplayName'; import { MultisigProposal } from '../../../types'; import { DEFAULT_DATE_TIME_FORMAT } from '../../../utils/numberFormats'; import ContentBox from '../../ui/containers/ContentBox'; -import DisplayTransaction from '../../ui/links/DisplayTransaction'; - -function TransactionOrText({ txHash, value }: { txHash?: string | null; value?: string }) { - return txHash ? : {value}; -} - -export function InfoRow({ - property, - value, - txHash, - tooltip, -}: { - property: string; - value?: string; - txHash?: string | null; - tooltip?: string; -}) { - return ( - - - {property} - - {tooltip === undefined ? ( - - ) : ( - - - - )} - - ); -} +import InfoRow from '../../ui/proposal/InfoRow'; export function TxDetails({ proposal }: { proposal: MultisigProposal }) { const { t } = useTranslation('proposal'); diff --git a/src/components/Proposals/ProposalSummary.tsx b/src/components/Proposals/ProposalSummary.tsx index 621408583c..a0e586476e 100644 --- a/src/components/Proposals/ProposalSummary.tsx +++ b/src/components/Proposals/ProposalSummary.tsx @@ -15,8 +15,8 @@ import { DisplayAddress } from '../ui/links/DisplayAddress'; import DisplayTransaction from '../ui/links/DisplayTransaction'; import EtherscanLinkBlock from '../ui/links/EtherscanLinkBlock'; import { InfoBoxLoader } from '../ui/loaders/InfoBoxLoader'; +import InfoRow from '../ui/proposal/InfoRow'; import { QuorumProgressBar } from '../ui/utils/ProgressBar'; -import { InfoRow } from './MultisigProposalDetails/TxDetails'; export default function ProposalSummary({ proposal: { diff --git a/src/components/Proposals/SnapshotProposalDetails/SnapshotProposalSummary.tsx b/src/components/Proposals/SnapshotProposalDetails/SnapshotProposalSummary.tsx index e3047a4a34..2250050f68 100644 --- a/src/components/Proposals/SnapshotProposalDetails/SnapshotProposalSummary.tsx +++ b/src/components/Proposals/SnapshotProposalDetails/SnapshotProposalSummary.tsx @@ -9,8 +9,8 @@ import { DEFAULT_DATE_TIME_FORMAT } from '../../../utils/numberFormats'; import ContentBox from '../../ui/containers/ContentBox'; import ExternalLink from '../../ui/links/ExternalLink'; import { InfoBoxLoader } from '../../ui/loaders/InfoBoxLoader'; +import InfoRow from '../../ui/proposal/InfoRow'; import { QuorumProgressBar } from '../../ui/utils/ProgressBar'; -import { InfoRow } from '../MultisigProposalDetails/TxDetails'; import useSnapshotUserVotingWeight from './hooks/useSnapshotUserVotingWeight'; import useTotalVotes from './hooks/useTotalVotes'; diff --git a/src/components/ui/proposal/InfoRow.tsx b/src/components/ui/proposal/InfoRow.tsx new file mode 100644 index 0000000000..0af6134a67 --- /dev/null +++ b/src/components/ui/proposal/InfoRow.tsx @@ -0,0 +1,45 @@ +import { Flex, Text, Tooltip } from '@chakra-ui/react'; +import DisplayTransaction from '../../ui/links/DisplayTransaction'; + +function TransactionOrText({ txHash, value }: { txHash?: string | null; value?: string }) { + return txHash ? : {value}; +} + +export default function InfoRow({ + property, + value, + txHash, + tooltip, +}: { + property: string; + value?: string; + txHash?: string | null; + tooltip?: string; +}) { + return ( + + + {property} + + {tooltip === undefined ? ( + + ) : ( + + + + )} + + ); +} From c8be97774c562cccd2fa7ba73f5f88e3af4249e2 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 12 Mar 2024 15:29:06 -0400 Subject: [PATCH 12/14] Re-inline some code because tooltips weren't showing up otherwise --- src/components/ui/proposal/InfoRow.tsx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/components/ui/proposal/InfoRow.tsx b/src/components/ui/proposal/InfoRow.tsx index 0af6134a67..1e58dfd0b7 100644 --- a/src/components/ui/proposal/InfoRow.tsx +++ b/src/components/ui/proposal/InfoRow.tsx @@ -1,10 +1,6 @@ import { Flex, Text, Tooltip } from '@chakra-ui/react'; import DisplayTransaction from '../../ui/links/DisplayTransaction'; -function TransactionOrText({ txHash, value }: { txHash?: string | null; value?: string }) { - return txHash ? : {value}; -} - export default function InfoRow({ property, value, @@ -28,16 +24,14 @@ export default function InfoRow({ {property} {tooltip === undefined ? ( - + txHash ? ( + + ) : ( + {value} + ) ) : ( - + {txHash ? : {value}} )} From 385e67045e52d39067cb02047352558ad78eb1fd Mon Sep 17 00:00:00 2001 From: David Colon <38386583+Da-Colon@users.noreply.github.com> Date: Wed, 13 Mar 2024 10:10:16 -0400 Subject: [PATCH 13/14] Fix background glow - update to new release --- package-lock.json | 14 +++++++------- package.json | 2 +- src/providers/Providers.tsx | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index fa8902a0e1..ebe36a9548 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "@apollo/client": "^3.7.10", "@chakra-ui/next-js": "^2.2.0", "@chakra-ui/react": "^2.8.2", - "@decent-org/fractal-ui": "^0.1.24", + "@decent-org/fractal-ui": "^0.1.25", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@ethersproject/abstract-signer": "^5.7.0", @@ -3448,9 +3448,9 @@ } }, "node_modules/@decent-org/fractal-ui": { - "version": "0.1.24", - "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.24.tgz", - "integrity": "sha512-Yts33E3MC996k7hXDns5oNiuLG/qHw6K4ovH9TtHciKKCpRq8ZSyiq0XDvOH0cv2bcB5jdEuH9HJuWMum3Nkfw==", + "version": "0.1.25", + "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.25.tgz", + "integrity": "sha512-mWIpaQ+HlXAskE5tSUaWcETyDHz/skq68FFF5O7jK4vJQAk7Ko7bIf+iujhY5DnAwg44v9+Nrad/zu3j6uNbgA==", "peerDependencies": { "@chakra-ui/react": "^2.3.4", "react": "^16 || ^17 || ^18", @@ -30976,9 +30976,9 @@ } }, "@decent-org/fractal-ui": { - "version": "0.1.24", - "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.24.tgz", - "integrity": "sha512-Yts33E3MC996k7hXDns5oNiuLG/qHw6K4ovH9TtHciKKCpRq8ZSyiq0XDvOH0cv2bcB5jdEuH9HJuWMum3Nkfw==", + "version": "0.1.25", + "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.25.tgz", + "integrity": "sha512-mWIpaQ+HlXAskE5tSUaWcETyDHz/skq68FFF5O7jK4vJQAk7Ko7bIf+iujhY5DnAwg44v9+Nrad/zu3j6uNbgA==", "requires": {} }, "@emotion/babel-plugin": { diff --git a/package.json b/package.json index 23f2c85b50..c06ca04546 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "@apollo/client": "^3.7.10", "@chakra-ui/next-js": "^2.2.0", "@chakra-ui/react": "^2.8.2", - "@decent-org/fractal-ui": "^0.1.24", + "@decent-org/fractal-ui": "^0.1.25", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@ethersproject/abstract-signer": "^5.7.0", diff --git a/src/providers/Providers.tsx b/src/providers/Providers.tsx index def0190b26..c41f087bd7 100644 --- a/src/providers/Providers.tsx +++ b/src/providers/Providers.tsx @@ -1,11 +1,11 @@ 'use client'; import { ApolloProvider } from '@apollo/client'; import { ChakraProvider } from '@chakra-ui/react'; -import { theme } from '@decent-org/fractal-ui'; import { RainbowKitProvider, midnightTheme } from '@rainbow-me/rainbowkit'; import { ReactNode, useEffect } from 'react'; import { ToastContainer } from 'react-toastify'; import { WagmiConfig } from 'wagmi'; +import { theme } from '../assets/theme'; import { ModalProvider } from '../components/ui/modals/ModalProvider'; import Layout from '../components/ui/page/Layout'; import { ErrorFallback } from '../components/ui/utils/ErrorFallback'; From e916283b04b799324a14ada5da126ecc7a3d2916 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Wed, 13 Mar 2024 10:27:14 -0400 Subject: [PATCH 14/14] Deployment 20240313 --- package-lock.json | 29 ++++---------- package.json | 3 +- .../DaoCreator/hooks/usePrepareFormData.ts | 12 +++--- .../MultisigProposalDetails/TxDetails.tsx | 33 +++++++++++++--- src/components/Proposals/ProposalSummary.tsx | 5 +-- .../SnapshotProposalSummary.tsx | 5 +-- src/components/ui/proposal/InfoRow.tsx | 39 ------------------- .../ui/proposal/ProposalCountdown.tsx | 39 +++++++++---------- src/providers/App/hooks/usePriceAPI.ts | 3 -- src/providers/Providers.tsx | 2 +- src/utils/numberFormats.ts | 2 +- 11 files changed, 65 insertions(+), 107 deletions(-) delete mode 100644 src/components/ui/proposal/InfoRow.tsx diff --git a/package-lock.json b/package-lock.json index 6c093c08c4..825913bcf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "@apollo/client": "^3.7.10", "@chakra-ui/next-js": "^2.2.0", "@chakra-ui/react": "^2.8.2", - "@decent-org/fractal-ui": "^0.1.25", + "@decent-org/fractal-ui": "^0.1.23", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@ethersproject/abstract-signer": "^5.7.0", @@ -34,7 +34,6 @@ "axios": "^0.27.2", "classnames": "^2.3.1", "date-fns": "^2.29.3", - "date-fns-tz": "^2.0.1", "ethers": "^5.7.2", "evm-proxy-detection": "^1.1.0", "formik": "^2.2.9", @@ -3449,9 +3448,9 @@ } }, "node_modules/@decent-org/fractal-ui": { - "version": "0.1.25", - "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.25.tgz", - "integrity": "sha512-mWIpaQ+HlXAskE5tSUaWcETyDHz/skq68FFF5O7jK4vJQAk7Ko7bIf+iujhY5DnAwg44v9+Nrad/zu3j6uNbgA==", + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.23.tgz", + "integrity": "sha512-2ML5Yzj60k4faIdWQ0LRV9X4704JcOq3cRKUmqDNjFmTWRktSuQ9yeCTk6OOqBOktLVD1Ca8FcE4HUm/P/8sMg==", "peerDependencies": { "@chakra-ui/react": "^2.3.4", "react": "^16 || ^17 || ^18", @@ -14713,14 +14712,6 @@ "url": "https://opencollective.com/date-fns" } }, - "node_modules/date-fns-tz": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-2.0.1.tgz", - "integrity": "sha512-fJCG3Pwx8HUoLhkepdsP7Z5RsucUi+ZBOxyM5d0ZZ6c4SdYustq0VMmOu6Wf7bli+yS/Jwp91TOCqn9jMcVrUA==", - "peerDependencies": { - "date-fns": "2.x" - } - }, "node_modules/dayjs": { "version": "1.11.7", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", @@ -30985,9 +30976,9 @@ } }, "@decent-org/fractal-ui": { - "version": "0.1.25", - "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.25.tgz", - "integrity": "sha512-mWIpaQ+HlXAskE5tSUaWcETyDHz/skq68FFF5O7jK4vJQAk7Ko7bIf+iujhY5DnAwg44v9+Nrad/zu3j6uNbgA==", + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/@decent-org/fractal-ui/-/fractal-ui-0.1.23.tgz", + "integrity": "sha512-2ML5Yzj60k4faIdWQ0LRV9X4704JcOq3cRKUmqDNjFmTWRktSuQ9yeCTk6OOqBOktLVD1Ca8FcE4HUm/P/8sMg==", "requires": {} }, "@emotion/babel-plugin": { @@ -39535,12 +39526,6 @@ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==" }, - "date-fns-tz": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-2.0.1.tgz", - "integrity": "sha512-fJCG3Pwx8HUoLhkepdsP7Z5RsucUi+ZBOxyM5d0ZZ6c4SdYustq0VMmOu6Wf7bli+yS/Jwp91TOCqn9jMcVrUA==", - "requires": {} - }, "dayjs": { "version": "1.11.7", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", diff --git a/package.json b/package.json index 18281e5629..dcff7f09e4 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "@apollo/client": "^3.7.10", "@chakra-ui/next-js": "^2.2.0", "@chakra-ui/react": "^2.8.2", - "@decent-org/fractal-ui": "^0.1.25", + "@decent-org/fractal-ui": "^0.1.23", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@ethersproject/abstract-signer": "^5.7.0", @@ -29,7 +29,6 @@ "axios": "^0.27.2", "classnames": "^2.3.1", "date-fns": "^2.29.3", - "date-fns-tz": "^2.0.1", "ethers": "^5.7.2", "evm-proxy-detection": "^1.1.0", "formik": "^2.2.9", diff --git a/src/components/DaoCreator/hooks/usePrepareFormData.ts b/src/components/DaoCreator/hooks/usePrepareFormData.ts index 33ae1832c5..4bdde0509f 100644 --- a/src/components/DaoCreator/hooks/usePrepareFormData.ts +++ b/src/components/DaoCreator/hooks/usePrepareFormData.ts @@ -85,11 +85,13 @@ export function usePrepareFormData() { if (freezeGuard) { freezeGuardData = await prepareFreezeGuardData(freezeGuard); } - return { - trustedAddresses: resolvedAddresses, - ...freezeGuardData, - ...rest, - }; + if (freezeGuardData) { + return { + trustedAddresses: resolvedAddresses, + ...freezeGuardData, + ...rest, + }; + } }, [signer, prepareFreezeGuardData], ); diff --git a/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx b/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx index 45e72c0edd..32d4d2a3f2 100644 --- a/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx +++ b/src/components/Proposals/MultisigProposalDetails/TxDetails.tsx @@ -1,13 +1,37 @@ -import { Box, Divider, Text } from '@chakra-ui/react'; +import { Box, Divider, Flex, Text } from '@chakra-ui/react'; import { format } from 'date-fns'; -import { formatInTimeZone } from 'date-fns-tz'; import { useTranslation } from 'react-i18next'; import { BACKGROUND_SEMI_TRANSPARENT } from '../../../constants/common'; import { createAccountSubstring } from '../../../hooks/utils/useDisplayName'; import { MultisigProposal } from '../../../types'; import { DEFAULT_DATE_TIME_FORMAT } from '../../../utils/numberFormats'; import ContentBox from '../../ui/containers/ContentBox'; -import InfoRow from '../../ui/proposal/InfoRow'; +import DisplayTransaction from '../../ui/links/DisplayTransaction'; + +export function InfoRow({ + property, + value, + txHash, +}: { + property: string; + value?: string; + txHash?: string | null; +}) { + return ( + + + {property} + + {txHash ? : {value}} + + ); +} export function TxDetails({ proposal }: { proposal: MultisigProposal }) { const { t } = useTranslation('proposal'); @@ -30,8 +54,7 @@ export function TxDetails({ proposal }: { proposal: MultisigProposal }) { /> - - {property} - - {tooltip === undefined ? ( - txHash ? ( - - ) : ( - {value} - ) - ) : ( - - {txHash ? : {value}} - - )} - - ); -} diff --git a/src/components/ui/proposal/ProposalCountdown.tsx b/src/components/ui/proposal/ProposalCountdown.tsx index c7d0ac17c3..f73e7456eb 100644 --- a/src/components/ui/proposal/ProposalCountdown.tsx +++ b/src/components/ui/proposal/ProposalCountdown.tsx @@ -25,19 +25,22 @@ export function ProposalCountdown({ proposal: FractalProposal; showIcon?: boolean; }) { - const totalSecondsLeft = useProposalCountdown(proposal); + const secondsLeft = useProposalCountdown(proposal); const { t } = useTranslation('proposal'); const state: FractalProposalState | null = useMemo(() => proposal.state, [proposal]); const { isSnapshotProposal } = useSnapshotProposal(proposal); - const showCountdown = - !!totalSecondsLeft && - totalSecondsLeft > 0 && - (state === FractalProposalState.ACTIVE || - state === FractalProposalState.TIMELOCKED || - state === FractalProposalState.EXECUTABLE || - isSnapshotProposal); + const showCountdown = useMemo( + () => + !!secondsLeft && + secondsLeft > 0 && + (state === FractalProposalState.ACTIVE || + state === FractalProposalState.TIMELOCKED || + state === FractalProposalState.EXECUTABLE || + isSnapshotProposal), + [state, secondsLeft, isSnapshotProposal], + ); if (!showCountdown) return null; @@ -60,15 +63,9 @@ export function ProposalCountdown({ ? Execute : null; - const daysLeft = Math.floor(totalSecondsLeft / (60 * 60 * 24)); - const hoursLeft = Math.floor((totalSecondsLeft / (60 * 60)) % 24); - const minutesLeft = Math.floor((totalSecondsLeft / 60) % 60); - const secondsLeft = Math.floor(totalSecondsLeft % 60); - - const showDays = daysLeft > 0; - const showHours = showDays || hoursLeft > 0; - const showMinutes = showHours || minutesLeft > 0; - const showSeconds = secondsLeft >= 0; + const daysLeft = Math.floor(secondsLeft! / (60 * 60 * 24)); + const hoursLeft = Math.floor((secondsLeft! / (60 * 60)) % 24); + const minutesLeft = Math.floor((secondsLeft! / 60) % 60); return ( - {showDays && `${zeroPad(daysLeft)}:`} - {showHours && `${zeroPad(hoursLeft)}:`} - {showMinutes && `${zeroPad(minutesLeft)}:`} - {showSeconds && `${zeroPad(secondsLeft)}`} + {daysLeft > 0 && `${zeroPad(daysLeft)}:`} + {hoursLeft > 0 && `${zeroPad(hoursLeft)}:`} + {minutesLeft > 0 && `${zeroPad(minutesLeft)}:`} + {secondsLeft! >= 0 && `${zeroPad(secondsLeft! % 60)}`} diff --git a/src/providers/App/hooks/usePriceAPI.ts b/src/providers/App/hooks/usePriceAPI.ts index 1ee58adbaf..28fc0f8494 100644 --- a/src/providers/App/hooks/usePriceAPI.ts +++ b/src/providers/App/hooks/usePriceAPI.ts @@ -41,9 +41,6 @@ export default function usePriceAPI() { } } } catch (e) { - // When doing local development, it's unlikely that the Pricing Service is going to be running locally, - // so don't worry about logging or showing the error toast. - if (process.env.NODE_ENV === 'development') return; logError('Error while getting tokens prices', e); toast.warning(t('tokenPriceFetchingError')); return; diff --git a/src/providers/Providers.tsx b/src/providers/Providers.tsx index c41f087bd7..def0190b26 100644 --- a/src/providers/Providers.tsx +++ b/src/providers/Providers.tsx @@ -1,11 +1,11 @@ 'use client'; import { ApolloProvider } from '@apollo/client'; import { ChakraProvider } from '@chakra-ui/react'; +import { theme } from '@decent-org/fractal-ui'; import { RainbowKitProvider, midnightTheme } from '@rainbow-me/rainbowkit'; import { ReactNode, useEffect } from 'react'; import { ToastContainer } from 'react-toastify'; import { WagmiConfig } from 'wagmi'; -import { theme } from '../assets/theme'; import { ModalProvider } from '../components/ui/modals/ModalProvider'; import Layout from '../components/ui/page/Layout'; import { ErrorFallback } from '../components/ui/utils/ErrorFallback'; diff --git a/src/utils/numberFormats.ts b/src/utils/numberFormats.ts index 14987105bc..07194f0ba0 100644 --- a/src/utils/numberFormats.ts +++ b/src/utils/numberFormats.ts @@ -2,7 +2,7 @@ import { SafeBalanceUsdResponse } from '@safe-global/safe-service-client'; import { BigNumber, ethers } from 'ethers'; import bigDecimal from 'js-big-decimal'; -export const DEFAULT_DATE_TIME_FORMAT = 'MMM dd, yyyy, h:mm aa O'; +export const DEFAULT_DATE_TIME_FORMAT = 'MMM dd, yyyy, h:mm aa'; export const DEFAULT_DATE_FORMAT = 'yyyy-MM-dd'; export const formatPercentage = (