Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/fc starts at #4581

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/locales/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ 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,
CONTROLLER_MIGRATION_EXPLANATION,
TERMINAL_CONFIG_EXPLANATION,
TERMINAL_MIGRATION_EXPLANATION,
} from 'components/strings'
import moment from 'moment'

export function DetailsSectionAdvanced() {
return (
Expand Down Expand Up @@ -56,6 +58,30 @@ export function DetailsSectionAdvanced() {
}
/>
</Form.Item>

<Form.Item
label={
<span className="text-sm font-normal">
<Trans>Start time</Trans>
</span>
}
>
<Form.Item valuePropName={'date'} name="mustStartAtOrAfter" noStyle>
<JuiceDatePicker
showNow={false}
showToday={false}
format="YYYY-MM-DD HH:mm:ss"
disabledDate={current => {
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') }}
/>
</Form.Item>
</Form.Item>
</AdvancedDropdown>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type DetailsSectionFields = {
allowControllerMigration: boolean
allowTerminalMigration: boolean
pausePay: boolean
mustStartAtOrAfter: string
}

type PayoutsSectionFields = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export function DetailsSectionDiff() {
newSetController,
currentSetController,
allowSetControllerHasDiff,

mustStartAtOrAfter,
hasMustStartAtOrAfter,
} = useDetailsSectionValues()

if (!sectionHasDiff) {
Expand Down Expand Up @@ -156,6 +159,16 @@ export function DetailsSectionDiff() {
}
/>
)}
{hasMustStartAtOrAfter && (
<FundingCycleListItem
name={t`Start time`}
value={
<span className="capitalize">
{mustStartAtOrAfter.toString()}
</span>
}
/>
)}
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function ReviewConfirmModal({
>
<p className="text-secondary text-sm">
<Trans>
Please check your changes carefully. Each deploy will incur a gas
Check your changes carefully. Each deploy will incur a gas
fee.
</Trans>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -108,5 +114,8 @@ export const useDetailsSectionValues = () => {

advancedOptionsHasDiff,
sectionHasDiff,

mustStartAtOrAfter,
hasMustStartAtOrAfter,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -78,6 +79,7 @@ export const useLoadEditCycleData = () => {
: DefaultTokenSettings.pauseTransfers

const formData = {
mustStartAtOrAfter: DEFAULT_MUST_START_AT_OR_AFTER,
duration: secondsToOtherUnit({
duration,
unit: deriveDurationUnit(duration),
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -122,7 +123,9 @@ export const usePrepareSaveEditCycleData = () => {
editingFundingCycleData,
editingFundAccessConstraints,
editingNftRewards,
editingMustStartAtOrAfter: DEFAULT_MUST_START_AT_OR_AFTER,
editingMustStartAtOrAfter: formValues.mustStartAtOrAfter
? moment(formValues.mustStartAtOrAfter).unix().toString()
: DEFAULT_MUST_START_AT_OR_AFTER,
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function ReviewConfirmModal({
>
<p className="text-secondary text-sm">
<Trans>
Please check your changes carefully. Each deploy will incur a gas
Check your changes carefully. Each deploy will incur a gas
fee.
</Trans>
</p>
Expand Down
Loading