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

Show Details implemented #811

Draft
wants to merge 3 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*

.idea/

.cursorrules
theborakompanioni marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 1 addition & 3 deletions src/components/BitcoinAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ const BitcoinAmountInput = forwardRef(
inputMode={inputType.inputMode}
className={classNames('slashed-zeroes', className)}
value={
inputType.type === 'text'
? (field.value?.displayValue ?? '')
: String(field.value?.userRawInputValue ?? '')
inputType.type === 'text' ? field.value?.displayValue ?? '' : String(field.value?.userRawInputValue ?? '')
}
placeholder={placeholder}
min={displayInputUnit === 'BTC' ? '0.00000001' : '1'}
Expand Down
24 changes: 22 additions & 2 deletions src/components/Jam.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, useMemo, useCallback } from 'react'
import React, { useState, useEffect, useMemo, useCallback } from 'react'
import * as rb from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import { Formik, FormikErrors, FormikValues, useFormikContext } from 'formik'
Expand All @@ -16,8 +16,9 @@ import Balance from './Balance'
import ScheduleProgress from './ScheduleProgress'
import { ConfirmModal, ConfirmModalProps } from './Modal'
import FeeConfigModal from './settings/FeeConfigModal'
import { useFeeConfigValues } from '../hooks/Fees'
import Accordion from './Accordion'
import styles from './Jam.module.css'
import { useFeeConfigValues } from '../hooks/Fees'

const DEST_ADDRESS_COUNT_PROD = 3
const DEST_ADDRESS_COUNT_TEST = 1
Expand Down Expand Up @@ -351,6 +352,22 @@ export default function Jam({ wallet }: JamProps) {
})
}

function getScheduleDetails(currentSchedule: Schedule) {
const idIndices = currentSchedule.length === 2 ? [1] : [4, 6, 7]
const typeIndices = currentSchedule.length === 2 ? [0] : [1, 3, 5]

return idIndices.map((idIndex, index) => (
<React.Fragment key={index}>
<p>
Id - {index + 1}: {currentSchedule[idIndex]?.[3]}
</p>
<p>
Type - {index + 1}: {currentSchedule[typeIndices[index]]?.[3]}
</p>
</React.Fragment>
))
}

return (
<>
<PageTitle title={t('scheduler.title')} subtitle={t('scheduler.subtitle')} />
Expand Down Expand Up @@ -382,6 +399,9 @@ export default function Jam({ wallet }: JamProps) {
>
<div className="d-flex justify-content-center align-items-center">{t('scheduler.button_stop')}</div>
</rb.Button>
{currentSchedule.length === 2 || currentSchedule.length === 8 ? (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand why it is limited to schedules with certain amounts of entries. Care to elaborate? 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, currently the scheduler only supports 3 destination addresses, hence currentSchedule.length === 8 and,
currentSchedule === 2 is for the dev mode.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The amount of schedule entries depends also on the distribution of funds in your jars
If you want to make it available exclusively in dev mode, please use isDevMode.

<Accordion title={t('scheduler.details')}>{getScheduleDetails(currentSchedule)}</Accordion>
) : null}
</>
)}
</>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Send/SendForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function CollaborativeTransactionOptions({
amount:
selectedAmount?.isSweep && sourceJarBalance
? sourceJarBalance.calculatedAvailableBalanceInSats
: (selectedAmount?.value ?? null),
: selectedAmount?.value ?? null,
numCollaborators: selectedNumCollaborators ?? null,
isCoinjoin: true,
})
Expand Down Expand Up @@ -134,8 +134,8 @@ function CollaborativeTransactionOptions({
numCollaborators={selectedNumCollaborators ?? null}
amount={
selectedAmount?.isSweep
? (sourceJarBalance?.calculatedAvailableBalanceInSats ?? null)
: (selectedAmount?.value ?? null)
? sourceJarBalance?.calculatedAvailableBalanceInSats ?? null
: selectedAmount?.value ?? null
}
onClick={() => {
setActiveFeeConfigModalSection('cj_fee')
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@
"progress_description": "This estimate is the minimum waiting time. Additional delays due to network communication or transaction confirmation are not considered.",
"progress_current_state": "Waiting for transaction <1>{{ current }}</1> of <3>{{ total }}</3> to process...",
"progress_done": "All transactions completed successfully. The scheduler will stop soon.",
"details": "Schedule Details",
"precondition": {
"hint_missing_utxos": "To run the scheduler you need UTXOs with {{ minConfirmations }} or more confirmations. $t(scheduler.precondition.nested_hint_fund_wallet, {\"count\": {{ minConfirmations }} })",
"hint_missing_confirmations": "The scheduler requires your UTXOs to have {{ minConfirmations }} or more confirmations. $t(scheduler.precondition.nested_hint_wait_for_block, {\"count\": {{ amountOfMissingConfirmations }} })",
Expand Down