fix: project detail tabs.

This commit is contained in:
elforjani13
2022-06-15 11:38:20 +02:00
parent 0eb0aee1ef
commit f443a1b106
6 changed files with 25 additions and 25 deletions

View File

@@ -23,7 +23,7 @@ import { compose } from 'utils';
*/ */
function ProjectDetailActionsBar({ function ProjectDetailActionsBar({
// #withSettings // #withSettings
timeSheetsTableSize, timesheetsTableSize,
// #withSettingsActions // #withSettingsActions
addSetting, addSetting,
@@ -33,7 +33,7 @@ function ProjectDetailActionsBar({
// Handle table row size change. // Handle table row size change.
const handleTableRowSizeChange = (size) => { const handleTableRowSizeChange = (size) => {
addSetting('timeSheets', 'tableSize', size); addSetting('timesheets', 'tableSize', size);
}; };
// Handle the refresh button click. // Handle the refresh button click.
@@ -77,7 +77,7 @@ function ProjectDetailActionsBar({
/> />
<NavbarDivider /> <NavbarDivider />
<DashboardRowsHeightButton <DashboardRowsHeightButton
initialValue={timeSheetsTableSize} initialValue={timesheetsTableSize}
onChange={handleTableRowSizeChange} onChange={handleTableRowSizeChange}
/> />
<NavbarDivider /> <NavbarDivider />
@@ -95,7 +95,7 @@ function ProjectDetailActionsBar({
} }
export default compose( export default compose(
withSettingsActions, withSettingsActions,
withSettings(({ timeSheetsSettings }) => ({ withSettings(({ timesheetsSettings }) => ({
timeSheetsTableSize: timeSheetsSettings?.tableSize, timesheetsTableSize: timesheetsSettings?.tableSize,
})), })),
)(ProjectDetailActionsBar); )(ProjectDetailActionsBar);

View File

@@ -2,7 +2,7 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { Tabs, Tab } from '@blueprintjs/core'; import { Tabs, Tab } from '@blueprintjs/core';
import TimeSheetDataTable from './TimeSheetDataTable'; import TimesheetDataTable from './TimesheetDataTable';
/** /**
* Project detail tabs. * Project detail tabs.
@@ -21,7 +21,7 @@ export default function ProjectDetailTabs() {
<Tab <Tab
id="timesheet" id="timesheet"
title={intl.get('project_details.label.timesheet')} title={intl.get('project_details.label.timesheet')}
panel={<TimeSheetDataTable />} panel={<TimesheetDataTable />}
/> />
<Tab <Tab
id="purchases" id="purchases"

View File

@@ -27,7 +27,7 @@ export function ActionsMenu({
/** /**
* Retrieve timesheet list columns columns. * Retrieve timesheet list columns columns.
*/ */
export function useTimeSheetColumns() { export function useTimesheetColumns() {
return React.useMemo( return React.useMemo(
() => [ () => [
{ {

View File

@@ -5,13 +5,13 @@ import { DataTable, TableFastCell } from 'components';
import TableVirtualizedListRows from 'components/Datatable/TableVirtualizedRows'; import TableVirtualizedListRows from 'components/Datatable/TableVirtualizedRows';
import TableSkeletonRows from 'components/Datatable/TableSkeletonRows'; import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton'; import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
import { useTimeSheetColumns, ActionsMenu } from './components'; import { useTimesheetColumns, ActionsMenu } from './components';
import { TableStyle } from '../../../../../common'; import { TableStyle } from '../../../../../common';
import withSettings from '../../../../Settings/withSettings'; import withSettings from '../../../../Settings/withSettings';
import { compose } from 'utils'; import { compose } from 'utils';
const TimeSheet = [ const Timesheet = [
{ {
id: 1, id: 1,
data: '2020-01-01', data: '2020-01-01',
@@ -23,23 +23,23 @@ const TimeSheet = [
]; ];
/** /**
* TimeSheet DataTable. * Timesheet DataTable.
* @returns * @returns
*/ */
function TimeSheetDataTable({ function TimesheetDataTable({
// #withSettings // #withSettings
timeSheetsTableSize, timesheetsTableSize,
}) { }) {
// Retrieve timesheet table columns. // Retrieve timesheet table columns.
const columns = useTimeSheetColumns(); const columns = useTimesheetColumns();
// Handle delete timesheet. // Handle delete timesheet.
const handleDeleteTimeSheet = () => {}; const handleDeleteTimesheet = () => {};
return ( return (
<TimeSheetsTable <TimesheetsTable
columns={columns} columns={columns}
data={TimeSheet} data={Timesheet}
// loading={} // loading={}
// headerLoading={} // headerLoading={}
noInitialFetch={true} noInitialFetch={true}
@@ -52,23 +52,23 @@ function TimeSheetDataTable({
TableLoadingRenderer={TableSkeletonRows} TableLoadingRenderer={TableSkeletonRows}
TableRowsRenderer={TableVirtualizedListRows} TableRowsRenderer={TableVirtualizedListRows}
TableHeaderSkeletonRenderer={TableSkeletonHeader} TableHeaderSkeletonRenderer={TableSkeletonHeader}
vListrowHeight={timeSheetsTableSize === 'small' ? 32 : 40} vListrowHeight={timesheetsTableSize === 'small' ? 32 : 40}
vListOverscanRowCount={0} vListOverscanRowCount={0}
styleName={TableStyle.Constrant} styleName={TableStyle.Constrant}
payload={{ payload={{
onDelete: handleDeleteTimeSheet, onDelete: handleDeleteTimesheet,
}} }}
/> />
); );
} }
export default compose( export default compose(
withSettings(({ timeSheetsSettings }) => ({ withSettings(({ timesheetsSettings }) => ({
timeSheetsTableSize: timeSheetsSettings?.tableSize, timesheetsTableSize: timesheetsSettings?.tableSize,
})), })),
)(TimeSheetDataTable); )(TimesheetDataTable);
const TimeSheetsTable = styled(DataTable)` const TimesheetsTable = styled(DataTable)`
.table .tbody { .table .tbody {
.tbody-inner .tr.no-results { .tbody-inner .tr.no-results {
.td { .td {

View File

@@ -23,7 +23,7 @@ export default (mapState) => {
vendorsCreditNoteSetting: state.settings.data.vendorCredit, vendorsCreditNoteSetting: state.settings.data.vendorCredit,
warehouseTransferSettings: state.settings.data.warehouseTransfers, warehouseTransferSettings: state.settings.data.warehouseTransfers,
projectSettings:state.settings.data.projects, projectSettings:state.settings.data.projects,
timeSheetsSettings:state.settings.data.timeSheets timesheetsSettings:state.settings.data.timesheets
}; };
return mapState ? mapState(mapped, state, props) : mapped; return mapState ? mapState(mapped, state, props) : mapped;
}; };

View File

@@ -64,7 +64,7 @@ const initialState = {
projects: { projects: {
tableSize: 'medium', tableSize: 'medium',
}, },
timeSheets: { timesheets: {
tableSize: 'medium', tableSize: 'medium',
}, },
}, },