Fix ESLint issues
This commit is contained in:
@ -36,7 +36,7 @@ export function MovementWidget(p: { movement: Movement }): React.ReactElement {
|
||||
height: "100%",
|
||||
}}
|
||||
>
|
||||
{p.movement!.amount > 0 ? (
|
||||
{p.movement.amount > 0 ? (
|
||||
<CallReceivedIcon color="success" />
|
||||
) : (
|
||||
<CallMadeIcon color="error" />
|
||||
@ -51,15 +51,15 @@ export function MovementWidget(p: { movement: Movement }): React.ReactElement {
|
||||
}}
|
||||
>
|
||||
<span style={{ height: "1em", lineHeight: 1 }}>
|
||||
{p.movement?.label}
|
||||
{p.movement.label}
|
||||
</span>
|
||||
<span style={{ display: "flex", alignItems: "center", lineHeight: 1 }}>
|
||||
<AmountWidget amount={p.movement!.amount} />
|
||||
<AmountWidget amount={p.movement.amount} />
|
||||
<span style={{ width: "0.5em" }} />
|
||||
•
|
||||
<span style={{ width: "0.5em" }} />
|
||||
<AccountIconWidget account={accounts.get(p.movement!.account_id)!} />
|
||||
{accounts.get(p.movement!.account_id)?.name}
|
||||
<AccountIconWidget account={accounts.get(p.movement.account_id)!} />
|
||||
{accounts.get(p.movement.account_id)?.name}
|
||||
<span style={{ width: "0.5em" }} />
|
||||
• <span style={{ width: "0.5em" }} />
|
||||
{fmtDateFromTime(p.movement.time)}
|
||||
|
@ -133,19 +133,19 @@ export function SelectMovementWidget(p: {
|
||||
|
||||
<div style={{ flex: 1 }}>
|
||||
<AsyncWidget
|
||||
loadKey={
|
||||
loadKey.current + "/" + accountId + "/" + JSON.stringify(filters)
|
||||
}
|
||||
loadKey={`${loadKey.current}/${accountId}/${JSON.stringify(
|
||||
filters
|
||||
)}`}
|
||||
load={load}
|
||||
errMsg="Failed to load the list of movements!"
|
||||
build={() => {
|
||||
if (list === null)
|
||||
if (list === undefined)
|
||||
return (
|
||||
<Typography style={{ textAlign: "center", padding: "20px" }}>
|
||||
Select an account to begin research.
|
||||
</Typography>
|
||||
);
|
||||
if (list?.length === 0)
|
||||
if (list.length === 0)
|
||||
return (
|
||||
<Typography style={{ textAlign: "center", padding: "20px" }}>
|
||||
No result.
|
||||
@ -154,11 +154,13 @@ export function SelectMovementWidget(p: {
|
||||
|
||||
return (
|
||||
<>
|
||||
{list?.map((entry) => (
|
||||
<ListItem>
|
||||
{list.map((entry) => (
|
||||
<ListItem key={entry.id}>
|
||||
<ListItemButton
|
||||
selected={entry.id === p.value}
|
||||
onClick={() => p.onChange(entry)}
|
||||
onClick={() => {
|
||||
p.onChange(entry);
|
||||
}}
|
||||
>
|
||||
<MovementWidget movement={entry} />
|
||||
</ListItemButton>
|
||||
|
@ -21,13 +21,15 @@ export function AccountInput(p: {
|
||||
<Select
|
||||
value={current}
|
||||
label={p.label ?? ""}
|
||||
onChange={(e) => p.onChange(Number(e.target.value))}
|
||||
onChange={(e) => {
|
||||
p.onChange(Number(e.target.value));
|
||||
}}
|
||||
size="small"
|
||||
style={p.style}
|
||||
variant={p.variant}
|
||||
>
|
||||
{accounts.list.list.map((a) => (
|
||||
<MenuItem value={a.id}>
|
||||
<MenuItem key={a.id} value={a.id}>
|
||||
<span
|
||||
style={{
|
||||
display: "inline-flex",
|
||||
|
@ -49,8 +49,7 @@ export function AmountInput(p: {
|
||||
// Empty field
|
||||
if (a?.length === 0 || a === undefined) p.onValueChange(NaN);
|
||||
// Input number
|
||||
else if ((a?.length ?? 0) > 0 && !Number.isNaN(parsed))
|
||||
p.onValueChange(parsed);
|
||||
else if (a.length > 0 && !Number.isNaN(parsed)) p.onValueChange(parsed);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
Reference in New Issue
Block a user