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
chore(ts): port sync_status.ts
Panagiotis Papadopoulos9fb95585f5b7
diff --git a/src/public/app/widgets/sync_status.js b/src/public/app/widgets/sync_status.tssimilarity index 90%rename from src/public/app/widgets/sync_status.jsrename to src/public/app/widgets/sync_status.tsindex d17b7ae172..f5dc186b65 100644--- a/src/public/app/widgets/sync_status.js+++ b/src/public/app/widgets/sync_status.ts@@ -72,6 +72,15 @@ const TPL = ``;export default class SyncStatusWidget extends BasicWidget {++ syncState: "unknown" | "in-progress" | "connected" | "disconnected";+ allChangesPushed: boolean;+ lastSyncedPush!: number;+ settings: {+ // TriliumNextTODO: narrow types and use TitlePlacement Type+ titlePlacement: string;+ }+constructor() {super();@@ -91,13 +100,14 @@ export default class SyncStatusWidget extends BasicWidget {ws.subscribeToMessages((message) => this.processMessage(message));}- showIcon(className) {+ showIcon(className: string) {if (!options.get("syncServerHost")) {this.toggleInt(false);return;}- Tooltip.getOrCreateInstance(this.$widget.find(`.sync-status-${className}`), {++ Tooltip.getOrCreateInstance(this.$widget.find(`.sync-status-${className}`)[0], {html: true,placement: this.settings.titlePlacement,fallbackPlacements: [this.settings.titlePlacement]@@ -108,7 +118,8 @@ export default class SyncStatusWidget extends BasicWidget {this.$widget.find(`.sync-status-${className}`).show();}- processMessage(message) {+ // TriliumNextTODO: Use Type Message from "services/ws.ts"+ processMessage(message: { type: string; lastSyncedPush: number; data: { lastSyncedPush: number } }) {if (message.type === "sync-pull-in-progress") {this.syncState = "in-progress";this.lastSyncedPush = message.lastSyncedPush;