Skip to content

Commit

Permalink
Update blank category name behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Sep 29, 2023
1 parent 329001c commit a4d8407
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions packages/desktop-client/src/components/budget/MobileBudgetTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,14 @@ const ExpenseCategory = memo(function ExpenseCategory({
let tooltip = useTooltip();

let onTooltipClose = () => {
onSave?.({
...category,
name: categoryName,
});
if (categoryName) {
onSave?.({
...category,
name: categoryName,
});
} else {
setCategoryName(category.name);
}
tooltip.close();
};

Expand Down Expand Up @@ -378,9 +382,7 @@ const ExpenseCategory = memo(function ExpenseCategory({
}
placeholder="Category Name"
value={categoryName}
onUpdate={name =>
setCategoryName(name ? name : category.name)
}
onUpdate={setCategoryName}
onEnter={onTooltipClose}
/>
<Button
Expand Down Expand Up @@ -873,10 +875,14 @@ const IncomeCategory = memo(function IncomeCategory({
let tooltip = useTooltip();

let onTooltipClose = () => {
onSave?.({
...category,
name: categoryName,
});
if (categoryName) {
onSave?.({
...category,
name: categoryName,
});
} else {
setCategoryName(category.name);
}
tooltip.close();
};

Expand Down Expand Up @@ -938,9 +944,7 @@ const IncomeCategory = memo(function IncomeCategory({
}
placeholder="Category Name"
value={categoryName}
onUpdate={name =>
setCategoryName(name ? name : category.name)
}
onUpdate={setCategoryName}
onEnter={onTooltipClose}
/>
<Button
Expand Down

0 comments on commit a4d8407

Please sign in to comment.