From 2b96d93565cf3227d67bbffe204656234e56b511 Mon Sep 17 00:00:00 2001 From: J Francisco Rader Date: Sat, 23 Jan 2021 18:44:00 -0500 Subject: [PATCH] Merge master --- .../src/apps/bank/components/alert/BankAlert.tsx | 2 +- .../components/notification/BankNotification.tsx | 4 ++-- .../contacts/components/List/ContactList.tsx | 16 ---------------- .../contacts/components/alert/ContactAlert.tsx | 8 ++++---- .../messages/components/modal/Conversation.tsx | 2 +- .../messages/components/modal/MessageModal.tsx | 4 ++-- .../notification/TwitterNotification.tsx | 4 ++-- 7 files changed, 12 insertions(+), 28 deletions(-) diff --git a/phone/src/apps/bank/components/alert/BankAlert.tsx b/phone/src/apps/bank/components/alert/BankAlert.tsx index ceff48e..eb535c4 100644 --- a/phone/src/apps/bank/components/alert/BankAlert.tsx +++ b/phone/src/apps/bank/components/alert/BankAlert.tsx @@ -26,7 +26,7 @@ export const BankAlert = () => { setMessage(t('APPS_BANK_ALERT_TRANSFER_FAILURE')); setSeverity('error'); } - }, [bankAlert]); + }, [bankAlert, t]); return ( { const { config } = usePhone(); useEffect(() => { - if (notification) { + if (notification && notification.id) { setVisible(true); } - }, [notification?.id]); + }, [notification]); if (!config?.bank.showNotifications || !notification) return null; diff --git a/phone/src/apps/contacts/components/List/ContactList.tsx b/phone/src/apps/contacts/components/List/ContactList.tsx index 3fc0d80..2b471a2 100644 --- a/phone/src/apps/contacts/components/List/ContactList.tsx +++ b/phone/src/apps/contacts/components/List/ContactList.tsx @@ -6,7 +6,6 @@ import { Avatar as MuiAvatar, List, ListItem, - makeStyles, } from '@material-ui/core'; import { useFilteredContacts } from '../../hooks/useFilteredContacts'; @@ -22,21 +21,6 @@ import Nui from '../../../../os/nui-events/utils/Nui'; import '../Contact.css'; -const useStyles = makeStyles((theme) => ({ - updateButton: { - margin: 'auto', - fontSize: 14, - width: 150, - background: '#2196f3', - marginBottom: 10, - padding: 8, - }, - collapseItem: { - margin: 'auto', - width: '50%', - }, -})); - export const ContactList = () => { const { filteredContacts } = useFilteredContacts(); const { setShowContactModal } = useContactModal(); diff --git a/phone/src/apps/contacts/components/alert/ContactAlert.tsx b/phone/src/apps/contacts/components/alert/ContactAlert.tsx index 67761cc..8e50533 100644 --- a/phone/src/apps/contacts/components/alert/ContactAlert.tsx +++ b/phone/src/apps/contacts/components/alert/ContactAlert.tsx @@ -1,5 +1,5 @@ import { Snackbar } from '@material-ui/core'; -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { Alert } from '../../../../ui/components/Alert'; import { useContactAlert } from '../../hooks/useAlert'; @@ -21,11 +21,11 @@ export const ContactAlert = () => { setAlert(null); }; - function setMessageAlert(type: AlertCategory, severity: 'success' | 'error') { + const setMessageAlert = useCallback((type: AlertCategory, severity: 'success' | 'error') => { setMessage(t(LOCALE_PREFIX + type)); setSeverity(severity); setOpen(true); - } + }, [t]); useEffect(() => { switch (alert) { @@ -47,7 +47,7 @@ export const ContactAlert = () => { case 'CONTACT_UPDATE_SUCCESS': setMessageAlert(alert, 'success'); } - }, [alert]); + }, [alert, setMessageAlert]); return ( { image ) : (
{message.message}
diff --git a/phone/src/apps/messages/components/modal/MessageModal.tsx b/phone/src/apps/messages/components/modal/MessageModal.tsx index f55fd94..40bdfca 100644 --- a/phone/src/apps/messages/components/modal/MessageModal.tsx +++ b/phone/src/apps/messages/components/modal/MessageModal.tsx @@ -44,7 +44,7 @@ export const MessageModal = () => { window.clearInterval(interval); window.clearTimeout(timeout); }; - }, [activeMessageGroup?.groupId]); + }, [activeMessageGroup]); useEffect(() => { // when we get a new message group we should scroll to the @@ -55,7 +55,7 @@ export const MessageModal = () => { element.scrollTop = element.scrollHeight; } } - }, [minimumLoadPassed, messages?.length]); + }, [activeMessageGroup, minimumLoadPassed]); // we add a minimum (but short) load time here so that // there isn't a quick flash of loading and immediately diff --git a/phone/src/apps/twitter/components/notification/TwitterNotification.tsx b/phone/src/apps/twitter/components/notification/TwitterNotification.tsx index c11bd91..14d7e31 100644 --- a/phone/src/apps/twitter/components/notification/TwitterNotification.tsx +++ b/phone/src/apps/twitter/components/notification/TwitterNotification.tsx @@ -54,10 +54,10 @@ function TwitterNotification() { const { config } = usePhone(); useEffect(() => { - if (notification) { + if (notification && notification.id) { setVisible(true); } - }, [notification?.id]); + }, [notification]); if (!config?.twitter.showNotifications || !notification) return null;