Skip to content

Commit 5a41ba2

Browse files
committed
feat(modal): Add icons for touched file list to show file actions more clearly.
1 parent 9918f76 commit 5a41ba2

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

src/touchedPlanModel.ts

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { App, Modal, Notice, PluginSettingTab, Setting } from "obsidian";
22
import type InvioPlugin from "./main"; // unavoidable
33
import type { TransItemType } from "./i18n";
4-
import { createElement, FilePlus2, Trash } from "lucide";
4+
import { createElement, FilePlus2, Trash, ArrowDownToLine, ArrowUpToLine } from "lucide";
55

66
import { log } from "./moreOnLog";
77
import { FileOrFolderMixedState } from "./baseTypes";
@@ -65,9 +65,9 @@ export class TouchedPlanModel extends Modal {
6565
cls: 'file-item-action'
6666
});
6767
if (val.decision === 'uploadLocalToRemote') {
68-
const iconSvgSyncPending = createElement(FilePlus2);
69-
iconSvgSyncPending.addClass('file-item-action-icon')
70-
li.appendChild(iconSvgSyncPending)
68+
const iconSvgCreate = createElement(FilePlus2);
69+
iconSvgCreate.addClass('file-item-action-icon')
70+
li.appendChild(iconSvgCreate)
7171
} else {
7272
const iconSvgTrash = createElement(Trash);
7373
iconSvgTrash.addClass('file-item-action-icon')
@@ -83,10 +83,20 @@ export class TouchedPlanModel extends Modal {
8383
});
8484
const ulLocal = contentEl.createEl("ul");
8585
toLocalFiles.forEach((val) => {
86-
ulLocal.createEl("li", {
87-
text: val.key + ' - ' + (val.decision === 'downloadRemoteToLocal' ? '➕' : '➖'),
88-
});
86+
const li = ulLocal.createEl("li", {
87+
text: val.key,
88+
cls: 'file-item-action'
8989
});
90+
if (val.decision === 'downloadRemoteToLocal') {
91+
const iconSvgCreate = createElement(FilePlus2);
92+
iconSvgCreate.addClass('file-item-action-icon')
93+
li.appendChild(iconSvgCreate)
94+
} else {
95+
const iconSvgTrash = createElement(Trash);
96+
iconSvgTrash.addClass('file-item-action-icon')
97+
li.appendChild(iconSvgTrash)
98+
}
99+
});
90100
}
91101

92102
if (conflictFiles.length > 0) {
@@ -95,9 +105,19 @@ export class TouchedPlanModel extends Modal {
95105
});
96106
const ulConflict = contentEl.createEl("ul");
97107
conflictFiles.forEach((val) => {
98-
ulConflict.createEl("li", {
99-
text: val.key + ' - Override ' + (val.decision === 'downloadRemoteToLocal' ? 'Local' : 'Remote'),
100-
});
108+
const li = ulConflict.createEl("li", {
109+
text: val.key,
110+
cls: 'file-item-action'
111+
});
112+
if (val.decision === 'downloadRemoteToLocal') {
113+
const iconSvgSyncDown = createElement(ArrowDownToLine);
114+
iconSvgSyncDown.addClass('file-item-action-icon')
115+
li.appendChild(iconSvgSyncDown)
116+
} else {
117+
const iconSvgUp = createElement(ArrowUpToLine);
118+
iconSvgUp.addClass('file-item-action-icon')
119+
li.appendChild(iconSvgUp)
120+
}
101121
});
102122
contentEl.createEl('p', {
103123
text: 'Warnning: Don\'t worry, to prevent data loss, conflicting files will generate a .conflict.md backup file with the overwritten content to your local folder.'

0 commit comments

Comments
 (0)