Skip to content

Commit

Permalink
Keep single Save button, Show next sync, default to prod Khoj URL in …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
debanjum committed Nov 9, 2023
1 parent e1f0128 commit d6e6ed1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/interface/desktop/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ <h3 class="card-title">
</div>
<div class="section-action-row">
<div class="card-description-row">
<button id="sync-data" class="sync-data">💾 Save</button>
</div>
<div class="card-description-row">
<button id="sync-force" class="sync-data">💾 Save All</button>
<button id="sync-force" class="sync-data">💾 Save</button>
</div>
<div class="card-description-row">
<button id="delete-all" class="sync-data">🗑️ Delete All</button>
Expand Down
4 changes: 2 additions & 2 deletions src/interface/desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -67,7 +67,7 @@ const schema = {
}
};

const syncing = false;
let syncing = false;
var state = {}
const store = new Store({ schema });

Expand Down
5 changes: 4 additions & 1 deletion src/interface/desktop/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit d6e6ed1

Please sign in to comment.