Add messaging on saves and loading
This commit is contained in:
parent
5da39269b5
commit
eecdde7a0a
|
@ -7,7 +7,7 @@ import { loadDictionary } from './js/dictionaryManagement';
|
||||||
import { loadSettings } from './js/settings';
|
import { loadSettings } from './js/settings';
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
addMessage('Loading!');
|
addMessage('Loading...');
|
||||||
loadDictionary();
|
loadDictionary();
|
||||||
loadSettings();
|
loadSettings();
|
||||||
// generateRandomWords(100);
|
// generateRandomWords(100);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { renderDictionaryDetails, renderPartsOfSpeech } from "./render";
|
import { renderDictionaryDetails, renderPartsOfSpeech } from "./render";
|
||||||
import { removeTags, cloneObject, getTimestampInSeconds } from "../helpers";
|
import { removeTags, cloneObject, getTimestampInSeconds } from "../helpers";
|
||||||
import { LOCAL_STORAGE_KEY, DEFAULT_DICTIONARY, MIGRATE_VERSION } from "../constants";
|
import { LOCAL_STORAGE_KEY, DEFAULT_DICTIONARY, MIGRATE_VERSION } from "../constants";
|
||||||
|
import { addMessage } from "./utilities";
|
||||||
|
|
||||||
export function updateDictionary () {
|
export function updateDictionary () {
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ export function saveEditModal() {
|
||||||
window.currentDictionary.settings.isComplete = document.getElementById('editIsComplete').checked;
|
window.currentDictionary.settings.isComplete = document.getElementById('editIsComplete').checked;
|
||||||
window.currentDictionary.settings.isPublic = document.getElementById('editIsPublic').checked;
|
window.currentDictionary.settings.isPublic = document.getElementById('editIsPublic').checked;
|
||||||
|
|
||||||
|
addMessage('Saved ' + window.currentDictionary.specification + ' Successfully');
|
||||||
saveDictionary();
|
saveDictionary();
|
||||||
renderDictionaryDetails();
|
renderDictionaryDetails();
|
||||||
renderPartsOfSpeech();
|
renderPartsOfSpeech();
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { SETTINGS_KEY, DEFAULT_SETTINGS } from "../constants";
|
||||||
import { cloneObject } from "../helpers";
|
import { cloneObject } from "../helpers";
|
||||||
import { usePhondueDigraphs } from "./KeyboardFire/phondue/ipaField";
|
import { usePhondueDigraphs } from "./KeyboardFire/phondue/ipaField";
|
||||||
import { renderWords } from "./render";
|
import { renderWords } from "./render";
|
||||||
|
import { addMessage } from "./utilities";
|
||||||
|
|
||||||
export function loadSettings() {
|
export function loadSettings() {
|
||||||
const storedSettings = window.localStorage.getItem(SETTINGS_KEY);
|
const storedSettings = window.localStorage.getItem(SETTINGS_KEY);
|
||||||
|
@ -11,6 +12,7 @@ export function loadSettings() {
|
||||||
|
|
||||||
export function saveSettings() {
|
export function saveSettings() {
|
||||||
window.localStorage.setItem(SETTINGS_KEY, JSON.stringify(window.settings));
|
window.localStorage.setItem(SETTINGS_KEY, JSON.stringify(window.settings));
|
||||||
|
addMessage('Settings Saved!');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openSettingsModal() {
|
export function openSettingsModal() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { renderWords } from "./render";
|
import { renderWords } from "./render";
|
||||||
import { wordExists } from "./utilities";
|
import { wordExists, addMessage } from "./utilities";
|
||||||
import removeDiacritics from "./StackOverflow/removeDiacritics";
|
import removeDiacritics from "./StackOverflow/removeDiacritics";
|
||||||
import { removeTags } from "../helpers";
|
import { removeTags } from "../helpers";
|
||||||
import { saveDictionary } from "./dictionaryManagement";
|
import { saveDictionary } from "./dictionaryManagement";
|
||||||
|
@ -48,6 +48,7 @@ export function sortWords(render) {
|
||||||
|
|
||||||
export function addWord(word, render = true) {
|
export function addWord(word, render = true) {
|
||||||
window.currentDictionary.words.push(word);
|
window.currentDictionary.words.push(word);
|
||||||
|
addMessage('Word Created Successfully');
|
||||||
sortWords(render);
|
sortWords(render);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ export function deleteWord(wordId) {
|
||||||
console.error('Could not find word to delete');
|
console.error('Could not find word to delete');
|
||||||
} else {
|
} else {
|
||||||
window.currentDictionary.words.splice(wordIndex, 1);
|
window.currentDictionary.words.splice(wordIndex, 1);
|
||||||
|
addMessage('Word Deleted Successfully');
|
||||||
sortWords(true);
|
sortWords(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +70,7 @@ export function updateWord(word, wordId) {
|
||||||
console.error('Could not find word to update');
|
console.error('Could not find word to update');
|
||||||
} else {
|
} else {
|
||||||
window.currentDictionary.words[wordIndex] = word;
|
window.currentDictionary.words[wordIndex] = word;
|
||||||
|
addMessage('Word Updated Successfully');
|
||||||
sortWords(true);
|
sortWords(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue