Skip to content

Build your personal knowledge base with Trilium Notes

feat(attachments): improve no items display

Elian Doran9d4151b65579
diff --git a/apps/client/src/widgets/type_widgets/Attachment.tsx b/apps/client/src/widgets/type_widgets/Attachment.tsx
index 851480dd7f..0d09749c15 100644
--- a/apps/client/src/widgets/type_widgets/Attachment.tsx
+++ b/apps/client/src/widgets/type_widgets/Attachment.tsx
@@ -19,7 +19,6 @@ import toast from "../../services/toast";
import utils from "../../services/utils";
import ws from "../../services/ws";
import Admonition from "../react/Admonition";
-import Alert from "../react/Alert";
import Button from "../react/Button";
import Dropdown from "../react/Dropdown";
import FormFileUpload from "../react/FormFileUpload";
@@ -28,6 +27,7 @@ import HelpButton from "../react/HelpButton";
import { useTriliumEvent } from "../react/hooks";
import Icon from "../react/Icon";
import Modal from "../react/Modal";
+import NoItems from "../react/NoItems";
import NoteLink from "../react/NoteLink";
import { ParentComponent, refToJQuerySelector } from "../react/react_utils";
import { TextPreview } from "./File";
@@ -45,16 +45,13 @@ export function AttachmentList({ note }: TypeWidgetProps) {
<div style={{display: "flex", flexDirection: "column", height: "100%"}}>
<AttachmentListHeader noteId={note.noteId} />
<div style={{overflow: "auto", flexGrow: 1}}>
-
- <div className="attachment-list-wrapper">
- {attachments.length ? (
- attachments.map(attachment => <AttachmentInfo key={attachment.attachmentId} attachment={attachment} />)
- ) : (
- <Alert type="info">
- {t("attachment_list.no_attachments")}
- </Alert>
- )}
- </div>
+ {attachments.length ? (
+ <div className="attachment-list-wrapper">
+ {attachments.map(attachment => <AttachmentInfo key={attachment.attachmentId} attachment={attachment} />)}
+ </div>
+ ) : (
+ <NoItems icon="bx bx-unlink" text={t("attachment_list.no_attachments")} />
+ )}
</div>
</div>
);