some style improvements

This commit is contained in:
Ell 2022-09-27 21:35:26 +02:00
parent b972ab3def
commit c4548f5e67
5 changed files with 16 additions and 20 deletions

View file

@ -56,10 +56,10 @@ export function displayTracker(tracker: Tracker, element: HTMLElement): void {
// add timers // add timers
let timer = element.createDiv({ cls: "simple-time-tracker-timers" }); let timer = element.createDiv({ cls: "simple-time-tracker-timers" });
let currentDiv = timer.createEl("div", { cls: "simple-time-tracker-timer" }); let currentDiv = timer.createEl("div", { cls: "simple-time-tracker-timer" });
let current = currentDiv.createEl("span", { cls: "simple-time-tracker-timer-time", text: "00:00" }); let current = currentDiv.createEl("span", { cls: "simple-time-tracker-timer-time" });
currentDiv.createEl("span", { text: "CURRENT" }); currentDiv.createEl("span", { text: "CURRENT" });
let totalDiv = timer.createEl("div", { cls: "simple-time-tracker-timer" }); let totalDiv = timer.createEl("div", { cls: "simple-time-tracker-timer" });
let total = totalDiv.createEl("span", { cls: "simple-time-tracker-timer-time", text: "00:00" }); let total = totalDiv.createEl("span", { cls: "simple-time-tracker-timer-time" });
totalDiv.createEl("span", { text: "TOTAL" }); totalDiv.createEl("span", { text: "TOTAL" });
// add list // add list
@ -96,8 +96,10 @@ export function displayTracker(tracker: Tracker, element: HTMLElement): void {
function getCountdownDisplay(duration: moment.Duration): string { function getCountdownDisplay(duration: moment.Duration): string {
let ret = ""; let ret = "";
if (duration.hours() > 0) if (duration.hours() > 0)
ret += duration.hours().toString().padStart(2, "0") + ":"; ret += duration.hours() + "h ";
ret += duration.minutes().toString().padStart(2, "0") + ":" + duration.seconds().toString().padStart(2, "0"); if (duration.minutes() > 0)
ret += duration.minutes() + "m ";
ret += duration.seconds() + "s";
return ret; return ret;
} }
@ -118,5 +120,5 @@ function setCountdownValues(tracker: Tracker, current: HTMLElement, total: HTMLE
} }
total.setText(getCountdownDisplay(moment.duration(totalDuration))); total.setText(getCountdownDisplay(moment.duration(totalDuration)));
} }
currentDiv.toggleClass("simple-time-tracker-grayed", !currEntry || !!currEntry.endTime); currentDiv.hidden = !currEntry || !!currEntry.endTime;
} }

View file

@ -39,10 +39,6 @@
font-weight: bolder; font-weight: bolder;
} }
.simple-time-tracker-grayed {
opacity: 25%;
}
.simple-time-tracker-table { .simple-time-tracker-table {
width: 100%; width: 100%;
margin-top: 20px; margin-top: 20px;

File diff suppressed because one or more lines are too long

View file

@ -39,10 +39,6 @@
font-weight: bolder; font-weight: bolder;
} }
.simple-time-tracker-grayed {
opacity: 25%;
}
.simple-time-tracker-table { .simple-time-tracker-table {
width: 100%; width: 100%;
margin-top: 20px; margin-top: 20px;

View file

@ -1,7 +1,7 @@
This is a time tracker: This is a time tracker:
```simple-time-tracker ```simple-time-tracker
{"entries":[{"name":"Segment 1","startTime":1664306406,"endTime":1664306408},{"name":"Segment 2","startTime":1664306409,"endTime":1664306410},{"name":"Segment 3","startTime":1664306411,"endTime":1664306412},{"name":"Segment 4","startTime":1664306413,"endTime":1664306422},{"name":"Segment 5","startTime":1664306455,"endTime":1664306458},{"name":"Segment 6","startTime":1664306543,"endTime":1664306545},{"name":"Segment 7","startTime":1664306581,"endTime":1664306599},{"name":"Segment 8","startTime":1664306956,"endTime":1664306959},{"name":"Segment 9","startTime":1664306962,"endTime":1664306965}]} {"entries":[{"name":"Segment 1","startTime":1664306406,"endTime":1664306408},{"name":"Segment 2","startTime":1664306409,"endTime":1664306410},{"name":"Segment 3","startTime":1664306411,"endTime":1664306412},{"name":"Segment 4","startTime":1664306413,"endTime":1664306422},{"name":"Segment 5","startTime":1664306455,"endTime":1664306458},{"name":"Segment 6","startTime":1664306543,"endTime":1664306545},{"name":"Segment 7","startTime":1664306581,"endTime":1664306599},{"name":"Segment 8","startTime":1664306956,"endTime":1664306959},{"name":"Segment 9","startTime":1664306962,"endTime":1664306965},{"name":"Segment 10","startTime":1664307015,"endTime":1664307018},{"name":"Segment 11","startTime":1664307036,"endTime":1664307039},{"name":"Segment 12","startTime":1664307055,"endTime":1664307149},{"name":"Segment 13","startTime":1664307152,"endTime":1664307159},{"name":"Segment 14","startTime":1664307169,"endTime":1664307198},{"name":"Segment 15","startTime":1664307254,"endTime":1664307270},{"name":"Segment 16","startTime":1664307272,"endTime":1664307279},{"name":"Working on stuff","startTime":1664307284,"endTime":1664307290}]}
``` ```