Skip to content

Commit

Permalink
feat(edit): Open edit view when clicking on an existing time entry
Browse files Browse the repository at this point in the history
  • Loading branch information
lise-toggl authored and shantanuraj committed Nov 21, 2019
1 parent 8b300ba commit 59335d7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/scripts/components/TimeEntriesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ type TimeEntriesListItemProps = {
project: Toggl.Project | null;
};
function TimeEntriesListItem ({ timeEntries, project }: TimeEntriesListItemProps) {
const tids = timeEntries.map(({ id }) => id);
const timeEntry = timeEntries[0];
const description = timeEntry.description || NO_DESCRIPTION;
const isBillable = !!timeEntry.billable;
Expand All @@ -107,8 +108,13 @@ function TimeEntriesListItem ({ timeEntries, project }: TimeEntriesListItemProps
const entriesCount = timeEntries.length;
const earliestStartTime = format(timeEntries[timeEntries.length - 1].start, 'HH:mm');

const editEntry = (e) => {
e.preventDefault();
window.PopUp.updateEditForm(window.PopUp.$editView);
};

return (
<EntryItem>
<EntryItem onClick={editEntry}>
<EntryItemRow>
{entriesCount > 1 &&
<GroupedEntryCounter title={`${entriesCount} entries since ${earliestStartTime}`}>{entriesCount}</GroupedEntryCounter>
Expand Down Expand Up @@ -246,6 +252,7 @@ const EntryItem = styled.li`
font-size: 14px;
box-shadow: ${itemShadow};
background-color: ${color.white};
cursor: pointer;
&:hover {
background-color: ${color.listItemHover};
Expand Down

0 comments on commit 59335d7

Please sign in to comment.