From a78a2a88cfa48af80c86226cf1e2bbbeaf361bfc Mon Sep 17 00:00:00 2001 From: fyears <1142836+fyears@users.noreply.github.com> Date: Sun, 16 Jan 2022 13:38:20 +0800 Subject: [PATCH] use feather icon --- package.json | 2 ++ src/main.ts | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dc5eee2..8b25081 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@microsoft/microsoft-graph-types": "^2.11.0", "@types/chai": "^4.2.22", "@types/chai-as-promised": "^7.1.4", + "@types/feather-icons": "^4.7.0", "@types/jsdom": "^16.2.13", "@types/lodash": "^4.14.178", "@types/mime-types": "^2.1.1", @@ -61,6 +62,7 @@ "codemirror": "^5.63.1", "crypto-browserify": "^3.12.0", "dropbox": "^10.22.0", + "feather-icons": "^4.28.0", "localforage": "^1.10.0", "lodash": "^4.17.21", "loglevel": "^1.8.0", diff --git a/src/main.ts b/src/main.ts index d1f8b4c..5d32e03 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,7 @@ -import { Modal, Notice, Plugin, Setting } from "obsidian"; +import { Modal, Notice, Plugin, Setting, addIcon } from "obsidian"; import cloneDeep from "lodash/cloneDeep"; import { nanoid } from "nanoid"; +import feather from "feather-icons"; import type { RemotelySavePluginSettings } from "./baseTypes"; import { COMMAND_CALLBACK, @@ -71,6 +72,17 @@ export default class RemotelySavePlugin extends Plugin { async onload() { log.info(`loading plugin ${this.manifest.id}`); + const iconNameSyncWait = `${this.manifest.id}-sync-wait`; + const iconNameSyncRunning = `${this.manifest.id}-sync-running`; + addIcon( + iconNameSyncWait, + feather.icons["rotate-ccw"].toSvg({ width: 100, height: 100 }) + ); + addIcon( + iconNameSyncRunning, + feather.icons["refresh-ccw"].toSvg({ width: 100, height: 100 }) + ); + this.oauth2Info = { verifier: "", helperModal: undefined, @@ -292,7 +304,7 @@ export default class RemotelySavePlugin extends Plugin { } ); - this.addRibbonIcon("switch", "Remotely Save", async () => { + this.addRibbonIcon(iconNameSyncWait, "Remotely Save", async () => { if (this.syncStatus !== "idle") { new Notice( `Remotely Save already running in stage ${this.syncStatus}!`