fix: design fixes on notifications screen

This commit is contained in:
José Oliveira 2021-06-17 17:54:42 +01:00 committed by Josh Harvey
parent fc3ad8e421
commit cdab60069c
5 changed files with 50 additions and 45 deletions

View file

@ -21,7 +21,7 @@ const Cashbox = ({
labelClassName,
inFiatBalanceAlerts
}) => {
const classes = cashboxClasses({ percent, cashOut })
const classes = cashboxClasses({ percent, cashOut, inFiatBalanceAlerts })
const threshold = 51
const showCashBox = {

View file

@ -11,8 +11,12 @@ const colors = {
}
}
const colorPicker = ({ percent, cashOut }) =>
colors[cashOut ? 'cashOut' : 'cashIn'][percent >= 50 ? 'full' : 'empty']
const colorPicker = ({ percent, cashOut, inFiatBalanceAlerts }) => {
if (inFiatBalanceAlerts) return colors[cashOut ? 'cashOut' : 'cashIn'].full
return colors[cashOut ? 'cashOut' : 'cashIn'][
percent >= 50 ? 'full' : 'empty'
]
}
const cashboxStyles = {
cashbox: {

View file

@ -42,6 +42,9 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
.nullable()
})
const getPercentage = fillingPercentage =>
fillingPercentage ?? data?.fillingPercentageCassette1
return (
<Formik
validateOnBlur={false}
@ -58,6 +61,7 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
onReset={() => {
setEditing(NAME, false)
}}>
{({ values }) => (
<Form className={classes.form}>
<PromptWhenDirty />
<Header
@ -72,7 +76,7 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
<Cashbox
labelClassName={classes.cashboxLabel}
emptyPartClassName={classes.cashboxEmptyPart}
percent={data?.fillingPercentageCassette1}
percent={getPercentage(values.fillingPercentageCassette1)}
inFiatBalanceAlerts={true}
cashOut
/>
@ -93,7 +97,7 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
<Cashbox
labelClassName={classes.cashboxLabel}
emptyPartClassName={classes.cashboxEmptyPart}
percent={data?.fillingPercentageCassette2}
percent={getPercentage(values.fillingPercentageCassette2)}
inFiatBalanceAlerts={true}
cashOut
/>
@ -111,6 +115,7 @@ const FiatBalance = ({ section, min = 0, max = 100, fieldWidth = 80 }) => {
</div>
</div>
</Form>
)}
</Formik>
)
}

View file

@ -96,7 +96,7 @@ const FiatBalanceOverrides = ({ section }) => {
},
{
name: CASSETTE_1_KEY,
display: 'Cash-out 1',
header: 'Cash-out 1',
width: 155,
textAlign: 'right',
doubleHeader: 'Cash-out (Cassette Empty)',
@ -109,7 +109,7 @@ const FiatBalanceOverrides = ({ section }) => {
},
{
name: CASSETTE_2_KEY,
display: 'Cash-out 2',
header: 'Cash-out 2',
width: 155,
textAlign: 'right',
doubleHeader: 'Cash-out (Cassette Empty)',

View file

@ -24,7 +24,6 @@ const sizes = {
errors: 142,
active: 263
}
const width = R.sum(R.values(sizes)) + channelSize
const Row = ({ namespace, forceDisable }) => {
const { data: rawData, save: rawSave } = useContext(NotificationsCtx)
@ -64,9 +63,6 @@ const Row = ({ namespace, forceDisable }) => {
}
const useStyles = makeStyles({
mainTable: {
width
},
wizardTable: {
width: 930
}
@ -75,7 +71,7 @@ const Setup = ({ wizard, forceDisable }) => {
const widthAdjust = wizard ? 20 : 0
const classes = useStyles()
return (
<Table className={wizard ? classes.wizardTable : classes.mainTable}>
<Table className={wizard ? classes.wizardTable : null}>
<THead>
<Th width={channelSize - widthAdjust}>Channel</Th>
{Object.keys(sizes).map(it => (