diff --git a/src/config/sidebarMenu.js b/src/config/sidebarMenu.js index b11315670..9f4155005 100644 --- a/src/config/sidebarMenu.js +++ b/src/config/sidebarMenu.js @@ -538,6 +538,27 @@ export const SidebarMenu = [ }, ], }, + // --------------------- + // # Projects Management + // --------------------- + { + text: 'Projects', + type: ISidebarMenuItemType.Overlay, + overlayId: ISidebarMenuOverlayIds.Projects, + children: [ + { + text: 'Projects Management', + type: ISidebarMenuItemType.Group, + children: [ + { + text: 'Projects', + href: '/projects', + type: ISidebarMenuItemType.Link, + }, + ], + }, + ], + }, // --------------- // # Reports // --------------- diff --git a/src/containers/Dashboard/Sidebar/interfaces.ts b/src/containers/Dashboard/Sidebar/interfaces.ts index b3f7eaa3a..76e6a75b1 100644 --- a/src/containers/Dashboard/Sidebar/interfaces.ts +++ b/src/containers/Dashboard/Sidebar/interfaces.ts @@ -69,6 +69,7 @@ export enum ISidebarMenuOverlayIds { Contacts = 'Contacts', Cashflow = 'Cashflow', Expenses = 'Expenses', + Projects = 'Projects', } export enum ISidebarSubscriptionAbility { diff --git a/src/containers/Projects/components/index.tsx b/src/containers/Projects/components/index.tsx new file mode 100644 index 000000000..14e71d607 --- /dev/null +++ b/src/containers/Projects/components/index.tsx @@ -0,0 +1,60 @@ +import React from 'react'; +import intl from 'react-intl-universal'; + +import { Menu, MenuDivider, MenuItem, Intent } from '@blueprintjs/core'; + +import { Icon } from 'components'; +import { safeCallback } from 'utils'; + +/** + * Table actions cell. + */ +export const ActionsMenu = ({ + row: { original }, + payload: { onEdit, onDelete, onViewDetails, onNewTask }, +}) => ( + + } + text={intl.get('view_details')} + onClick={safeCallback(onViewDetails, original)} + /> + + } + text={'Edit Project'} + onClick={safeCallback(onEdit, original)} + /> + } + text={'New Task'} + onClick={safeCallback(onNewTask, original)} + /> + + } + intent={Intent.DANGER} + onClick={safeCallback(onDelete, original)} + /> + +); + +/** + * Retrieve projects list columns columns. + */ +export const useProjectsListColumns = () => { + return React.useMemo( + () => [ + { + id: 'name', + Header: 'Project Name', + accessor: 'name', + width: 100, + className: 'name', + clickable: true, + }, + ], + [], + ); +}; diff --git a/src/containers/Projects/containers/ProjectsActionsBar.tsx b/src/containers/Projects/containers/ProjectsActionsBar.tsx new file mode 100644 index 000000000..536e67c0c --- /dev/null +++ b/src/containers/Projects/containers/ProjectsActionsBar.tsx @@ -0,0 +1,126 @@ +import React from 'react'; +import { + Button, + NavbarGroup, + Classes, + NavbarDivider, + Alignment, +} from '@blueprintjs/core'; + +import { + Icon, + AdvancedFilterPopover, + DashboardActionViewsList, + DashboardFilterButton, + DashboardRowsHeightButton, + FormattedMessage as T, +} from 'components'; + +import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; + +import withProjects from './withProjects'; +import withProjectsActions from './withProjectsActions'; + +import withSettings from '../../Settings/withSettings'; +import withSettingsActions from '../../Settings/withSettingsActions'; +import withDialogActions from 'containers/Dialog/withDialogActions'; + +import { compose } from 'utils'; + +/** + * Projects actions bar. + * @returns + */ +function ProjectsActionsBar({ + // #withDialogActions + openDialog, + + // #withProjects + projectsFilterRoles, + + // #withProjectsActions + setProjectsTableState, + + // #withSettingsActions + addSetting, +}) { + // Handle tab change. + const handleTabChange = (view) => { + setProjectsTableState({ + viewSlug: view ? view.slug : null, + }); + }; + + // Handle click a refresh projects list. + const handleRefreshBtnClick = () => {}; + + // Handle table row size change. + const handleTableRowSizeChange = (size) => { + addSetting('projects', 'tableSize', size); + }; + + // Handle new project button click. + const handleNewProjectBtnClick = () => { + openDialog('project-form'); + }; + + return ( + + + } + views={[]} + onChange={handleTabChange} + /> + +