- Organize database seeds.

- Optimize design dashboard top bar.
This commit is contained in:
Ahmed Bouhuolia
2020-03-26 22:34:02 +02:00
parent a399052a30
commit d695188d3a
18 changed files with 121 additions and 45 deletions

View File

@@ -51,9 +51,7 @@ function AccountsDataTable({
]);
});
useEffect(() => {
fetchHook.execute();
}, [filterConditions]);
useEffect(() => { fetchHook.execute(); }, [filterConditions]);
// Refetch accounts list after custom view id change.
useEffect(() => {
@@ -64,20 +62,13 @@ function AccountsDataTable({
changeCurrentView(customViewId);
setTopbarEditView(customViewId);
}
if (customViewId && viewMeta) {
changePageSubtitle(viewMeta.name);
} else {
changePageSubtitle('');
}
changePageSubtitle((customViewId && viewMeta) ? viewMeta.name : '');
}, [customViewId]);
useEffect(
() => () => {
// Clear page subtitle when unmount the page.
changePageSubtitle('');
},
[]
);
useEffect(() => () => {
// Clear page subtitle when unmount the page.
changePageSubtitle('');
}, []);
const handleEditAccount = account => () => {
openDialog('account-form', { action: 'edit', id: account.id });
@@ -91,12 +82,10 @@ function AccountsDataTable({
<MenuDivider />
<MenuItem
text='Inactivate Account'
onClick={() => onInactiveAccount(account)}
/>
onClick={() => onInactiveAccount(account)} />
<MenuItem
text='Delete Account'
onClick={() => onDeleteAccount(account)}
/>
onClick={() => onDeleteAccount(account)} />
</Menu>
);

View File

@@ -14,18 +14,29 @@ import Icon from 'components/Icon';
import { Link } from 'react-router-dom';
import { compose } from 'utils';
import AccountsConnect from 'connectors/Accounts.connector';
import DashboardConnect from 'connectors/Dashboard.connector';
function AccountsViewsTabs({ views }) {
function AccountsViewsTabs({
views,
setTopbarEditView,
}) {
const history = useHistory();
const { custom_view_id: customViewId } = useParams();
const handleClickNewView = () => {
setTopbarEditView(null);
history.push('/dashboard/custom_views/accounts/new');
};
const handleViewLinkClick = () => {
setTopbarEditView(customViewId);
}
const tabs = views.map(view => {
const baseUrl = '/dashboard/accounts';
const link = (
<Link to={`${baseUrl}/${view.id}/custom_view`}>{view.name}</Link>
<Link
to={`${baseUrl}/${view.id}/custom_view`}
onClick={handleViewLinkClick}
>{view.name}</Link>
);
return <Tab id={`custom_view_${view.id}`} title={link} />;
});
@@ -52,4 +63,7 @@ function AccountsViewsTabs({ views }) {
);
}
export default compose(AccountsConnect)(AccountsViewsTabs);
export default compose(
AccountsConnect,
DashboardConnect,
)(AccountsViewsTabs);