Skip to content

Commit

Permalink
fix: Fixed remember and pin action
Browse files Browse the repository at this point in the history
- Fixed remember and pin action
- Added time entry preview sum hours
- Bump version to 1.6.2
  • Loading branch information
CrawlerCode committed Jun 27, 2023
1 parent 14480da commit 291d688
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "redmine-time-tracking",
"description": "Redmine Time Tracking",
"version": "1.6.1",
"version": "1.6.2",
"author": {
"name": "CrawlerCode",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Redmine Time Tracking",
"version": "1.6.1",
"version": "1.6.2",
"description": "Start-stop timer for Redmine",
"icons": {
"16": "logo16.png",
Expand Down
4 changes: 2 additions & 2 deletions src/components/issues/IssuesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const IssuesList = ({ account, issues, issuesData: { data: issuesData, setData:
...issuesData,
[issue.id]: {
...data,
remember: true,
remembered: true,
},
});
}}
Expand All @@ -174,7 +174,7 @@ const IssuesList = ({ account, issues, issuesData: { data: issuesData, setData:
...issuesData,
[issue.id]: {
...data,
remembered: true,
pinned: true,
},
});
}}
Expand Down
4 changes: 2 additions & 2 deletions src/components/time/TimeEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type PropTypes = {
};

const TimeEntry = ({ entries, previewHours, maxHours = 24 }: PropTypes) => {
const hours = entries.reduce((sum, entry) => sum + entry.hours, 0);
const sumHours = entries.reduce((sum, entry) => sum + entry.hours, 0);
return (
<div className="flex gap-x-0.5 items-center">
{entries.map((entry) => (
Expand Down Expand Up @@ -54,7 +54,7 @@ const TimeEntry = ({ entries, previewHours, maxHours = 24 }: PropTypes) => {
<div
className="h-3 bg-gray-400/40 dark:bg-gray-700/40 rounded"
style={{
width: `${((maxHours - hours - (previewHours ?? 0)) / maxHours) * 100}%`,
width: `${((maxHours - sumHours - (previewHours ?? 0)) / maxHours) * 100}%`,
backgroundSize: "1rem 1rem",
backgroundImage: "linear-gradient(45deg,rgba(255,255,255,.05) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.05) 50%,rgba(255,255,255,.05) 75%,transparent 75%,transparent)",
}}
Expand Down
2 changes: 1 addition & 1 deletion src/components/time/TimeEntryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const TimeEntryList = ({ entries }: PropTypes) => {
return (
<div className="grid grid-cols-10 items-center gap-x-1">
<h4 className="col-span-1 text-sm">{format(date, "EEE")}</h4>
<h3 className="col-span-2 text-sm text-end font-semibold truncate">{hours} h</h3>
<h3 className="col-span-2 text-sm text-end font-semibold truncate text-clip">{hours} h</h3>
<div className="col-span-7">
<TimeEntry entries={groupEntries} maxHours={maxHours} />
</div>
Expand Down
11 changes: 9 additions & 2 deletions src/components/time/TimeEntryPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ type PropTypes = {
const TimeEntryPreview = ({ date, previewHours }: PropTypes) => {
const myTimeEntriesQuery = useMyTimeEntries(date, date);

const maxHours = myTimeEntriesQuery.data.reduce((sum, entry) => sum + entry.hours, 0) + previewHours;
const sumHours = myTimeEntriesQuery.data.reduce((sum, entry) => sum + entry.hours, 0) + previewHours;

return <TimeEntry entries={myTimeEntriesQuery.data} previewHours={previewHours} maxHours={maxHours > 12 ? maxHours : 12} />;
return (
<div className="grid grid-cols-6 items-center gap-x-1">
<h3 className="col-span-1 text-sm font-semibold truncate text-clip">{sumHours} h</h3>
<div className="col-span-5">
<TimeEntry entries={myTimeEntriesQuery.data} previewHours={previewHours} maxHours={sumHours > 12 ? sumHours : 12} />
</div>
</div>
);
};

export default TimeEntryPreview;
2 changes: 1 addition & 1 deletion src/pages/IssuesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const IssuesPage = () => {
const myIssuesQuery = useMyIssues(
Object.keys(issuesData.data)
.map((id) => Number(id))
.filter((id) => issuesData.data[id].remember || issuesData.data[id].active || issuesData.data[id].time > 0),
.filter((id) => issuesData.data[id].remembered || issuesData.data[id].remember || issuesData.data[id].active || issuesData.data[id].time > 0),
searching ? search : ""
);

Expand Down

0 comments on commit 291d688

Please sign in to comment.