From eecdde7a0a10a80906423ab224460bd80a43d820 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Thu, 9 May 2019 14:34:32 -0600 Subject: [PATCH] Add messaging on saves and loading --- src/index.js | 2 +- src/js/dictionaryManagement.js | 2 ++ src/js/settings.js | 2 ++ src/js/wordManagement.js | 5 ++++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index e47eed6..68f8f34 100644 --- a/src/index.js +++ b/src/index.js @@ -7,7 +7,7 @@ import { loadDictionary } from './js/dictionaryManagement'; import { loadSettings } from './js/settings'; function initialize() { - addMessage('Loading!'); + addMessage('Loading...'); loadDictionary(); loadSettings(); // generateRandomWords(100); diff --git a/src/js/dictionaryManagement.js b/src/js/dictionaryManagement.js index b1fb454..bf466f6 100644 --- a/src/js/dictionaryManagement.js +++ b/src/js/dictionaryManagement.js @@ -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(); diff --git a/src/js/settings.js b/src/js/settings.js index e637846..21baa80 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -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() { diff --git a/src/js/wordManagement.js b/src/js/wordManagement.js index 4ebaa8e..e7951c7 100644 --- a/src/js/wordManagement.js +++ b/src/js/wordManagement.js @@ -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); } }