From d228d1194ae91fd3dcf007dd72b78a14654f0f5b Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 24 May 2019 11:45:08 -0600 Subject: [PATCH] Make some messages appear longer/permanently --- src/js/account/login.js | 6 +++--- src/js/utilities.js | 4 +++- src/js/wordManagement.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/js/account/login.js b/src/js/account/login.js index a348df4..fc2887e 100644 --- a/src/js/account/login.js +++ b/src/js/account/login.js @@ -37,7 +37,7 @@ export function logIn() { const loginModal = document.getElementById('loginModal'); loginModal.parentElement.removeChild(loginModal); triggerLoginChanges(); - addMessage(`Welcome${window.account.publicName !== '' ? ', ' + window.account.publicName : ''}! You are logged in.`); + addMessage(`Welcome${window.account.publicName !== '' ? ', ' + window.account.publicName : ''}! You are logged in.`, 0); syncDictionary(); } }).catch(err => console.error(err)); @@ -106,7 +106,7 @@ export function createAccount() { loginModal.parentElement.removeChild(loginModal); triggerLoginChanges(); addMessage('Account Created Successfully!'); - addMessage(`Welcome${publicName !== '' ? ', ' + publicName : ''}! You are logged in.`); + addMessage(`Welcome${publicName !== '' ? ', ' + publicName : ''}! You are logged in.`, 0); if (window.currentDictionary.hasOwnProperty('externalID')) { // Ensure dictionary uploads to overwrite the auto-created default dictionary delete window.currentDictionary.externalID; @@ -125,7 +125,7 @@ export function validateToken() { }, userData => { window.account = userData; triggerLoginChanges(); - addMessage(`Welcome${window.account.publicName !== '' ? ', ' + window.account.publicName : ''}! You are logged in.`, 10000); + addMessage(`Welcome${window.account.publicName !== '' ? ', ' + window.account.publicName : ''}! You are logged in.`, 0); syncDictionary(); }, error => { addMessage(error + '. Logging Out.', undefined, 'error'); diff --git a/src/js/utilities.js b/src/js/utilities.js index bfc072a..663a4fb 100644 --- a/src/js/utilities.js +++ b/src/js/utilities.js @@ -149,7 +149,9 @@ export function addMessage(messageText, time = 5000, extraClass = false) { }; closeButton.addEventListener('click', closeMessage); - setTimeout(closeMessage, time); + if (time > 0) { + setTimeout(closeMessage, time); + } } export function hideAllModals() { diff --git a/src/js/wordManagement.js b/src/js/wordManagement.js index 958e3aa..faad17b 100644 --- a/src/js/wordManagement.js +++ b/src/js/wordManagement.js @@ -84,7 +84,7 @@ export function addWord(word, render = true, message = true, upload = true) { word.createdOn = timestamp; window.currentDictionary.words.push(word); if (message) { - addMessage(`${word.name} Created Successfully`, 10000); + addMessage(`${word.name} Created Successfully`, 30000); } sortWords(render);