|
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' |
4 | 1 | import { EditCycleTxArgs, transformEditCycleFormFieldsToTxArgs } from 'packages/v4/utils/editRuleset' |
| 2 | +import { JBChainId, NATIVE_TOKEN } from 'juice-sdk-core' |
| 3 | +import { Trans, t } from '@lingui/macro' |
5 | 4 | import { useEffect, useState } from 'react' |
| 5 | +import { useJBChainId, useJBContractContext, useJBProjectId, useJBRuleset, useSuckers } from 'juice-sdk-react' |
6 | 6 |
|
7 | 7 | import { BigNumber } from '@ethersproject/bignumber' |
8 | | -import { Form } from 'antd' |
9 | 8 | 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' |
10 | 12 | import ETHAmount from 'components/currency/ETHAmount' |
| 13 | +import { Form } from 'antd' |
11 | 14 | import { JuiceDatePicker } from 'components/inputs/JuiceDatePicker' |
12 | 15 | 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' |
20 | 17 | 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' |
22 | 23 | import { emitErrorNotification } from 'utils/notifications' |
| 24 | +import moment from 'moment' |
23 | 25 | import { useChainId } from 'wagmi' |
| 26 | +import { useDetailsSectionValues } from './hooks/useDetailsSectionValues' |
24 | 27 | import { useEditCycleFormContext } from '../EditCycleFormContext' |
| 28 | +import { useGnosisSafe } from 'hooks/safe/useGnosisSafe' |
25 | 29 | import { useOmnichainEditCycle } from '../hooks/useOmnichainEditCycle' |
26 | | -import { TransactionSuccessModal } from '../TransactionSuccessModal' |
27 | | -import { DetailsSectionDiff } from './DetailsSectionDiff' |
28 | | -import { useDetailsSectionValues } from './hooks/useDetailsSectionValues' |
29 | 30 | import { usePayoutsSectionValues } from './hooks/usePayoutsSectionValues' |
30 | 31 | 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' |
34 | 34 |
|
35 | 35 | export function ReviewConfirmModal({ |
36 | 36 | open, |
@@ -182,7 +182,40 @@ export function ReviewConfirmModal({ |
182 | 182 |
|
183 | 183 | const txSigning = Boolean(relayrBundle.uuid) && !relayrBundle.isComplete |
184 | 184 | 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 | + ) |
186 | 219 | return ( |
187 | 220 | <> |
188 | 221 | <TransactionModal |
@@ -250,50 +283,23 @@ export function ReviewConfirmModal({ |
250 | 283 | showCount={true} |
251 | 284 | /> |
252 | 285 | </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} |
253 | 296 | {!txQuote && ( |
254 | 297 | <div className="mt-10 py-4 text-sm stroke-tertiary border-t rounded-none"> |
255 | 298 | <Callout.Info> |
256 | 299 | {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> |
297 | 303 | ) : ( |
298 | 304 | <Trans> |
299 | 305 | You'll be prompted a wallet signature for each of this project's chains before submitting the final transaction. |
|
0 commit comments