Skip to content

Commit b259a62

Browse files
committed
feat: edit cycle must start at or after
1 parent 5d0d88b commit b259a62

2 files changed

Lines changed: 68 additions & 62 deletions

File tree

src/locales/messages.pot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,9 @@ msgstr ""
647647
msgid "You must grant permission to migrate your V2 tokens."
648648
msgstr ""
649649

650+
msgid "Ruleset start time"
651+
msgstr ""
652+
650653
msgid "Project owner"
651654
msgstr ""
652655

@@ -2516,9 +2519,6 @@ msgstr ""
25162519
msgid "to close"
25172520
msgstr ""
25182521

2519-
msgid "Set your new ruleset to begin after you expect all required signatures and executions across every chain to be completed."
2520-
msgstr ""
2521-
25222522
msgid "Change networks to mint tokens"
25232523
msgstr ""
25242524

src/packages/v4/views/V4ProjectSettings/EditCyclePage/ReviewConfirmModal/ReviewConfirmModal.tsx

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
import { Trans, t } from '@lingui/macro'
2-
import { JBChainId, NATIVE_TOKEN } from 'juice-sdk-core'
3-
import { useJBChainId, useJBContractContext, useJBProjectId, useJBRuleset, useSuckers } from 'juice-sdk-react'
41
import { EditCycleTxArgs, transformEditCycleFormFieldsToTxArgs } from 'packages/v4/utils/editRuleset'
2+
import { JBChainId, NATIVE_TOKEN } from 'juice-sdk-core'
3+
import { Trans, t } from '@lingui/macro'
54
import { useEffect, useState } from 'react'
5+
import { useJBChainId, useJBContractContext, useJBProjectId, useJBRuleset, useSuckers } from 'juice-sdk-react'
66

77
import { BigNumber } from '@ethersproject/bignumber'
8-
import { Form } from 'antd'
98
import { Callout } from 'components/Callout/Callout'
9+
import { ChainSelect } from 'packages/v4/components/ChainSelect'
10+
import { CreateCollapse } from 'packages/v4/components/Create/components/CreateCollapse/CreateCollapse'
11+
import { DetailsSectionDiff } from './DetailsSectionDiff'
1012
import ETHAmount from 'components/currency/ETHAmount'
13+
import { Form } from 'antd'
1114
import { JuiceDatePicker } from 'components/inputs/JuiceDatePicker'
1215
import { JuiceTextArea } from 'components/inputs/JuiceTextArea'
13-
import TransactionModal from 'components/modals/TransactionModal'
14-
import { useGnosisSafe } from 'hooks/safe/useGnosisSafe'
15-
import { useWallet } from 'hooks/Wallet'
16-
import type { RelayrPostBundleResponse } from 'juice-sdk-react'
17-
import moment from 'moment'
18-
import { ChainSelect } from 'packages/v4/components/ChainSelect'
19-
import { CreateCollapse } from 'packages/v4/components/Create/components/CreateCollapse/CreateCollapse'
16+
import { PayoutsSectionDiff } from './PayoutsSectionDiff'
2017
import QueueSafeEditRulesetTxsModal from 'packages/v4/components/QueueSafeEditRulesetTxsModal'
21-
import useV4ProjectOwnerOf from 'packages/v4/hooks/useV4ProjectOwnerOf'
18+
import type { RelayrPostBundleResponse } from 'juice-sdk-react'
19+
import { SectionCollapseHeader } from './SectionCollapseHeader'
20+
import { TokensSectionDiff } from './TokensSectionDiff'
21+
import TransactionModal from 'components/modals/TransactionModal'
22+
import { TransactionSuccessModal } from '../TransactionSuccessModal'
2223
import { emitErrorNotification } from 'utils/notifications'
24+
import moment from 'moment'
2325
import { useChainId } from 'wagmi'
26+
import { useDetailsSectionValues } from './hooks/useDetailsSectionValues'
2427
import { useEditCycleFormContext } from '../EditCycleFormContext'
28+
import { useGnosisSafe } from 'hooks/safe/useGnosisSafe'
2529
import { useOmnichainEditCycle } from '../hooks/useOmnichainEditCycle'
26-
import { TransactionSuccessModal } from '../TransactionSuccessModal'
27-
import { DetailsSectionDiff } from './DetailsSectionDiff'
28-
import { useDetailsSectionValues } from './hooks/useDetailsSectionValues'
2930
import { usePayoutsSectionValues } from './hooks/usePayoutsSectionValues'
3031
import { useTokensSectionValues } from './hooks/useTokensSectionValues'
31-
import { PayoutsSectionDiff } from './PayoutsSectionDiff'
32-
import { SectionCollapseHeader } from './SectionCollapseHeader'
33-
import { TokensSectionDiff } from './TokensSectionDiff'
32+
import useV4ProjectOwnerOf from 'packages/v4/hooks/useV4ProjectOwnerOf'
33+
import { useWallet } from 'hooks/Wallet'
3434

3535
export function ReviewConfirmModal({
3636
open,
@@ -182,7 +182,40 @@ export function ReviewConfirmModal({
182182

183183
const txSigning = Boolean(relayrBundle.uuid) && !relayrBundle.isComplete
184184
const okText = isProjectOwnerGnosisSafe ? <Trans>Queue on Safe</Trans> : !txQuote ? <Trans>Get edit quote</Trans> : <Trans>Deploy changes</Trans>
185-
185+
const mustStartAtOrAfterField = (
186+
<div className="mt-1">
187+
<Form.Item
188+
name="mustStartAtOrAfter"
189+
label={<Trans>Ruleset must start at or after</Trans>}
190+
noStyle
191+
/>
192+
<JuiceDatePicker
193+
showNow={false}
194+
showToday={false}
195+
format="YYYY-MM-DD HH:mm:ss"
196+
value={editCycleForm?.getFieldValue('mustStartAtOrAfter') ? moment.unix(editCycleForm.getFieldValue('mustStartAtOrAfter')) : undefined}
197+
onChange={(moment)=> {
198+
if (moment) {
199+
editCycleForm?.setFieldsValue({
200+
mustStartAtOrAfter: moment.unix(),
201+
})
202+
}
203+
}}
204+
disabledDate={current => {
205+
if (!current) return false
206+
const now = moment()
207+
if (
208+
current.isSame(now, 'day') ||
209+
current.isAfter(now, 'day')
210+
)
211+
return false
212+
return true
213+
}}
214+
showTime={{ defaultValue: moment('00:00:00') }}
215+
/>
216+
{/* </Form.Item> */}
217+
</div>
218+
)
186219
return (
187220
<>
188221
<TransactionModal
@@ -250,50 +283,23 @@ export function ReviewConfirmModal({
250283
showCount={true}
251284
/>
252285
</Form.Item>
286+
{!(isProjectOwnerGnosisSafe && isOmnichainProject) ? (
287+
<div>
288+
<div className="mt-8 mb-0 font-medium">
289+
<Trans>
290+
Ruleset start time
291+
</Trans>
292+
</div>
293+
{mustStartAtOrAfterField}
294+
</div>
295+
) : null}
253296
{!txQuote && (
254297
<div className="mt-10 py-4 text-sm stroke-tertiary border-t rounded-none">
255298
<Callout.Info>
256299
{isProjectOwnerGnosisSafe && isOmnichainProject ? (
257-
<>
258-
<Trans>
259-
Set your new ruleset to begin after you expect all required signatures and executions across every chain to be completed.
260-
</Trans>
261-
262-
<Form.Item name="mustStartAtOrAfter" noStyle>
263-
<div className="mt-4">
264-
<Form.Item
265-
name="mustStartAtOrAfter"
266-
label={<Trans>Ruleset must start at or after</Trans>}
267-
noStyle
268-
/>
269-
<JuiceDatePicker
270-
showNow={false}
271-
showToday={false}
272-
format="YYYY-MM-DD HH:mm:ss"
273-
value={editCycleForm?.getFieldValue('mustStartAtOrAfter') ? moment.unix(editCycleForm.getFieldValue('mustStartAtOrAfter')) : undefined}
274-
onChange={(moment)=> {
275-
if (moment) {
276-
editCycleForm?.setFieldsValue({
277-
mustStartAtOrAfter: moment.unix(),
278-
})
279-
}
280-
}}
281-
disabledDate={current => {
282-
if (!current) return false
283-
const now = moment()
284-
if (
285-
current.isSame(now, 'day') ||
286-
current.isAfter(now, 'day')
287-
)
288-
return false
289-
return true
290-
}}
291-
showTime={{ defaultValue: moment('00:00:00') }}
292-
/>
293-
{/* </Form.Item> */}
294-
</div>
295-
</Form.Item>
296-
</>
300+
<div className="mt-3">
301+
{mustStartAtOrAfterField}
302+
</div>
297303
) : (
298304
<Trans>
299305
You'll be prompted a wallet signature for each of this project's chains before submitting the final transaction.

0 commit comments

Comments
 (0)