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

View File

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

View File

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

View File

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

View File

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

View File

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