From 78ef66d5fab93754782c5a4d836fa0fea408bb13 Mon Sep 17 00:00:00 2001 From: aeolian <94939382+aeolianeth@users.noreply.github.com> Date: Mon, 13 Jan 2025 19:25:03 +1000 Subject: [PATCH 1/3] feat: fc start time basic --- .../DetailsSection/DetailsSectionAdvanced.tsx | 25 +++++++++++++++++++ .../EditCyclePage/EditCycleFormFields.ts | 1 + .../ReviewConfirmModal/DetailsSectionDiff.tsx | 13 ++++++++++ .../ReviewConfirmModal/ReviewConfirmModal.tsx | 2 +- .../hooks/useDetailsSectionValues.ts | 11 +++++++- .../hooks/useLoadEditCycleData.tsx | 2 ++ .../hooks/usePrepareSaveEditCycleData.tsx | 2 +- .../ReviewConfirmModal/ReviewConfirmModal.tsx | 2 +- 8 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/DetailsSection/DetailsSectionAdvanced.tsx b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/DetailsSection/DetailsSectionAdvanced.tsx index c3a865bc23..1d6491064b 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/DetailsSection/DetailsSectionAdvanced.tsx +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/DetailsSection/DetailsSectionAdvanced.tsx @@ -56,6 +56,31 @@ export function DetailsSectionAdvanced() { } /> + + + Start time + + } + > + + + {/* { + if (!current) return false + const now = moment() + if (current.isSame(now, 'day') || current.isAfter(now, 'day')) + return false + return true + }} + // showTime={{ defaultValue: moment('00:00:00') }} + /> */} + + ) } diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/EditCycleFormFields.ts b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/EditCycleFormFields.ts index 997759f1dd..5c0007ee65 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/EditCycleFormFields.ts +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/EditCycleFormFields.ts @@ -12,6 +12,7 @@ type DetailsSectionFields = { allowControllerMigration: boolean allowTerminalMigration: boolean pausePay: boolean + mustStartAtOrAfter: string } type PayoutsSectionFields = { diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/DetailsSectionDiff.tsx b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/DetailsSectionDiff.tsx index f24754dd42..f0ccc1e241 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/DetailsSectionDiff.tsx +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/DetailsSectionDiff.tsx @@ -40,6 +40,9 @@ export function DetailsSectionDiff() { newSetController, currentSetController, allowSetControllerHasDiff, + + mustStartAtOrAfter, + hasMustStartAtOrAfter, } = useDetailsSectionValues() if (!sectionHasDiff) { @@ -156,6 +159,16 @@ export function DetailsSectionDiff() { } /> )} + {hasMustStartAtOrAfter && ( + + {mustStartAtOrAfter.toString()} + + } + /> + )} ) } diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx index f2b364fa8f..8a76889ba1 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx @@ -67,7 +67,7 @@ export function ReviewConfirmModal({ >

- Please check your changes carefully. Each deploy will incur a gas + Check your changes carefully. Each deploy will incur a gas fee.

diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/hooks/useDetailsSectionValues.ts b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/hooks/useDetailsSectionValues.ts index 8b1b2b4b59..23ba07dafb 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/hooks/useDetailsSectionValues.ts +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/ReviewConfirmModal/hooks/useDetailsSectionValues.ts @@ -2,6 +2,7 @@ import { BigNumber } from '@ethersproject/bignumber' import { V2V3ProjectContext } from 'packages/v2v3/contexts/Project/V2V3ProjectContext' import { getBallotStrategyByAddress } from 'packages/v2v3/utils/ballotStrategies' import { useContext } from 'react' +import { DEFAULT_MUST_START_AT_OR_AFTER } from 'redux/slices/v2v3/creatingV2Project' import { otherUnitToSeconds } from 'utils/format/formatTime' import { useEditCycleFormContext } from '../../EditCycleFormContext' @@ -67,12 +68,17 @@ export const useDetailsSectionValues = () => { ) const allowSetControllerHasDiff = currentSetController !== newSetController + const mustStartAtOrAfter = editCycleForm?.getFieldValue('mustStartAtOrAfter') + const hasMustStartAtOrAfter = + mustStartAtOrAfter !== DEFAULT_MUST_START_AT_OR_AFTER + const advancedOptionsHasDiff = pausePayHasDiff || allowSetTerminalsHasDiff || allowSetControllerHasDiff || allowControllerMigrationHasDiff || - allowTerminalMigrationHasDiff + allowTerminalMigrationHasDiff || + hasMustStartAtOrAfter const sectionHasDiff = durationHasDiff || ballotHasDiff || advancedOptionsHasDiff @@ -108,5 +114,8 @@ export const useDetailsSectionValues = () => { advancedOptionsHasDiff, sectionHasDiff, + + mustStartAtOrAfter, + hasMustStartAtOrAfter, } } diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/useLoadEditCycleData.tsx b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/useLoadEditCycleData.tsx index ca0a199152..d1a4ec3f5d 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/useLoadEditCycleData.tsx +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/useLoadEditCycleData.tsx @@ -14,6 +14,7 @@ import { } from 'packages/v2v3/utils/math' import { deserializeV2V3FundingCycleData } from 'packages/v2v3/utils/serializers' import { useEffect, useRef, useState } from 'react' +import { DEFAULT_MUST_START_AT_OR_AFTER } from 'redux/slices/v2v3/creatingV2Project' import { deriveDurationOption, deriveDurationUnit, @@ -78,6 +79,7 @@ export const useLoadEditCycleData = () => { : DefaultTokenSettings.pauseTransfers const formData = { + mustStartAtOrAfter: DEFAULT_MUST_START_AT_OR_AFTER, duration: secondsToOtherUnit({ duration, unit: deriveDurationUnit(duration), diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/usePrepareSaveEditCycleData.tsx b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/usePrepareSaveEditCycleData.tsx index e2478baf32..48d1780744 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/usePrepareSaveEditCycleData.tsx +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/usePrepareSaveEditCycleData.tsx @@ -122,7 +122,7 @@ export const usePrepareSaveEditCycleData = () => { editingFundingCycleData, editingFundAccessConstraints, editingNftRewards, - editingMustStartAtOrAfter: DEFAULT_MUST_START_AT_OR_AFTER, + editingMustStartAtOrAfter: formValues.mustStartAtOrAfter ?? DEFAULT_MUST_START_AT_OR_AFTER, } return { diff --git a/src/packages/v4/views/V4ProjectSettings/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx b/src/packages/v4/views/V4ProjectSettings/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx index c2d81a670d..bed014b630 100644 --- a/src/packages/v4/views/V4ProjectSettings/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx +++ b/src/packages/v4/views/V4ProjectSettings/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx @@ -73,7 +73,7 @@ export function ReviewConfirmModal({ >

- Please check your changes carefully. Each deploy will incur a gas + Check your changes carefully. Each deploy will incur a gas fee.

From 9e07450c1c22bf2b924f8955b624ce7277f35123 Mon Sep 17 00:00:00 2001 From: aeolian <94939382+aeolianeth@users.noreply.github.com> Date: Mon, 13 Jan 2025 19:25:35 +1000 Subject: [PATCH 2/3] pot --- src/locales/messages.pot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/locales/messages.pot b/src/locales/messages.pot index 67b84491ed..dd53f22962 100644 --- a/src/locales/messages.pot +++ b/src/locales/messages.pot @@ -2921,6 +2921,9 @@ msgstr "" msgid "Twitter handle" msgstr "" +msgid "Check your changes carefully. Each deploy will incur a gas fee." +msgstr "" + msgid "<0/> fee" msgstr "" @@ -3317,9 +3320,6 @@ msgstr "" msgid "Previous value" msgstr "" -msgid "Please check your changes carefully. Each deploy will incur a gas fee." -msgstr "" - msgid "Owner token minting:" msgstr "" From 0e9d2240547003198a975828a497178de08e6f7a Mon Sep 17 00:00:00 2001 From: aeolian <94939382+aeolianeth@users.noreply.github.com> Date: Mon, 13 Jan 2025 20:43:26 +1000 Subject: [PATCH 3/3] do --- .../DetailsSection/DetailsSectionAdvanced.tsx | 11 ++++++----- .../hooks/usePrepareSaveEditCycleData.tsx | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/DetailsSection/DetailsSectionAdvanced.tsx b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/DetailsSection/DetailsSectionAdvanced.tsx index 1d6491064b..fb455be122 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/DetailsSection/DetailsSectionAdvanced.tsx +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/DetailsSection/DetailsSectionAdvanced.tsx @@ -2,6 +2,7 @@ import { Trans } from '@lingui/macro' import { Form } from 'antd' import { AdvancedDropdown } from 'components/Project/ProjectSettings/AdvancedDropdown' import TooltipLabel from 'components/TooltipLabel' +import { JuiceDatePicker } from 'components/inputs/JuiceDatePicker' import { JuiceSwitch } from 'components/inputs/JuiceSwitch' import { CONTROLLER_CONFIG_EXPLANATION, @@ -9,6 +10,7 @@ import { TERMINAL_CONFIG_EXPLANATION, TERMINAL_MIGRATION_EXPLANATION, } from 'components/strings' +import moment from 'moment' export function DetailsSectionAdvanced() { return ( @@ -64,9 +66,8 @@ export function DetailsSectionAdvanced() { } > - - - {/* + */} + showTime={{ defaultValue: moment('00:00:00') }} + /> diff --git a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/usePrepareSaveEditCycleData.tsx b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/usePrepareSaveEditCycleData.tsx index 48d1780744..fef8159006 100644 --- a/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/usePrepareSaveEditCycleData.tsx +++ b/src/packages/v2v3/components/V2V3Project/V2V3ProjectSettings/pages/EditCyclePage/hooks/usePrepareSaveEditCycleData.tsx @@ -1,5 +1,6 @@ import { BigNumber } from '@ethersproject/bignumber' import { ETH_TOKEN_ADDRESS } from 'constants/juiceboxTokens' +import moment from 'moment' import { V2V3ProjectContractsContext } from 'packages/v2v3/contexts/ProjectContracts/V2V3ProjectContractsContext' import { V2V3FundAccessConstraint, @@ -122,7 +123,9 @@ export const usePrepareSaveEditCycleData = () => { editingFundingCycleData, editingFundAccessConstraints, editingNftRewards, - editingMustStartAtOrAfter: formValues.mustStartAtOrAfter ?? DEFAULT_MUST_START_AT_OR_AFTER, + editingMustStartAtOrAfter: formValues.mustStartAtOrAfter + ? moment(formValues.mustStartAtOrAfter).unix().toString() + : DEFAULT_MUST_START_AT_OR_AFTER, } return {