WIP / FIx & no-unused-vars

This commit is contained in:
elforjani3
2020-05-25 19:31:42 +02:00
parent 18a032ffd1
commit d107e84285
95 changed files with 324 additions and 352 deletions

View File

@@ -2,7 +2,7 @@ import React from 'react';
import {Tabs, Tab} from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
import PreferencesSubContent from 'components/Preferences/PreferencesSubContent';
import { FormattedMessage as T, useIntl } from 'react-intl';
import { FormattedMessage as T} from 'react-intl';
export default function AccountsPreferences() {
const history = useHistory();

View File

@@ -12,7 +12,7 @@ function CurrenciesActions({
}) {
const handleClickNewCurrency = useCallback(() => {
openDialog('currency-form');
}, []);
}, [openDialog]);
return (
<div class="users-actions">

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useCallback, useState, useMemo } from 'react';
import React, { useCallback, useState, useMemo } from 'react';
import {
Button,
Popover,
@@ -41,17 +41,25 @@ function CurrenciesList({
const fetchCurrencies = useQuery(['currencies-table'],
() => requestFetchCurrencies());
const handleEditCurrency = (currency) => {
// const handleEditCurrency = (currency) => {
// openDialog('currency-form', {
// action: 'edit',
// currencyCode: currency.currency_code,
// });
// };
const handleEditCurrency =useCallback((currency)=>{
openDialog('currency-form', {
action: 'edit',
currencyCode: currency.currency_code,
});
};
action: 'edit',
currencyCode: currency.currency_code,
});
},[openDialog])
const onDeleteCurrency = (currency) => {
setDeleteCurrencyState(currency);
};
// const onDeleteCurrency = (currency) => {
// setDeleteCurrencyState(currency);
// };
const onDeleteCurrency =useCallback((currency)=>{setDeleteCurrencyState(currency);},[])
const handleCancelCurrencyDelete = () => {
setDeleteCurrencyState(false);
};
@@ -65,7 +73,7 @@ function CurrenciesList({
});
}
);
}, [deleteCurrencyState]);
}, [requestDeleteCurrency,deleteCurrencyState,formatMessage]);
const actionMenuList = useCallback((currency) => (
<Menu>
@@ -78,7 +86,7 @@ function CurrenciesList({
onClick={() => onDeleteCurrency(currency)}
/>
</Menu>
), []);
), [handleEditCurrency,onDeleteCurrency]);
const columns = useMemo(() => [
{
@@ -110,11 +118,11 @@ function CurrenciesList({
className: 'actions',
width: 50,
},
], [actionMenuList]);
], [actionMenuList,formatMessage]);
const handleDatatableFetchData = useCallback(() => {
onFetchData && onFetchData();
}, []);
}, [onFetchData]);
return (
<LoadingIndicator>

View File

@@ -1,4 +1,4 @@
import React, { useState, useCallback, useMemo, useEffect } from 'react';
import React, { useState} from 'react';
import { useFormik } from 'formik';
import * as Yup from 'yup';
import {
@@ -13,6 +13,7 @@ import classNames from 'classnames';
import { TimezonePicker } from '@blueprintjs/timezone';
import { Select } from '@blueprintjs/select';
import { useQuery } from 'react-query';
import { FormattedMessage as T, useIntl } from 'react-intl';
import { compose, optionsMapToArray } from 'utils';
@@ -21,7 +22,6 @@ import AppToaster from 'components/AppToaster';
import withSettings from 'containers/Settings/withSettings';
import withSettingsActions from 'containers/Settings/withSettingsActions';
import { FormattedMessage as T, useIntl } from 'react-intl';
function GeneralPreferences({
@@ -79,13 +79,10 @@ function GeneralPreferences({
const {
errors,
values,
touched,
isSubmitting,
setFieldValue,
getFieldProps,
handleSubmit,
resetForm,
} = useFormik({
enableReinitialize: true,
initialValues: {

View File

@@ -1,5 +1,5 @@
import React, { useCallback } from 'react';
import { Tabs, Tab, Button, Intent } from '@blueprintjs/core';
import React from 'react';
import { Tabs, Tab } from '@blueprintjs/core';
import PreferencesSubContent from 'components/Preferences/PreferencesSubContent';
import connector from 'connectors/UsersPreferences.connector';

View File

@@ -13,7 +13,7 @@ function UsersActions({
}) {
const onClickNewUser = useCallback(() => {
openDialog('user-form');
}, []);
}, [openDialog]);
return (
<div claass="preferences-actions">

View File

@@ -13,6 +13,7 @@ import {
Tag
} from '@blueprintjs/core';
import { snakeCase } from 'lodash';
import { FormattedMessage as T, useIntl } from 'react-intl';
import Icon from 'components/Icon';
import LoadingIndicator from 'components/LoadingIndicator';
@@ -25,7 +26,6 @@ import withUsers from 'containers/Users/withUsers';
import withUsersActions from 'containers/Users/withUsersActions';
import { compose } from 'utils';
import { FormattedMessage as T, useIntl } from 'react-intl';
function UsersListPreferences({
@@ -65,7 +65,7 @@ function UsersListPreferences({
setInactiveUserState(false);
AppToaster.show({ message: formatMessage({id:'the_user_has_been_successfully_inactivated'}) });
});
}, [inactiveUserState, requestInactiveUser, requestFetchUsers]);
}, [inactiveUserState, requestInactiveUser, requestFetchUsers,formatMessage]);
const onDeleteUser = (user) => {
setDeleteUserState(user);
@@ -160,7 +160,7 @@ function UsersListPreferences({
className: 'actions',
width: 50,
},
], [actionMenuList]);
], [actionMenuList,formatMessage]);
const handelDataTableFetchData = useCallback(() => {
onFetchData && onFetchData();