Anki/qt/ts/src/toolbar.ts
Damien Elmes 4d7e23111e change sync label to indicate sync state
- blue for normal sync, red for full sync required
- refactor status fetching code so we don't hold a collection lock
during the network request, which slows things down
- fix sync spinner restarting when returning to deck list
2020-06-02 13:23:01 +10:00

22 lines
589 B
TypeScript

enum SyncState {
NoChanges = 0,
Normal,
Full,
}
function updateSyncColor(state: SyncState) {
const elem = document.getElementById("sync");
switch (state) {
case SyncState.NoChanges:
elem.classList.remove("full-sync", "normal-sync");
break;
case SyncState.Normal:
elem.classList.add("normal-sync");
elem.classList.remove("full-sync");
break;
case SyncState.Full:
elem.classList.add("full-sync");
elem.classList.remove("normal-sync");
break;
}
}