fix: fiat balance notification recycler label

This commit is contained in:
Rafael Taranto 2025-06-30 07:17:41 +01:00
parent 4b9d101233
commit 15e4cba0dc
2 changed files with 86 additions and 79 deletions

View file

@ -149,73 +149,78 @@ const FiatBalance = ({ section, fieldWidth = 80 }) => {
)}
</div>
</Form>
<Form>
<PromptWhenDirty />
<Header
title="Cash recycling"
editing={isEditing(RECYCLER_STACKER_KEY)}
disabled={isDisabled(RECYCLER_STACKER_KEY)}
setEditing={it => setEditing(RECYCLER_STACKER_KEY, it)}
/>
<div className="flex flex-wrap gap-8">
{R.chain(
it => [
<>
<div className="flex w-50 gap-4">
<Cashbox
percent={
values[
`fillingPercentageRecycler${(it + 1) * 2 - 1}`
] ?? data[`recycler${(it + 1) * 2 - 1}`]
}
isLow={false}
className="border-4 inline-block"
omitInnerPercentage
cashOut
/>
<div className="w-30">
<TL2 className="mt-0">Recycler {(it + 1) * 2 - 1}</TL2>
<EditableNumber
label="Alert me under"
name={`fillingPercentageRecycler${(it + 1) * 2 - 1}`}
editing={isEditing(RECYCLER_STACKER_KEY)}
displayValue={x => (x === '' ? '-' : x)}
decoration="%"
width={fieldWidth}
{maxNumberOfRecyclers > 0 && (
<Form>
<PromptWhenDirty />
<Header
title="Cash recycling"
editing={isEditing(RECYCLER_STACKER_KEY)}
disabled={isDisabled(RECYCLER_STACKER_KEY)}
setEditing={it => setEditing(RECYCLER_STACKER_KEY, it)}
/>
<div className="flex flex-wrap gap-8">
{R.chain(
it => [
<>
<div className="flex w-50 gap-4">
<Cashbox
percent={
values[
`fillingPercentageRecycler${(it + 1) * 2 - 1}`
] ?? data[`recycler${(it + 1) * 2 - 1}`]
}
isLow={false}
className="border-4 inline-block"
omitInnerPercentage
cashOut
/>
<div className="w-30">
<TL2 className="mt-0">
Recycler {(it + 1) * 2 - 1}
</TL2>
<EditableNumber
label="Alert me under"
name={`fillingPercentageRecycler${(it + 1) * 2 - 1}`}
editing={isEditing(RECYCLER_STACKER_KEY)}
displayValue={x => (x === '' ? '-' : x)}
decoration="%"
width={fieldWidth}
/>
</div>
</div>
</div>
</>,
<>
<div className="flex w-50 gap-4">
<Cashbox
percent={
values[`fillingPercentageRecycler${(it + 1) * 2}`] ??
data[`recycler${(it + 1) * 2}`]
}
isLow={false}
className="border-4 inline-block"
omitInnerPercentage
cashOut
/>
<div className="w-30">
<TL2 className="mt-0">Recycler {(it + 1) * 2}</TL2>
<EditableNumber
label="Alert me under"
name={`fillingPercentageRecycler${(it + 1) * 2}`}
editing={isEditing(RECYCLER_STACKER_KEY)}
displayValue={x => (x === '' ? '-' : x)}
decoration="%"
width={fieldWidth}
</>,
<>
<div className="flex w-50 gap-4">
<Cashbox
percent={
values[
`fillingPercentageRecycler${(it + 1) * 2}`
] ?? data[`recycler${(it + 1) * 2}`]
}
isLow={false}
className="border-4 inline-block"
omitInnerPercentage
cashOut
/>
<div className="w-30">
<TL2 className="mt-0">Recycler {(it + 1) * 2}</TL2>
<EditableNumber
label="Alert me under"
name={`fillingPercentageRecycler${(it + 1) * 2}`}
editing={isEditing(RECYCLER_STACKER_KEY)}
displayValue={x => (x === '' ? '-' : x)}
decoration="%"
width={fieldWidth}
/>
</div>
</div>
</div>
</>,
],
R.times(R.identity, maxNumberOfRecyclers / 2),
)}
</div>
</Form>
</>,
],
R.times(R.identity, maxNumberOfRecyclers / 2),
)}
</div>
</Form>
)}
</div>
)}
</Formik>

View file

@ -185,22 +185,24 @@ const FiatBalanceOverrides = ({ config, section }) => {
)
return (
<EditableTable
name={NAME}
title="Overrides"
error={error?.message}
enableDelete
enableEdit
enableCreate
save={it => save(section, validationSchema.cast(it))}
initialValues={initialValues}
validationSchema={validationSchema}
forceDisable={isDisabled(NAME) || !machines}
data={setupValues}
elements={elements}
disableAdd={!suggestions?.length}
setEditing={innerSetEditing}
/>
<div className="mt-4">
<EditableTable
name={NAME}
title="Overrides"
error={error?.message}
enableDelete
enableEdit
enableCreate
save={it => save(section, validationSchema.cast(it))}
initialValues={initialValues}
validationSchema={validationSchema}
forceDisable={isDisabled(NAME) || !machines}
data={setupValues}
elements={elements}
disableAdd={!suggestions?.length}
setEditing={innerSetEditing}
/>
</div>
)
}