Skip to content

Commit

Permalink
Merge pull request #433 from NBISweden/fix/ondelete
Browse files Browse the repository at this point in the history
Capture key events for time entry deletion
  • Loading branch information
HenrikeW authored May 12, 2022
2 parents 08e24f8 + 1440110 commit cea717a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 10 additions & 0 deletions frontend/src/components/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ export const Cell = ({
spent_on: formatDate(date, dateFormat),
});
};
const onDeleteCellEntry = (e: any) => {
{
if (e.key === "Backspace") {
onCellChange(e);
} else if (e.key === "Delete") {
onCellChange(e);
}
}
};
const onCellChange = (event: any) => {
//makes sure that users can only input positive numbers up to 999.99999999...
//with an unlimited number of decimals behind the delimiter
Expand Down Expand Up @@ -73,6 +82,7 @@ export const Cell = ({
"yyyy-MM-dd"
)}`}
onChange={onCellChange}
onKeyUp={onDeleteCellEntry}
className="cell"
defaultValue={hours === 0 ? "" : hours}
/>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/Report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ export const Report = () => {
})
.then((response) => {
if (response.ok) {
console.log("Time reported");
return true;
} else if (response.status === 401) {
logout = true;
Expand Down

0 comments on commit cea717a

Please sign in to comment.