From d6e6ed1cfab789eebf535cc6542a695531bdcaaf Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 9 Nov 2023 13:34:27 -0800 Subject: [PATCH] Keep single Save button, Show next sync, default to prod Khoj URL in Desktop app - Make mutable syncing variable not a const - Show next sync time to make users aware of data sync is automated - Keep a single Save button to reduce confusion. It does what Save All previously did. Intent to manual sync should Save All - Default to using app.khoj.dev as default Khoj URL to ease setup --- src/interface/desktop/config.html | 5 +---- src/interface/desktop/main.js | 4 ++-- src/interface/desktop/renderer.js | 5 ++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/interface/desktop/config.html b/src/interface/desktop/config.html index c63a2a5c..fb39fbb8 100644 --- a/src/interface/desktop/config.html +++ b/src/interface/desktop/config.html @@ -91,10 +91,7 @@
- -
-
- +
diff --git a/src/interface/desktop/main.js b/src/interface/desktop/main.js index ef46ce00..9a42bc5f 100644 --- a/src/interface/desktop/main.js +++ b/src/interface/desktop/main.js @@ -10,7 +10,7 @@ const {dialog} = require('electron'); const cron = require('cron').CronJob; const axios = require('axios'); -const KHOJ_URL = 'http://127.0.0.1:42110' +const KHOJ_URL = 'https://app.khoj.dev'; const Store = require('electron-store'); @@ -67,7 +67,7 @@ const schema = { } }; -const syncing = false; +let syncing = false; var state = {} const store = new Store({ schema }); diff --git a/src/interface/desktop/renderer.js b/src/interface/desktop/renderer.js index 849a8293..7e3dba4c 100644 --- a/src/interface/desktop/renderer.js +++ b/src/interface/desktop/renderer.js @@ -155,11 +155,14 @@ window.updateStateAPI.onUpdateState((event, state) => { loadingBar.style.display = 'none'; let syncStatusElement = document.getElementById("sync-status"); const currentTime = new Date(); + nextSyncTime = new Date(); + nextSyncTime.setMinutes(Math.ceil((nextSyncTime.getMinutes() + 1) / 10) * 10); if (state.completed == false) { syncStatusElement.innerHTML = `Sync was unsuccessful at ${currentTime.toLocaleTimeString()}. Contact team@khoj.dev to report this issue.`; return; } - syncStatusElement.innerHTML = `Last synced at ${currentTime.toLocaleTimeString()}`; + const options = { hour: '2-digit', minute: '2-digit' }; + syncStatusElement.innerHTML = `⏱️ Synced at ${currentTime.toLocaleTimeString(undefined, options)}. Next sync at ${nextSyncTime.toLocaleTimeString(undefined, options)}.`; }); const urlInput = document.getElementById('khoj-host-url');