From 2a466ce2da2c04c118d669fccb9de5b875881d7e Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Sun, 31 May 2020 15:57:02 +0200 Subject: [PATCH] - Data table sticky header. - Mini sidebar toggle. - Refactor withDashboard and withDashboardActions. --- client/package.json | 3 + client/src/components/App.js | 2 - client/src/components/Dashboard/Dashboard.js | 21 +- .../components/Dashboard/DashboardTopbar.js | 28 +- client/src/components/DataTable.js | 377 +++++++++++------- client/src/components/MenuItem.js | 3 +- .../components/Sidebar/SidebarContainer.js | 39 +- client/src/components/Sidebar/SidebarMenu.js | 5 +- .../Accounting/MakeJournalEntriesForm.js | 324 ++++++++------- .../Accounting/MakeJournalEntriesTable.js | 23 +- .../Accounting/ManualJournalsDataTable.js | 253 ++++++------ .../Accounting/ManualJournalsList.js | 2 +- .../Accounting/ManualJournalsViewTabs.js | 6 +- .../src/containers/Accounts/AccountsChart.js | 4 +- .../containers/Accounts/AccountsDataTable.js | 5 +- .../containers/Accounts/AccountsViewsTabs.js | 6 +- .../src/containers/Dashboard/withDashboard.js | 36 +- .../Dashboard/withDashboardActions.js | 31 ++ .../containers/ExchangeRates/ExchangeRate.js | 138 ++++--- .../BalanceSheet/BalanceSheet.js | 6 +- .../BalanceSheet/BalanceSheetTable.js | 1 + .../GeneralLedger/GeneralLedger.js | 6 +- .../GeneralLedger/GeneralLedgerTable.js | 1 + .../FinancialStatements/Journal/Journal.js | 6 +- .../Journal/JournalTable.js | 1 + .../ProfitLossSheet/ProfitLossSheet.js | 6 +- .../ProfitLossSheet/ProfitLossSheetTable.js | 141 ++++--- .../TrialBalanceSheet/TrialBalanceSheet.js | 6 +- .../TrialBalanceSheetTable.js | 1 + client/src/containers/Items/ItemForm.js | 4 +- client/src/containers/Items/ItemFormPage.js | 6 +- .../Items/ItemsCategoryActionsBar.js | 4 +- client/src/containers/Items/ItemsList.js | 4 +- client/src/containers/Items/ItemsViewsTabs.js | 6 +- .../Preferences/Currencies/CurrenciesList.js | 2 - .../containers/Preferences/Users/UsersList.js | 4 +- .../containers/Views/ViewForm.container.js | 4 +- client/src/containers/Views/ViewFormPage.js | 5 +- client/src/store/createStore.js | 13 +- .../src/store/dashboard/dashboard.reducer.js | 5 + client/src/store/dashboard/dashboard.types.js | 1 + client/src/store/types.js | 1 - client/src/style/App.scss | 7 +- client/src/style/components/data-table.scss | 40 +- client/src/style/objects/form.scss | 4 + client/src/style/pages/dashboard.scss | 11 +- .../src/style/pages/financial-statements.scss | 30 +- client/src/style/views/Sidebar.scss | 78 +++- ...091642_create_subscriptions_plans_table.js | 4 - 49 files changed, 1045 insertions(+), 669 deletions(-) create mode 100644 client/src/containers/Dashboard/withDashboardActions.js diff --git a/client/package.json b/client/package.json index 25dab72d7..e7d8b7964 100644 --- a/client/package.json +++ b/client/package.json @@ -77,12 +77,15 @@ "react-redux": "^7.1.3", "react-router-breadcrumbs-hoc": "^3.2.10", "react-router-dom": "^5.1.2", + "react-scroll-sync": "^0.7.1", "react-scrollbars-custom": "^4.0.21", "react-sortablejs": "^2.0.11", "react-table": "^7.0.0", + "react-table-sticky": "^1.1.2", "react-use": "^13.26.1", "react-window": "^1.8.5", "redux": "^4.0.5", + "redux-localstorage": "^0.4.1", "redux-thunk": "^2.3.0", "resolve": "1.15.0", "resolve-url-loader": "3.1.1", diff --git a/client/src/components/App.js b/client/src/components/App.js index 7d6496314..e68fd59db 100644 --- a/client/src/components/App.js +++ b/client/src/components/App.js @@ -9,7 +9,6 @@ import PrivateRoute from 'components/PrivateRoute'; import Authentication from 'components/Authentication'; import Dashboard from 'components/Dashboard/Dashboard'; import GlobalErrors from 'containers/GlobalErrors/GlobalErrors'; -import AuthenticationDialogs from 'containers/Authentication/AuthenticationDialogs'; import messages from 'lang/en'; import 'style/App.scss'; @@ -30,7 +29,6 @@ function App({ locale }) { - diff --git a/client/src/components/Dashboard/Dashboard.js b/client/src/components/Dashboard/Dashboard.js index e2d5f189a..38887f7ed 100644 --- a/client/src/components/Dashboard/Dashboard.js +++ b/client/src/components/Dashboard/Dashboard.js @@ -1,23 +1,30 @@ import React from 'react'; import { Switch, Route } from 'react-router'; +import classNames from 'classnames'; + import Sidebar from 'components/Sidebar/Sidebar'; import DashboardContent from 'components/Dashboard/DashboardContent'; import DialogsContainer from 'components/DialogsContainer'; import PreferencesContent from 'components/Preferences/PreferencesContent'; import PreferencesSidebar from 'components/Preferences/PreferencesSidebar'; import Search from 'containers/GeneralSearch/Search'; +import withDashboard from 'containers/Dashboard/withDashboard'; -export default function Dashboard() { +import { compose } from 'utils'; + +function Dashboard({ sidebarExpended }) { return ( -
+
- + - + @@ -28,3 +35,9 @@ export default function Dashboard() {
); } + +export default compose( + withDashboard(({ sidebarExpended }) => ({ + sidebarExpended, + })), +)(Dashboard); diff --git a/client/src/components/Dashboard/DashboardTopbar.js b/client/src/components/Dashboard/DashboardTopbar.js index 0dbb29003..1bb520f25 100644 --- a/client/src/components/Dashboard/DashboardTopbar.js +++ b/client/src/components/Dashboard/DashboardTopbar.js @@ -14,14 +14,23 @@ import DashboardBreadcrumbs from 'components/Dashboard/DashboardBreadcrumbs'; import SearchConnect from 'connectors/Search.connect'; import Icon from 'components/Icon'; +import withDashboardActions from 'containers/Dashboard/withDashboardActions'; +import withDashboard from 'containers/Dashboard/withDashboard'; + import { compose } from 'utils'; function DashboardTopbar({ + + // #withDashboard pageTitle, pageSubtitle, editViewId, - globalSearchShow, + + // #withDashboardActions + toggleSidebarExpend, + + // #withGlobalSearch openGlobalSearch, }) { const history = useHistory(); @@ -38,11 +47,15 @@ function DashboardTopbar({ onClick={handlerClickEditView} /> ); + + const handleSidebarToggleBtn = () => { + toggleSidebarExpend(); + }; return (
-