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(notes): mark a GPX file with the track icon it wears elsewhere
Elian Doranc99a2b8e3ef5
diff --git a/packages/commons/src/lib/notes.spec.ts b/packages/commons/src/lib/notes.spec.tsindex a0d82d205b..c2323d3953 100644--- a/packages/commons/src/lib/notes.spec.ts+++ b/packages/commons/src/lib/notes.spec.ts@@ -119,6 +119,11 @@ describe("getNoteIcon", () => {expect(icon).toBe("bx bxs-file-pdf");});+ it("marks a GPX track as the journey it holds rather than as a file", () => {+ const icon = getNoteIcon(buildArgs({ type: "file", mime: "application/gpx+xml" }));+ expect(icon).toBe("bx bx-trip");+ });+it("falls back to the file icon for a file note with an unmapped mime", () => {const icon = getNoteIcon(buildArgs({ type: "file", mime: "text/plain" }));expect(icon).toBe("bx bx-file");@@ -171,6 +176,7 @@ describe("getMimeIcon", () => {expect(getMimeIcon("audio/mpeg")).toBe("bx bx-music");expect(getMimeIcon("image/gif")).toBe("bx bxs-file-gif");expect(getMimeIcon("image/png")).toBe("bx bx-image");+ expect(getMimeIcon("application/gpx+xml")).toBe("bx bx-trip");expect(getMimeIcon("text/plain")).toBe("bx bx-file");});diff --git a/packages/commons/src/lib/notes.ts b/packages/commons/src/lib/notes.tsindex 9438f529cd..1b1eb3dfb3 100644--- a/packages/commons/src/lib/notes.ts+++ b/packages/commons/src/lib/notes.ts@@ -82,6 +82,7 @@ const FILE_MIME_MAPPINGS: Record<string, string> = {"application/pdf": "bx bxs-file-pdf","application/vnd.oasis.opendocument.text": "bx bxs-file-doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document": "bx bxs-file-doc",+ "application/gpx+xml": "bx bx-trip",};const IMAGE_MIME_MAPPINGS: Record<string, string> = {