Merge pull request #58 from project-error/task/cleanup-all-warnings

Fix all ts warnings
This commit is contained in:
Christopher Gjelten authored and GitHub committed 2021-01-24 18:38:26 +01:00
commit 3bf4cb183e
7 files changed
+12 -28

No files matched your search

@@ -26,7 +26,7 @@ export const BankAlert = () => {
setMessage(t('APPS_BANK_ALERT_TRANSFER_FAILURE')); setMessage(t('APPS_BANK_ALERT_TRANSFER_FAILURE'));
setSeverity('error'); setSeverity('error');
} }
}, [bankAlert]); }, [bankAlert, t]);
return ( return (
<Snackbar <Snackbar
@@ -15,10 +15,10 @@ export const BankNotification = () => {
const { config } = usePhone(); const { config } = usePhone();
useEffect(() => { useEffect(() => {
if (notification) { if (notification && notification.id) {
setVisible(true); setVisible(true);
} }
}, [notification?.id]); }, [notification]);
if (!config?.bank.showNotifications || !notification) return null; if (!config?.bank.showNotifications || !notification) return null;
@@ -6,7 +6,6 @@ import {
Avatar as MuiAvatar, Avatar as MuiAvatar,
List, List,
ListItem, ListItem,
makeStyles,
} from '@material-ui/core'; } from '@material-ui/core';
import { useFilteredContacts } from '../../hooks/useFilteredContacts'; import { useFilteredContacts } from '../../hooks/useFilteredContacts';
@@ -22,21 +21,6 @@ import Nui from '../../../../os/nui-events/utils/Nui';
import '../Contact.css'; 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 = () => { export const ContactList = () => {
const { filteredContacts } = useFilteredContacts(); const { filteredContacts } = useFilteredContacts();
const { setShowContactModal } = useContactModal(); const { setShowContactModal } = useContactModal();
@@ -1,5 +1,5 @@
import { Snackbar } from '@material-ui/core'; 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 { useTranslation } from 'react-i18next';
import { Alert } from '../../../../ui/components/Alert'; import { Alert } from '../../../../ui/components/Alert';
import { useContactAlert } from '../../hooks/useAlert'; import { useContactAlert } from '../../hooks/useAlert';
@@ -21,11 +21,11 @@ export const ContactAlert = () => {
setAlert(null); setAlert(null);
}; };
function setMessageAlert(type: AlertCategory, severity: 'success' | 'error') { const setMessageAlert = useCallback((type: AlertCategory, severity: 'success' | 'error') => {
setMessage(t(LOCALE_PREFIX + type)); setMessage(t(LOCALE_PREFIX + type));
setSeverity(severity); setSeverity(severity);
setOpen(true); setOpen(true);
} }, [t]);
useEffect(() => { useEffect(() => {
switch (alert) { switch (alert) {
@@ -47,7 +47,7 @@ export const ContactAlert = () => {
case 'CONTACT_UPDATE_SUCCESS': case 'CONTACT_UPDATE_SUCCESS':
setMessageAlert(alert, 'success'); setMessageAlert(alert, 'success');
} }
}, [alert]); }, [alert, setMessageAlert]);
return ( return (
<Snackbar <Snackbar
@@ -34,7 +34,7 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
<img <img
src={message.message} src={message.message}
className={classes.imageMessage} className={classes.imageMessage}
alt='image' alt='multimedia'
/> />
) : ( ) : (
<div>{message.message}</div> <div>{message.message}</div>
@@ -44,7 +44,7 @@ export const MessageModal = () => {
window.clearInterval(interval); window.clearInterval(interval);
window.clearTimeout(timeout); window.clearTimeout(timeout);
}; };
}, [activeMessageGroup?.groupId]); }, [activeMessageGroup]);
useEffect(() => { useEffect(() => {
// when we get a new message group we should scroll to the // when we get a new message group we should scroll to the
@@ -55,7 +55,7 @@ export const MessageModal = () => {
element.scrollTop = element.scrollHeight; element.scrollTop = element.scrollHeight;
} }
} }
}, [minimumLoadPassed, messages?.length]); }, [activeMessageGroup, minimumLoadPassed]);
// we add a minimum (but short) load time here so that // we add a minimum (but short) load time here so that
// there isn't a quick flash of loading and immediately // there isn't a quick flash of loading and immediately
@@ -54,10 +54,10 @@ function TwitterNotification() {
const { config } = usePhone(); const { config } = usePhone();
useEffect(() => { useEffect(() => {
if (notification) { if (notification && notification.id) {
setVisible(true); setVisible(true);
} }
}, [notification?.id]); }, [notification]);
if (!config?.twitter.showNotifications || !notification) return null; if (!config?.twitter.showNotifications || !notification) return null;