Compare commits

..

2 commits

Author SHA1 Message Date
James Tan
19f37fe56a fix: Remove unneeded wrapper code 2024-07-16 21:13:51 -05:00
James Tan
c587f83890 fix: Change collapsed field from number to boolean 2024-07-16 21:13:25 -05:00

View file

@ -10,7 +10,7 @@ export interface Entry {
startTime: string; startTime: string;
endTime: string; endTime: string;
subEntries: Entry[]; subEntries: Entry[];
collapsed?: number; collapsed?: boolean;
} }
export async function saveTracker(tracker: Tracker, app: App, fileName: string, section: MarkdownSectionInformation): Promise<void> { export async function saveTracker(tracker: Tracker, app: App, fileName: string, section: MarkdownSectionInformation): Promise<void> {
@ -328,16 +328,12 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle
if (entry.collapsed) { if (entry.collapsed) {
delete entry.collapsed; delete entry.collapsed;
} else { } else {
entry.collapsed = 1; entry.collapsed = true;
} }
await saveTracker(tracker, this.app, getFile(), getSectionInfo()); await saveTracker(tracker, this.app, getFile(), getSectionInfo());
}); });
if (!entry.subEntries?.length) expandButton.buttonEl.style.visibility = 'hidden'; if (!entry.subEntries?.length) expandButton.buttonEl.style.visibility = 'hidden';
let nameWrapper = nameField.cell.createDiv({cls: "simple-time-tracker-table-expandwrapper"}); nameField.cell.insertBefore(expandButton.buttonEl, nameField.label);
nameWrapper.style.marginLeft = nameField.label.style.marginLeft;
nameField.label.style.marginLeft = null;
nameWrapper.insertBefore(expandButton.buttonEl, null);
nameWrapper.insertBefore(nameField.label, null);
let entryButtons = row.createEl("td"); let entryButtons = row.createEl("td");
entryButtons.addClass("simple-time-tracker-table-buttons"); entryButtons.addClass("simple-time-tracker-table-buttons");