Add messaging on saves and loading

This commit is contained in:
Robbie Antenesse 2019-05-09 14:34:32 -06:00
parent 5da39269b5
commit eecdde7a0a
4 changed files with 9 additions and 2 deletions

View File

@ -7,7 +7,7 @@ import { loadDictionary } from './js/dictionaryManagement';
import { loadSettings } from './js/settings';
function initialize() {
addMessage('Loading!');
addMessage('Loading...');
loadDictionary();
loadSettings();
// generateRandomWords(100);

View File

@ -1,6 +1,7 @@
import { renderDictionaryDetails, renderPartsOfSpeech } from "./render";
import { removeTags, cloneObject, getTimestampInSeconds } from "../helpers";
import { LOCAL_STORAGE_KEY, DEFAULT_DICTIONARY, MIGRATE_VERSION } from "../constants";
import { addMessage } from "./utilities";
export function updateDictionary () {
@ -62,6 +63,7 @@ export function saveEditModal() {
window.currentDictionary.settings.isComplete = document.getElementById('editIsComplete').checked;
window.currentDictionary.settings.isPublic = document.getElementById('editIsPublic').checked;
addMessage('Saved ' + window.currentDictionary.specification + ' Successfully');
saveDictionary();
renderDictionaryDetails();
renderPartsOfSpeech();

View File

@ -2,6 +2,7 @@ import { SETTINGS_KEY, DEFAULT_SETTINGS } from "../constants";
import { cloneObject } from "../helpers";
import { usePhondueDigraphs } from "./KeyboardFire/phondue/ipaField";
import { renderWords } from "./render";
import { addMessage } from "./utilities";
export function loadSettings() {
const storedSettings = window.localStorage.getItem(SETTINGS_KEY);
@ -11,6 +12,7 @@ export function loadSettings() {
export function saveSettings() {
window.localStorage.setItem(SETTINGS_KEY, JSON.stringify(window.settings));
addMessage('Settings Saved!');
}
export function openSettingsModal() {

View File

@ -1,5 +1,5 @@
import { renderWords } from "./render";
import { wordExists } from "./utilities";
import { wordExists, addMessage } from "./utilities";
import removeDiacritics from "./StackOverflow/removeDiacritics";
import { removeTags } from "../helpers";
import { saveDictionary } from "./dictionaryManagement";
@ -48,6 +48,7 @@ export function sortWords(render) {
export function addWord(word, render = true) {
window.currentDictionary.words.push(word);
addMessage('Word Created Successfully');
sortWords(render);
}
@ -57,6 +58,7 @@ export function deleteWord(wordId) {
console.error('Could not find word to delete');
} else {
window.currentDictionary.words.splice(wordIndex, 1);
addMessage('Word Deleted Successfully');
sortWords(true);
}
}
@ -68,6 +70,7 @@ export function updateWord(word, wordId) {
console.error('Could not find word to update');
} else {
window.currentDictionary.words[wordIndex] = word;
addMessage('Word Updated Successfully');
sortWords(true);
}
}