Browse Source

use constants for message strings

pull/69/head
Ginger Wong 6 years ago
parent
commit
eb699f9790
  1. 7
      webroot/js/message.js
  2. 4
      webroot/js/utils.js

7
webroot/js/message.js

@ -237,7 +237,7 @@ class MessagingInterface {
disableChat() { disableChat() {
if (this.formMessageInput) { if (this.formMessageInput) {
this.formMessageInput.disabled = true; this.formMessageInput.disabled = true;
this.formMessageInput.placeholder = "Chat is offline." this.formMessageInput.placeholder = CHAT_PLACEHOLDER_OFFLINE;
} }
} }
enableChat() { enableChat() {
@ -248,11 +248,8 @@ class MessagingInterface {
} }
setChatPlaceholderText() { setChatPlaceholderText() {
const firstMessageChatPlacholderText = "Type here to chat, no account necessary.";
const chatPlaceholderText = "Message"
const hasSentFirstChatMessage = getLocalStorage(KEY_CHAT_FIRST_MESSAGE_SENT); const hasSentFirstChatMessage = getLocalStorage(KEY_CHAT_FIRST_MESSAGE_SENT);
this.formMessageInput.placeholder = hasSentFirstChatMessage ? chatPlaceholderText : firstMessageChatPlacholderText this.formMessageInput.placeholder = hasSentFirstChatMessage ? CHAT_PLACEHOLDER_TEXT : CHAT_INITIAL_PLACEHOLDER_TEXT
} }
// handle Vue.js message display // handle Vue.js message display

4
webroot/js/utils.js

@ -55,6 +55,10 @@ const TEMP_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALA
const MESSAGE_OFFLINE = 'Stream is offline.'; const MESSAGE_OFFLINE = 'Stream is offline.';
const MESSAGE_ONLINE = 'Stream is online'; const MESSAGE_ONLINE = 'Stream is online';
const CHAT_INITIAL_PLACEHOLDER_TEXT = 'Type here to chat, no account necessary.';
const CHAT_PLACEHOLDER_TEXT = 'Message';
const CHAT_PLACEHOLDER_OFFLINE = 'Chat is offline.';
function getLocalStorage(key) { function getLocalStorage(key) {
try { try {

Loading…
Cancel
Save