Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(import): per-file remove buttons in the file drop zone
Elian Doranad889a758e40
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 9082daed1d..75645911b8 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -250,8 +250,7 @@"drop_or_browse_multiple": "Drag and drop files here, or click to browse","browse_single": "Tap to choose a file","browse_multiple": "Tap to choose files",- "selected_one": "{{count}} file selected",- "selected_other": "{{count}} files selected"+ "remove_file": "Remove file"},"import_provider": {"choose_provider": "Choose a service above to import from."diff --git a/apps/client/src/widgets/dialogs/import/anytype.tsx b/apps/client/src/widgets/dialogs/import/anytype.tsxindex f63b3f4c9e..c8d23d12c2 100644--- a/apps/client/src/widgets/dialogs/import/anytype.tsx+++ b/apps/client/src/widgets/dialogs/import/anytype.tsx@@ -15,7 +15,7 @@ function AnytypePanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPaconst [shrinkImages, setShrinkImages] = useState(compressImages);// `format: "anytype"` routes the upload/native import to the Anytype importer, overriding the .zip// extension's default (the generic zip importer).- const { hasSelection, displayNames, onChange, onBrowse, onNativeDrop, doImport } = useProviderImport({ format: "anytype", parentNoteId, shrinkImages, closeDialog });+ const { hasSelection, displayNames, onChange, onBrowse, onNativeDrop, onRemove, doImport } = useProviderImport({ format: "anytype", parentNoteId, shrinkImages, closeDialog });// Keep the latest import handler in a ref so the footer effect depends only on whether a file is// selected, never on doImport's identity — otherwise re-pushing the footer on every change would loop@@ -38,7 +38,7 @@ function AnytypePanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPa<Card heading={t("anytype_import.choose_file")}><CardSection><OptionsRow name="import-file" description={t("anytype_import.description_long")} stacked>- <FileDropZone onChange={onChange} onBrowse={onBrowse} onNativeDrop={onNativeDrop} displayNames={displayNames} accept=".zip" />+ <FileDropZone onChange={onChange} onBrowse={onBrowse} onNativeDrop={onNativeDrop} onRemove={onRemove} displayNames={displayNames} accept=".zip" /></OptionsRow><OptionsRowWithTogglename="shrink-images"diff --git a/apps/client/src/widgets/dialogs/import/evernote.tsx b/apps/client/src/widgets/dialogs/import/evernote.tsxindex 1ae121f00a..cbbceac4d5 100644--- a/apps/client/src/widgets/dialogs/import/evernote.tsx+++ b/apps/client/src/widgets/dialogs/import/evernote.tsx@@ -16,7 +16,7 @@ function EvernotePanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPconst [shrinkImages, setShrinkImages] = useState(compressImages);// An Evernote export is one ENEX (.enex) file per notebook, so allow selecting several at once.- const onChange = useCallback((fileList: FileList | null) => setFiles(fileList ? Array.from(fileList) : []), []);+ const onChange = useCallback((fileList: File[] | null) => setFiles(fileList ?? []), []);const doImport = useCallback(async () => {if (!files.length) {diff --git a/apps/client/src/widgets/dialogs/import/files.tsx b/apps/client/src/widgets/dialogs/import/files.tsxindex 0a033bfd0d..aebbcf83c9 100644--- a/apps/client/src/widgets/dialogs/import/files.tsx+++ b/apps/client/src/widgets/dialogs/import/files.tsx@@ -14,7 +14,7 @@ import type { ImportProvider, ImportProviderPanelProps } from "./types.js";function FilesPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPanelProps) {const [compressImages] = useTriliumOptionBool("compressImages");- const [files, setFiles] = useState<FileList | null>(null);+ const [files, setFiles] = useState<File[] | null>(null);// Desktop only: files picked via the native OS dialog, identified by capability tokens (not paths) so// they can be imported in place. Mutually exclusive with `files` — picking clears one, the other clears it.const [nativeFiles, setNativeFiles] = useState<NativeImportPickedFile[] | null>(null);@@ -63,7 +63,7 @@ function FilesPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPane};closeDialog();- await importService.uploadFiles("notes", parentNoteId, Array.from(files), options).catch(() => {});+ await importService.uploadFiles("notes", parentNoteId, files, options).catch(() => {});}, [files, nativeFiles, safeImport, shrinkImages, textImportedAsText, codeImportedAsCode, spreadsheetImportedAsSpreadsheet, explodeArchives, replaceUnderscoresWithSpaces, parentNoteId, closeDialog]);// Desktop only: browse via the native OS dialog. The dialog (in the main process) is the sole source of@@ -80,7 +80,7 @@ function FilesPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPane// Drag-and-drop (or, off desktop, the in-page picker) goes through the normal upload route; a fresh// selection there clears any native pick so the two never coexist.- const onFilesChange = useCallback((list: FileList | null) => {+ const onFilesChange = useCallback((list: File[] | null) => {setFiles(list);if (list?.length) {setNativeFiles(null);@@ -125,6 +125,11 @@ function FilesPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPane// are read in place. Drag-and-drop still uses the upload route via onChange.onBrowse={utils.isElectron() ? () => void doNativeBrowse() : undefined}onNativeDrop={utils.isElectron() ? onNativeDrop : undefined}+ // onChange handles the upload-route files; the native picks are ours to remove.+ onRemove={(index) => setNativeFiles((prev) => {+ const next = prev?.filter((_, i) => i !== index) ?? null;+ return next?.length ? next : null;+ })}displayNames={nativeFiles?.map((file) => file.fileName)}/></CardSection>diff --git a/apps/client/src/widgets/dialogs/import/keep.tsx b/apps/client/src/widgets/dialogs/import/keep.tsxindex 49aa213f61..f803a382fc 100644--- a/apps/client/src/widgets/dialogs/import/keep.tsx+++ b/apps/client/src/widgets/dialogs/import/keep.tsx@@ -15,7 +15,7 @@ function KeepPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPanelconst [shrinkImages, setShrinkImages] = useState(compressImages);// `format: "keep"` routes the upload/native import to the Google Keep importer, overriding the .zip// extension's default (the generic zip importer).- const { hasSelection, displayNames, onChange, onBrowse, onNativeDrop, doImport } = useProviderImport({ format: "keep", parentNoteId, shrinkImages, closeDialog });+ const { hasSelection, displayNames, onChange, onBrowse, onNativeDrop, onRemove, doImport } = useProviderImport({ format: "keep", parentNoteId, shrinkImages, closeDialog });// Keep the latest import handler in a ref so the footer effect depends only on whether a file is// selected, never on doImport's identity — otherwise re-pushing the footer on every change would loop@@ -38,7 +38,7 @@ function KeepPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPanel<Card heading={t("keep_import.choose_file")}><CardSection><OptionsRow name="import-file" description={t("keep_import.description_long")} stacked>- <FileDropZone onChange={onChange} onBrowse={onBrowse} onNativeDrop={onNativeDrop} displayNames={displayNames} accept=".zip" />+ <FileDropZone onChange={onChange} onBrowse={onBrowse} onNativeDrop={onNativeDrop} onRemove={onRemove} displayNames={displayNames} accept=".zip" /></OptionsRow><OptionsRowWithTogglename="shrink-images"diff --git a/apps/client/src/widgets/dialogs/import/notion.tsx b/apps/client/src/widgets/dialogs/import/notion.tsxindex ba87a64974..784e8885a9 100644--- a/apps/client/src/widgets/dialogs/import/notion.tsx+++ b/apps/client/src/widgets/dialogs/import/notion.tsx@@ -15,7 +15,7 @@ function NotionPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPanconst [shrinkImages, setShrinkImages] = useState(compressImages);// `format: "notion"` routes the upload/native import to the Notion importer, overriding the .zip// extension's default (the generic zip importer).- const { hasSelection, displayNames, onChange, onBrowse, onNativeDrop, doImport } = useProviderImport({ format: "notion", parentNoteId, shrinkImages, closeDialog });+ const { hasSelection, displayNames, onChange, onBrowse, onNativeDrop, onRemove, doImport } = useProviderImport({ format: "notion", parentNoteId, shrinkImages, closeDialog });// Keep the latest import handler in a ref so the footer effect depends only on whether a file is// selected, never on doImport's identity — otherwise re-pushing the footer on every change would loop@@ -38,7 +38,7 @@ function NotionPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPan<Card heading={t("notion_import.choose_file")}><CardSection><OptionsRow name="import-file" description={t("notion_import.description_long")} stacked>- <FileDropZone onChange={onChange} onBrowse={onBrowse} onNativeDrop={onNativeDrop} displayNames={displayNames} accept=".zip" />+ <FileDropZone onChange={onChange} onBrowse={onBrowse} onNativeDrop={onNativeDrop} onRemove={onRemove} displayNames={displayNames} accept=".zip" /></OptionsRow><OptionsRowWithTogglename="shrink-images"diff --git a/apps/client/src/widgets/dialogs/import/obsidian.tsx b/apps/client/src/widgets/dialogs/import/obsidian.tsxindex b5c5d01bd1..91ba523c3f 100644--- a/apps/client/src/widgets/dialogs/import/obsidian.tsx+++ b/apps/client/src/widgets/dialogs/import/obsidian.tsx@@ -15,7 +15,7 @@ function ObsidianPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPconst [shrinkImages, setShrinkImages] = useState(compressImages);// `format: "obsidian"` routes the upload/native import to the Obsidian importer, overriding the .zip// extension's default (the generic zip importer).- const { hasSelection, displayNames, onChange, onBrowse, onNativeDrop, doImport } = useProviderImport({ format: "obsidian", parentNoteId, shrinkImages, closeDialog });+ const { hasSelection, displayNames, onChange, onBrowse, onNativeDrop, onRemove, doImport } = useProviderImport({ format: "obsidian", parentNoteId, shrinkImages, closeDialog });// Keep the latest import handler in a ref so the footer effect depends only on whether a file is// selected, never on doImport's identity — otherwise re-pushing the footer on every change would loop@@ -38,7 +38,7 @@ function ObsidianPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderP<Card heading={t("obsidian_import.choose_file")}><CardSection><p className="import-files-description">{t("obsidian_import.description_long")}</p>- <FileDropZone onChange={onChange} onBrowse={onBrowse} onNativeDrop={onNativeDrop} displayNames={displayNames} />+ <FileDropZone onChange={onChange} onBrowse={onBrowse} onNativeDrop={onNativeDrop} onRemove={onRemove} displayNames={displayNames} /><OptionsRowWithTogglename="shrink-images"label={t("import.shrinkImages")}diff --git a/apps/client/src/widgets/dialogs/import/useProviderImport.spec.tsx b/apps/client/src/widgets/dialogs/import/useProviderImport.spec.tsxindex 2ef693e8f7..07f47ff64d 100644--- a/apps/client/src/widgets/dialogs/import/useProviderImport.spec.tsx+++ b/apps/client/src/widgets/dialogs/import/useProviderImport.spec.tsx@@ -25,11 +25,6 @@ function Probe(args: Args) {return null;}-/** Builds a FileList-like the hook can index (it only reads `[0]` and `.length`). */-function fileListOf(...files: File[]): FileList {- return Object.assign(files.slice(), { item: (i: number) => files[i] ?? null }) as unknown as FileList;-}-describe("useProviderImport", () => {let container: HTMLElement;let closeDialog: ReturnType<typeof vi.fn>;@@ -84,7 +79,7 @@ describe("useProviderImport", () => {it("marks a selection once a file is chosen via the upload route", async () => {await mount();const file = new File(["x"], "vault.zip");- await act(async () => current().onChange(fileListOf(file)));+ await act(async () => current().onChange([file]));expect(current().hasSelection).toBe(true);// The upload route has no display name override — FileDropZone shows the File itself.expect(current().displayNames).toBeUndefined();@@ -92,11 +87,28 @@ describe("useProviderImport", () => {it("clears the selection when onChange receives no files", async () => {await mount();- await act(async () => current().onChange(fileListOf(new File(["x"], "vault.zip"))));+ await act(async () => current().onChange([new File(["x"], "vault.zip")]));await act(async () => current().onChange(null));expect(current().hasSelection).toBe(false);});+ it("clears either route's selection via onRemove (the drop zone's per-file [X])", async () => {+ isElectron.mockReturnValue(true);+ await mount();+ await act(async () => current().onChange([new File(["x"], "vault.zip")]));+ await act(async () => current().onRemove());+ expect(current().hasSelection).toBe(false);++ pickFiles.mockResolvedValueOnce({ status: "selected", files: [{ token: "tok", fileName: "Vault.zip" }] });+ await act(async () => {+ current().onBrowse?.();+ });+ expect(current().hasSelection).toBe(true);+ await act(async () => current().onRemove());+ expect(current().hasSelection).toBe(false);+ expect(current().displayNames).toBeUndefined();+ });+it("exposes native browse/drop on desktop", async () => {isElectron.mockReturnValue(true);await mount();@@ -110,7 +122,7 @@ describe("useProviderImport", () => {it("stores the native pick and shows its filename, clearing any upload file", async () => {await mount();- await act(async () => current().onChange(fileListOf(new File(["x"], "dropped.zip"))));+ await act(async () => current().onChange([new File(["x"], "dropped.zip")]));pickFiles.mockResolvedValueOnce({ status: "selected", files: [{ token: "tok", fileName: "Vault.zip" }] });await act(async () => {@@ -174,7 +186,7 @@ describe("useProviderImport", () => {it("uploads the chosen file with the provider format and safe-import flags", async () => {await mount({ shrinkImages: true });const file = new File(["x"], "vault.zip");- await act(async () => current().onChange(fileListOf(file)));+ await act(async () => current().onChange([file]));await act(async () => current().doImport());expect(closeDialog).toHaveBeenCalled();diff --git a/apps/client/src/widgets/dialogs/import/useProviderImport.ts b/apps/client/src/widgets/dialogs/import/useProviderImport.tsindex 65524faf31..48d7a85ac6 100644--- a/apps/client/src/widgets/dialogs/import/useProviderImport.ts+++ b/apps/client/src/widgets/dialogs/import/useProviderImport.ts@@ -17,11 +17,13 @@ interface ProviderImport {hasSelection: boolean;/** Native-pick filename(s) to show in the drop zone; undefined when using the upload route. */displayNames?: string[];- onChange: (files: FileList | null) => void;+ onChange: (files: File[] | null) => void;/** Desktop-only native browse (reads the zip in place); undefined elsewhere. */onBrowse?: () => void;/** Desktop-only native drop (reads the dropped zip in place); undefined elsewhere. */onNativeDrop?: (files: File[]) => Promise<boolean>;+ /** Removes the selection — a provider holds a single file, so the index is irrelevant (the drop zone's per-file [X]). */+ onRemove: () => void;doImport: () => Promise<void>;}@@ -35,7 +37,7 @@ export default function useProviderImport({ format, parentNoteId, shrinkImages,const [file, setFile] = useState<File | null>(null);const [nativeFile, setNativeFile] = useState<NativeImportPickedFile | null>(null);- const onChange = useCallback((files: FileList | null) => {+ const onChange = useCallback((files: File[] | null) => {setFile(files?.[0] ?? null);if (files?.length) {setNativeFile(null);@@ -63,6 +65,11 @@ export default function useProviderImport({ format, parentNoteId, shrinkImages,return true;}, []);+ const onRemove = useCallback(() => {+ setFile(null);+ setNativeFile(null);+ }, []);+const doImport = useCallback(async () => {// Close immediately and let the shared import toasts (registered in import.ts) report progress,// completion and any error. Swallow rejections so these void-ed calls don't raise unhandled ones.@@ -90,6 +97,7 @@ export default function useProviderImport({ format, parentNoteId, shrinkImages,onChange,onBrowse: utils.isElectron() ? () => void browse() : undefined,onNativeDrop: utils.isElectron() ? nativeDrop : undefined,+ onRemove,doImport};}diff --git a/apps/client/src/widgets/react/FileDropZone.css b/apps/client/src/widgets/react/FileDropZone.cssindex 8b7316628f..c95c428298 100644--- a/apps/client/src/widgets/react/FileDropZone.css+++ b/apps/client/src/widgets/react/FileDropZone.css@@ -5,7 +5,6 @@justify-content: center;width: 100%;min-height: 8em;- padding: 0.5em 1.5em;border: 1px solid var(--main-border-color);border-radius: 8px;background: var(--accented-background-color);@@ -56,15 +55,10 @@width: 100%;}-.file-drop-zone-count {- color: var(--muted-text-color);- font-size: 0.9em;-}-.file-drop-zone-files {list-style: none;margin: 0;- padding: 0;+ padding: 1em;display: flex;flex-direction: column;gap: 0.35em;@@ -86,3 +80,8 @@text-overflow: ellipsis;white-space: nowrap;}++.file-drop-zone-remove {+ margin-left: auto;+ flex-shrink: 0;+}diff --git a/apps/client/src/widgets/react/FileDropZone.spec.tsx b/apps/client/src/widgets/react/FileDropZone.spec.tsxindex e04018ad00..d2fbdfbd04 100644--- a/apps/client/src/widgets/react/FileDropZone.spec.tsx+++ b/apps/client/src/widgets/react/FileDropZone.spec.tsx@@ -58,6 +58,61 @@ describe("FileDropZone", () => {});});+ const removeButtons = () => Array.from(container.querySelectorAll<HTMLButtonElement>(".file-drop-zone-files .file-drop-zone-remove"));+ const click = (button: HTMLButtonElement) => act(async () => {+ button.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));+ });+ /** Simulates picking `files` through the in-page input. */+ const pickInternal = (files: File[]) => {+ const input = container.querySelector("input[type=file]") as HTMLInputElement;+ Object.defineProperty(input, "files", { value: files, configurable: true });+ return act(async () => {+ input.dispatchEvent(new Event("change", { bubbles: true }));+ });+ };+ const mustFind = <T,>(element: T | null | undefined, what: string): T => {+ if (!element) {+ throw new Error(`${what} not rendered`);+ }+ return element;+ };++ describe("per-file remove buttons", () => {+ it("removes one internal file and reports the remaining selection, null once empty", async () => {+ const onChange = vi.fn();+ await act(async () => render(<FileDropZone onChange={onChange} multiple />, container));+ const [fileA, fileB] = [new File(["a"], "a.zip"), new File(["b"], "b.zip")];+ await pickInternal([fileA, fileB]);++ await click(mustFind(removeButtons()[0], "first remove button"));+ expect(filenames()).toEqual(["b.zip"]);+ expect(onChange).toHaveBeenLastCalledWith([fileB]);++ await click(mustFind(removeButtons()[0], "remaining remove button"));+ expect(filenames()).toEqual([]);+ expect(onChange).toHaveBeenLastCalledWith(null);+ });++ it("delegates removal of an external entry to onRemove with its index", async () => {+ const onChange = vi.fn();+ const onRemove = vi.fn();+ const onBrowse = vi.fn();+ await act(async () => render(+ <FileDropZone onChange={onChange} onRemove={onRemove} onBrowse={onBrowse} displayNames={["a.zip", "b.zip"]} />,+ container+ ));+ onChange.mockClear(); // drop the mount-time reset call++ await click(mustFind(removeButtons()[1], "second remove button"));++ expect(onRemove).toHaveBeenCalledWith(1);+ // The external selection is the caller's — onChange only reports the internal one.+ expect(onChange).not.toHaveBeenCalled();+ // The click must not bubble to the label and reopen the browse dialog.+ expect(onBrowse).not.toHaveBeenCalled();+ });+ });+describe("onBrowse override", () => {it("calls the override and prevents the in-page file input from opening", async () => {const onBrowse = vi.fn();diff --git a/apps/client/src/widgets/react/FileDropZone.tsx b/apps/client/src/widgets/react/FileDropZone.tsxindex 35dfcb5836..8c1c9436a4 100644--- a/apps/client/src/widgets/react/FileDropZone.tsx+++ b/apps/client/src/widgets/react/FileDropZone.tsx@@ -4,10 +4,12 @@ import { useCallback, useEffect, useRef, useState } from "preact/hooks";import { t } from "../../services/i18n";import { isMobile } from "../../services/utils";+import ActionButton from "./ActionButton";export interface FileDropZoneProps {name?: string;- onChange: (files: FileList | null) => void;+ /** Reports the current selection after every change (picking, dropping, per-file removal, clearing); `null` when empty. */+ onChange: (files: File[] | null) => void;multiple?: boolean;/** Optional `accept` attribute forwarded to the underlying file input (e.g. `".zip"`). */accept?: string;@@ -26,14 +28,21 @@ export interface FileDropZoneProps {* `true` if handled — the upload `onChange` is then skipped; return `false` to fall back to upload.*/onNativeDrop?: (files: File[]) => Promise<boolean>;+ /**+ * Called when the user removes an *external* entry (`displayNames[index]`) via its per-file [X].+ * Internal selections are trimmed by the zone itself and reported through `onChange`; callers+ * passing `displayNames` must pass this too.+ */+ onRemove?: (index: number) => void;}/*** A styled drop region for selecting files: drag-and-drop onto it or click it to open the native file- * picker. Selected files are listed inside. Drop-in replacement for {@link FormFileUpload} — same- * `onChange(files)` / `multiple` contract.+ * picker. Selected files are listed inside, each removable via its own [X]. Covers the same role as+ * {@link FormFileUpload}, but reports the selection as a `File[]` (so per-file removal can be+ * expressed) rather than the input's raw `FileList`.*/-export default function FileDropZone({ name, onChange, multiple, accept, onBrowse, displayNames, onNativeDrop }: FileDropZoneProps) {+export default function FileDropZone({ name, onChange, multiple, accept, onBrowse, displayNames, onNativeDrop, onRemove }: FileDropZoneProps) {const inputRef = useRef<HTMLInputElement>(null);const [files, setFiles] = useState<File[]>([]);const [dragging, setDragging] = useState(false);@@ -54,7 +63,7 @@ export default function FileDropZone({ name, onChange, multiple, accept, onBrowsconst update = useCallback((list: FileList | null) => {const selected = list && list.length ? (multiple ? Array.from(list) : [list[0]]) : [];setFiles(selected);- onChange(selected.length ? list : null);+ onChange(selected.length ? selected : null);}, [multiple, onChange]);const onDragEnter = useCallback((e: DragEvent) => {@@ -86,6 +95,24 @@ export default function FileDropZone({ name, onChange, multiple, accept, onBrowsupdate(dropped);}, [update, onNativeDrop]);+ // Removes a single entry. An external (native) selection belongs to the caller, so its entries go+ // through onRemove; internal ones are trimmed here and reported via onChange. The input's value is+ // dropped so its stale FileList can't resurface and re-picking the same file still fires a change event.+ const removeAt = useCallback((e: MouseEvent, index: number) => {+ e.preventDefault();+ e.stopPropagation();+ if (displayNames?.length) {+ onRemove?.(index);+ return;+ }+ if (inputRef.current) {+ inputRef.current.value = "";+ }+ const remaining = files.filter((_, i) => i !== index);+ setFiles(remaining);+ onChange(remaining.length ? remaining : null);+ }, [displayNames, files, onChange, onRemove]);+// An external (native) selection takes precedence over whatever the in-page input/drop produced.const selectedNames = displayNames?.length ? displayNames : files.map((file) => file.name);@@ -111,10 +138,19 @@ export default function FileDropZone({ name, onChange, multiple, accept, onBrows/>{selectedNames.length ? (<div className="file-drop-zone-selection">- {selectedNames.length > 1 && <div className="file-drop-zone-count">{t("file_upload.selected", { count: selectedNames.length })}</div>}<ul className="file-drop-zone-files">{selectedNames.map((fileName, index) => (- <li key={index}><span className="bx bx-file-blank" /> <span className="file-drop-zone-filename">{fileName}</span></li>+ <li key={index}>+ <span className="bx bx-file-blank" />+ <span className="file-drop-zone-filename">{fileName}</span>+ <ActionButton+ className="file-drop-zone-remove"+ icon="bx bx-x"+ text={t("file_upload.remove_file")}+ tooltipClass="tooltip-top"+ onClick={(e) => removeAt(e, index)}+ />+ </li>))}</ul></div>