From 94631bc2936f32373ab94814f3925de6d0fb3b21 Mon Sep 17 00:00:00 2001 From: Matt Wiseley Date: Mon, 3 Jul 2023 11:23:47 -0400 Subject: [PATCH] Editable timestamps and mobile horizontal scroll --- .gitignore | 3 + package-lock.json | 4 +- src/tracker.ts | 70 ++++++++++++++----- styles.css | 9 +++ .../plugins/simple-time-tracker/main | 62 +++++++++++----- .../plugins/simple-time-tracker/main.js | 62 +++++++++++----- .../plugins/simple-time-tracker/styles | 9 +++ .../plugins/simple-time-tracker/styles.css | 9 +++ 8 files changed, 171 insertions(+), 57 deletions(-) diff --git a/.gitignore b/.gitignore index 4059302..95409ea 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ node_modules # They should be uploaded to GitHub releases instead. /main.js +# Exclude local settings +data.json + # Exclude sourcemaps *.map diff --git a/package-lock.json b/package-lock.json index 487840e..24909f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "simple-time-tracker", - "version": "0.1.6", + "version": "0.1.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "simple-time-tracker", - "version": "0.1.6", + "version": "0.1.7", "license": "MIT", "devDependencies": { "@types/node": "^16.11.6", diff --git a/src/tracker.ts b/src/tracker.ts index 0437ea0..a594c3c 100644 --- a/src/tracker.ts +++ b/src/tracker.ts @@ -40,6 +40,7 @@ export function loadTracker(json: string): Tracker { } export function displayTracker(tracker: Tracker, element: HTMLElement, file: string, getSectionInfo: () => MarkdownSectionInformation, settings: SimpleTimeTrackerSettings): void { + element.classList.add('simple-time-tracker-container'); // add start/stop controls let running = isRunning(tracker); let btn = new ButtonComponent(element) @@ -201,6 +202,10 @@ function formatTimestamp(timestamp: number, settings: SimpleTimeTrackerSettings) return moment.unix(timestamp).format(settings.timestampFormat); } +function unFormatTimestamp(formatted: string, settings: SimpleTimeTrackerSettings): number { + return moment(formatted, settings.timestampFormat).unix(); +} + function formatDuration(totalTime: number, settings: SimpleTimeTrackerSettings): string { let ret = ""; let duration = moment.duration(totalTime); @@ -268,18 +273,48 @@ function createTableSection(entry: Entry, settings: SimpleTimeTrackerSettings): return ret; } +class EditableField { + cell: HTMLTableCellElement; + label: HTMLSpanElement; + box: TextComponent; + constructor(row: HTMLTableRowElement, indent: number, value: string) { + this.cell = row.createEl("td"); + this.label = this.cell.createEl("span", { text: value }); + this.label.style.marginLeft = `${indent}em`; + this.box = new TextComponent(this.cell).setValue(value); + this.box.inputEl.width = 10; + this.box.inputEl.classList.add('simple-time-tracker-input'); + this.box.inputEl.hide(); + } + editing(): boolean { + return this.label.hidden; + } + beginEdit(value: string) { + this.label.hidden = true; + this.box.setValue(value); + this.box.inputEl.show(); + } + endEdit(): string { + let value = this.box.getValue() + this.label.setText(value); + this.box.inputEl.hide(); + this.label.hidden = false; + return value; + } +} + function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableElement, newSegmentNameBox: TextComponent, running: boolean, file: string, getSectionInfo: () => MarkdownSectionInformation, settings: SimpleTimeTrackerSettings, indent: number) { let row = table.createEl("tr"); - let name = row.createEl("td"); - let namePar = name.createEl("span", {text: entry.name}); - namePar.style.marginLeft = `${indent}em`; - let nameBox = new TextComponent(name).setValue(entry.name); - nameBox.inputEl.hidden = true; + let nameField = new EditableField(row, indent, entry.name); - row.createEl("td", {text: entry.startTime ? formatTimestamp(entry.startTime, settings) : ""}); - row.createEl("td", {text: entry.endTime ? formatTimestamp(entry.endTime, settings) : ""}); - row.createEl("td", {text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : ""}); + let startValue = entry.startTime ? formatTimestamp(entry.startTime, settings) : ""; + let startField = new EditableField(row, indent, startValue); + + let endValue = entry.endTime ? formatTimestamp(entry.endTime, settings) : ""; + let endField = new EditableField(row, indent, endValue); + + row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" }); let entryButtons = row.createEl("td"); if (!running) { @@ -297,19 +332,16 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle .setTooltip("Edit") .setIcon("lucide-pencil") .onClick(async () => { - if (namePar.hidden) { - namePar.hidden = false; - nameBox.inputEl.hidden = true; + if (nameField.editing()) { + entry.name = nameField.endEdit(); + entry.startTime = unFormatTimestamp(startField.endEdit(), settings); + entry.endTime = unFormatTimestamp(endField.endEdit(), settings); + await saveTracker(tracker, this.app, file, getSectionInfo()); editButton.setIcon("lucide-pencil"); - if (nameBox.getValue()) { - entry.name = nameBox.getValue(); - namePar.setText(entry.name); - await saveTracker(tracker, this.app, file, getSectionInfo()); - } } else { - namePar.hidden = true; - nameBox.inputEl.hidden = false; - nameBox.setValue(entry.name); + nameField.beginEdit(entry.name); + startField.beginEdit(formatTimestamp(entry.startTime, settings)); + endField.beginEdit(formatTimestamp(entry.endTime, settings)); editButton.setIcon("lucide-check"); } }); diff --git a/styles.css b/styles.css index 61cf378..6f55554 100644 --- a/styles.css +++ b/styles.css @@ -1,3 +1,7 @@ +.simple-time-tracker-container { + overflow-x: scroll; +} + .simple-time-tracker-support { max-width: 50%; width: 400px; @@ -62,3 +66,8 @@ .simple-time-tracker-table .clickable-icon { display: inline; } + +.simple-time-tracker-input { + max-width: 150px; + min-width: 100px; +} diff --git a/test-vault/.obsidian/plugins/simple-time-tracker/main b/test-vault/.obsidian/plugins/simple-time-tracker/main index f152d05..050bdaf 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/main +++ b/test-vault/.obsidian/plugins/simple-time-tracker/main @@ -148,6 +148,7 @@ function loadTracker(json) { return { entries: [] }; } function displayTracker(tracker, element, file, getSectionInfo, settings) { + element.classList.add("simple-time-tracker-container"); let running = isRunning(tracker); let btn = new import_obsidian2.ButtonComponent(element).setClass("clickable-icon").setIcon(`lucide-${running ? "stop" : "play"}-circle`).setTooltip(running ? "End" : "Start").onClick(() => __async(this, null, function* () { if (running) { @@ -267,6 +268,9 @@ function setCountdownValues(tracker, current, total, currentDiv, settings) { function formatTimestamp(timestamp, settings) { return import_obsidian2.moment.unix(timestamp).format(settings.timestampFormat); } +function unFormatTimestamp(formatted, settings) { + return (0, import_obsidian2.moment)(formatted, settings.timestampFormat).unix(); +} function formatDuration(totalTime, settings) { let ret = ""; let duration = import_obsidian2.moment.duration(totalTime); @@ -327,15 +331,39 @@ function createTableSection(entry, settings) { } return ret; } +var EditableField = class { + constructor(row, indent, value) { + this.cell = row.createEl("td"); + this.label = this.cell.createEl("span", { text: value }); + this.label.style.marginLeft = `${indent}em`; + this.box = new import_obsidian2.TextComponent(this.cell).setValue(value); + this.box.inputEl.width = 10; + this.box.inputEl.classList.add("simple-time-tracker-input"); + this.box.inputEl.hide(); + } + editing() { + return this.label.hidden; + } + beginEdit(value) { + this.label.hidden = true; + this.box.setValue(value); + this.box.inputEl.show(); + } + endEdit() { + let value = this.box.getValue(); + this.label.setText(value); + this.box.inputEl.hide(); + this.label.hidden = false; + return value; + } +}; function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, file, getSectionInfo, settings, indent) { let row = table.createEl("tr"); - let name = row.createEl("td"); - let namePar = name.createEl("span", { text: entry.name }); - namePar.style.marginLeft = `${indent}em`; - let nameBox = new import_obsidian2.TextComponent(name).setValue(entry.name); - nameBox.inputEl.hidden = true; - row.createEl("td", { text: entry.startTime ? formatTimestamp(entry.startTime, settings) : "" }); - row.createEl("td", { text: entry.endTime ? formatTimestamp(entry.endTime, settings) : "" }); + let nameField = new EditableField(row, indent, entry.name); + let startValue = entry.startTime ? formatTimestamp(entry.startTime, settings) : ""; + let startField = new EditableField(row, indent, startValue); + let endValue = entry.endTime ? formatTimestamp(entry.endTime, settings) : ""; + let endField = new EditableField(row, indent, endValue); row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" }); let entryButtons = row.createEl("td"); if (!running) { @@ -345,19 +373,16 @@ function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, })); } let editButton = new import_obsidian2.ButtonComponent(entryButtons).setClass("clickable-icon").setTooltip("Edit").setIcon("lucide-pencil").onClick(() => __async(this, null, function* () { - if (namePar.hidden) { - namePar.hidden = false; - nameBox.inputEl.hidden = true; + if (nameField.editing()) { + entry.name = nameField.endEdit(); + entry.startTime = unFormatTimestamp(startField.endEdit(), settings); + entry.endTime = unFormatTimestamp(endField.endEdit(), settings); + yield saveTracker(tracker, this.app, file, getSectionInfo()); editButton.setIcon("lucide-pencil"); - if (nameBox.getValue()) { - entry.name = nameBox.getValue(); - namePar.setText(entry.name); - yield saveTracker(tracker, this.app, file, getSectionInfo()); - } } else { - namePar.hidden = true; - nameBox.inputEl.hidden = false; - nameBox.setValue(entry.name); + nameField.beginEdit(entry.name); + startField.beginEdit(formatTimestamp(entry.startTime, settings)); + endField.beginEdit(formatTimestamp(entry.endTime, settings)); editButton.setIcon("lucide-check"); } })); @@ -402,3 +427,4 @@ var SimpleTimeTrackerPlugin = class extends import_obsidian3.Plugin { }); } }; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL21haW4udHMiLCAic3JjL3NldHRpbmdzLnRzIiwgInNyYy9zZXR0aW5ncy10YWIudHMiLCAic3JjL3RyYWNrZXIudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IFBsdWdpbiB9IGZyb20gXCJvYnNpZGlhblwiO1xuaW1wb3J0IHsgZGVmYXVsdFNldHRpbmdzLCBTaW1wbGVUaW1lVHJhY2tlclNldHRpbmdzIH0gZnJvbSBcIi4vc2V0dGluZ3NcIjtcbmltcG9ydCB7IFNpbXBsZVRpbWVUcmFja2VyU2V0dGluZ3NUYWIgfSBmcm9tIFwiLi9zZXR0aW5ncy10YWJcIjtcbmltcG9ydCB7IGRpc3BsYXlUcmFja2VyLCBsb2FkVHJhY2tlciwgVHJhY2tlciB9IGZyb20gXCIuL3RyYWNrZXJcIjtcblxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgU2ltcGxlVGltZVRyYWNrZXJQbHVnaW4gZXh0ZW5kcyBQbH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uZChcbiAgICAgICAgICAgIGNyZWF0ZUVsKFwidGhcIiwge3RleHQ6IFwiU2VnbWVudFwifSksXG4gICAgICAgICAgICBjcmVhdGVFbChcInRoXCIsIHt0ZXh0OiBcIlN0YXJ0IHRpbWVcIn0pLFxuICAgICAgICAgICAgY3JlYXRlRWwoXCJ0aFwiLCB7dGV4dDogXCJFbmQgdGltZVwifSksXG4gICAgICAgICAgICBjcmVhdGVFbChcInRoXCIsIHt0ZXh0OiBcIkR1cmF0aW9uXCJ9KSxcbiAgICAgICAgICAgIGNyZWF0ZUVsKFwidGhcIikpO1xuXG4gICAgICAgIGZvciAobGV0IGVudHJ5IG9mIHRyYWNrZXIuZW50cmllcylcbiAgICAgICAgICAgIGFkZEVkaXRhYmxlVGFibGVSb3codHJhY2tlciwgZW50cnksIHRhYmxlLCBuZXdTZWdtZW50TmFtZUJveCwgcnVubmluZywgZmlsZSwgZ2V0U2VjdGlvbkluZm8sIHNldHRpbmdzLCAwKTtcblxuICAgICAgICAvLyBhZGQgY29weSBidXR0b25zXG4gICAgICAgIGxldCBidXR0b25zID0gZWxlbWVudC5jcmVhdGVFbChcImRpdlwiLCB7Y2xzOiBcInNpbXBsZS10aW1lLXRyYWNrZXItYm90dG9tXCJ9KTtcbiAgICAgICAgbmV3IEJ1dHRvbkNvbXBvbmVudChidXR0b25zKVxuICAgICAgICAgICAgLnNldEJ1dHRvblRleHQoXCJDb3B5IGFzIHRhYmxlXCIpXG4gICAgICAgICAgICAub25DbGljaygoKSA9PiBuYXZpZ2F0b3IuY2xpcGJvYXJkLndyaXRlVGV4dChjcmVhdGVNYXJrZG93blRhYmxlKHRyYWNrZXIsIHNldHRpbmdzKSkpO1xuICAgICAgICBuZXcgQnV0dG9uQ29tcG9uZW50KGJ1dHRvbnMpXG4gICAgICAgICAgICAuc2V0QnV0dG9uVGV4dChcIkNvcHkgYXMgQ1NWXCIpXG4gICAgICAgICAgICAub25DbGljaygoKSA9PiBuYXZpZ2F0b3IuY2xpcGJv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sS0FBSztBQUFBO0FBQUE7QUFBQTsiLAogICJuYW1lcyI6IFtdCn0K diff --git a/test-vault/.obsidian/plugins/simple-time-tracker/main.js b/test-vault/.obsidian/plugins/simple-time-tracker/main.js index f152d05..050bdaf 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/main.js +++ b/test-vault/.obsidian/plugins/simple-time-tracker/main.js @@ -148,6 +148,7 @@ function loadTracker(json) { return { entries: [] }; } function displayTracker(tracker, element, file, getSectionInfo, settings) { + element.classList.add("simple-time-tracker-container"); let running = isRunning(tracker); let btn = new import_obsidian2.ButtonComponent(element).setClass("clickable-icon").setIcon(`lucide-${running ? "stop" : "play"}-circle`).setTooltip(running ? "End" : "Start").onClick(() => __async(this, null, function* () { if (running) { @@ -267,6 +268,9 @@ function setCountdownValues(tracker, current, total, currentDiv, settings) { function formatTimestamp(timestamp, settings) { return import_obsidian2.moment.unix(timestamp).format(settings.timestampFormat); } +function unFormatTimestamp(formatted, settings) { + return (0, import_obsidian2.moment)(formatted, settings.timestampFormat).unix(); +} function formatDuration(totalTime, settings) { let ret = ""; let duration = import_obsidian2.moment.duration(totalTime); @@ -327,15 +331,39 @@ function createTableSection(entry, settings) { } return ret; } +var EditableField = class { + constructor(row, indent, value) { + this.cell = row.createEl("td"); + this.label = this.cell.createEl("span", { text: value }); + this.label.style.marginLeft = `${indent}em`; + this.box = new import_obsidian2.TextComponent(this.cell).setValue(value); + this.box.inputEl.width = 10; + this.box.inputEl.classList.add("simple-time-tracker-input"); + this.box.inputEl.hide(); + } + editing() { + return this.label.hidden; + } + beginEdit(value) { + this.label.hidden = true; + this.box.setValue(value); + this.box.inputEl.show(); + } + endEdit() { + let value = this.box.getValue(); + this.label.setText(value); + this.box.inputEl.hide(); + this.label.hidden = false; + return value; + } +}; function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, file, getSectionInfo, settings, indent) { let row = table.createEl("tr"); - let name = row.createEl("td"); - let namePar = name.createEl("span", { text: entry.name }); - namePar.style.marginLeft = `${indent}em`; - let nameBox = new import_obsidian2.TextComponent(name).setValue(entry.name); - nameBox.inputEl.hidden = true; - row.createEl("td", { text: entry.startTime ? formatTimestamp(entry.startTime, settings) : "" }); - row.createEl("td", { text: entry.endTime ? formatTimestamp(entry.endTime, settings) : "" }); + let nameField = new EditableField(row, indent, entry.name); + let startValue = entry.startTime ? formatTimestamp(entry.startTime, settings) : ""; + let startField = new EditableField(row, indent, startValue); + let endValue = entry.endTime ? formatTimestamp(entry.endTime, settings) : ""; + let endField = new EditableField(row, indent, endValue); row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" }); let entryButtons = row.createEl("td"); if (!running) { @@ -345,19 +373,16 @@ function addEditableTableRow(tracker, entry, table, newSegmentNameBox, running, })); } let editButton = new import_obsidian2.ButtonComponent(entryButtons).setClass("clickable-icon").setTooltip("Edit").setIcon("lucide-pencil").onClick(() => __async(this, null, function* () { - if (namePar.hidden) { - namePar.hidden = false; - nameBox.inputEl.hidden = true; + if (nameField.editing()) { + entry.name = nameField.endEdit(); + entry.startTime = unFormatTimestamp(startField.endEdit(), settings); + entry.endTime = unFormatTimestamp(endField.endEdit(), settings); + yield saveTracker(tracker, this.app, file, getSectionInfo()); editButton.setIcon("lucide-pencil"); - if (nameBox.getValue()) { - entry.name = nameBox.getValue(); - namePar.setText(entry.name); - yield saveTracker(tracker, this.app, file, getSectionInfo()); - } } else { - namePar.hidden = true; - nameBox.inputEl.hidden = false; - nameBox.setValue(entry.name); + nameField.beginEdit(entry.name); + startField.beginEdit(formatTimestamp(entry.startTime, settings)); + endField.beginEdit(formatTimestamp(entry.endTime, settings)); editButton.setIcon("lucide-check"); } })); @@ -402,3 +427,4 @@ var SimpleTimeTrackerPlugin = class extends import_obsidian3.Plugin { }); } }; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL21haW4udHMiLCAic3JjL3NldHRpbmdzLnRzIiwgInNyYy9z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VCLENBQUMsR0FBRyxHQUFHLE1BQU07QUFDeEUsWUFBSSxVQUFtQixZQUFZO0FBQ25DLFVBQUU7QUFDRix1QkFBZSxTQUFTLEdBQUcsRUFBRSxZQUFZLE1BQU0sRUFBRSxlQUFlLElBQUksS0FBSztBQUFBO0FBRzdFLFdBQUssV0FBVztBQUFBLFFBQ1osSUFBSTtBQUFBLFFBQ0osTUFBTTtBQUFBLFFBQ04sZ0JBQWdCLENBQUMsR0FBRyxNQUFNO0FBQ3RCLFlBQUUsaUJBQWlCO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSxFQUt6QixlQUE4QjtBQUFBO0FBQ2hDLFdBQUssV0FBVyxPQUFPLE9BQU8sSUFBSSxpQkFBaUIsTUFBTSxLQUFLO0FBQUE7QUFBQTtBQUFBLEVBRzVELGVBQThCO0FBQUE7QUFDaEMsWUFBTSxLQUFLLFNBQVMsS0FBSztBQUFBO0FBQUE7QUFBQTsiLAogICJuYW1lcyI6IFtdCn0K diff --git a/test-vault/.obsidian/plugins/simple-time-tracker/styles b/test-vault/.obsidian/plugins/simple-time-tracker/styles index 61cf378..6f55554 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/styles +++ b/test-vault/.obsidian/plugins/simple-time-tracker/styles @@ -1,3 +1,7 @@ +.simple-time-tracker-container { + overflow-x: scroll; +} + .simple-time-tracker-support { max-width: 50%; width: 400px; @@ -62,3 +66,8 @@ .simple-time-tracker-table .clickable-icon { display: inline; } + +.simple-time-tracker-input { + max-width: 150px; + min-width: 100px; +} diff --git a/test-vault/.obsidian/plugins/simple-time-tracker/styles.css b/test-vault/.obsidian/plugins/simple-time-tracker/styles.css index 61cf378..6f55554 100644 --- a/test-vault/.obsidian/plugins/simple-time-tracker/styles.css +++ b/test-vault/.obsidian/plugins/simple-time-tracker/styles.css @@ -1,3 +1,7 @@ +.simple-time-tracker-container { + overflow-x: scroll; +} + .simple-time-tracker-support { max-width: 50%; width: 400px; @@ -62,3 +66,8 @@ .simple-time-tracker-table .clickable-icon { display: inline; } + +.simple-time-tracker-input { + max-width: 150px; + min-width: 100px; +}