-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more time report screen width responsiveness work
- Loading branch information
Showing
17 changed files
with
490 additions
and
136 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/MediumScreen/Head/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import getStyle from './style'; | ||
import { getTimezoneAbbreviation } from '../utilities'; | ||
|
||
function Thead({ | ||
hasTimes, | ||
primaryTimezone, | ||
primaryTzLabel, | ||
date, | ||
hasEarningCols, | ||
hasSecondaryTzTimes, | ||
colRefs, | ||
colWidths, | ||
style: styleProp | ||
}) { | ||
|
||
const defaultTimeColLabel = hasTimes && ( | ||
'Times' + (hasSecondaryTzTimes ? ` (${getTimezoneAbbreviation(primaryTimezone, date)})` : '') | ||
); | ||
|
||
const style = getStyle(styleProp, colWidths); | ||
|
||
return ( | ||
<thead> | ||
<tr style={style.tr}> | ||
<th style={style.timesTh} ref={colRefs.times}> | ||
{primaryTzLabel || defaultTimeColLabel} | ||
</th> | ||
<th style={style.durationTh} ref={colRefs.duration}> | ||
Hours Worked | ||
</th> | ||
{hasEarningCols && ( | ||
<> | ||
<th style={style.payRateTh} ref={colRefs.payRate}> | ||
Pay Rate | ||
</th> | ||
<th style={style.amountEarnedTh} ref={colRefs.amountEarned}> | ||
Amount Earned | ||
</th> | ||
</> | ||
)} | ||
</tr> | ||
</thead> | ||
); | ||
} | ||
|
||
export default Thead; |
52 changes: 52 additions & 0 deletions
52
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/MediumScreen/Head/style.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { labelWeight, contentAreaDividerColor, cellXPadding, cellYPadding } from '../style'; | ||
|
||
const bottomBorderWidth = '1.5px'; | ||
|
||
export default function getStyle(styleProp, colWidths = {}) { | ||
const th = { | ||
fontWeight: labelWeight, | ||
border: `${bottomBorderWidth} solid ${contentAreaDividerColor}`, | ||
borderWidth: `0 0 ${bottomBorderWidth}`, | ||
padding: `${cellYPadding} ${cellXPadding}` | ||
}; | ||
|
||
const numAmountTh = { | ||
...th, | ||
textAlign: 'right' | ||
}; | ||
|
||
return { | ||
tr: { | ||
...styleProp | ||
}, | ||
timesTh: { | ||
...th, | ||
textAlign: 'center', | ||
width: colWidths.times | ||
}, | ||
firstColNoTimes: { | ||
...th, | ||
textAlign: 'right', | ||
fontWeight: labelWeight, | ||
width: colWidths.times | ||
}, | ||
durationTh: { | ||
...numAmountTh, | ||
width: colWidths.duration | ||
}, | ||
payRateTh: { | ||
...numAmountTh, | ||
width: colWidths.payRate | ||
}, | ||
amountEarnedTh: { | ||
...numAmountTh, | ||
width: colWidths.amountEarned | ||
}, | ||
secondaryTzTimesTh: { | ||
...th, | ||
textAlign: 'center', | ||
width: colWidths.secondaryTzTimes | ||
} | ||
}; | ||
}; | ||
|
88 changes: 88 additions & 0 deletions
88
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/MediumScreen/Row/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React from 'react'; | ||
import { | ||
formatDurationForReportTable, | ||
formatAmountEarnedForReportTable, | ||
formatPayRateForReportTable | ||
} from '../utilities'; | ||
import getStyle from './style'; | ||
import Times from '../../Times'; | ||
|
||
function Row({ | ||
hasTimes, | ||
hasSecondTzCol, | ||
hasSecondaryTzTimes, | ||
hasEarningCols, | ||
rowData: { | ||
times: { | ||
sessionTimezone: sessTzTimes, | ||
officialTimezone: jobTzTimes | ||
} = {}, | ||
rowLabel, | ||
duration, | ||
amountEarned, | ||
payRate, | ||
// _id, // segment id; only defined for rows that represent segments; not currently needed. | ||
style: styleProp | ||
}, | ||
isFirstInGroup, | ||
date, | ||
colWidths | ||
}) { | ||
|
||
const commonTimesAttrs = { dayDate: date }; | ||
|
||
const style = getStyle(styleProp, colWidths, isFirstInGroup); | ||
|
||
return ( | ||
<tr style={style.tr}> | ||
<td style={hasTimes ? style.timesTd : style.firstColNoTimes}> | ||
{(hasTimes && hasSecondaryTzTimes && ( | ||
<Times {...sessTzTimes} {...commonTimesAttrs} /> | ||
)) || | ||
(hasTimes && hasSecondaryTzTimes && ( | ||
<Times {...sessTzTimes} {...commonTimesAttrs} /> | ||
)) || | ||
(rowLabel && ( | ||
<>{rowLabel}:</> | ||
))} | ||
</td> | ||
<td style={style.durationTd}> | ||
{formatDurationForReportTable(duration)} | ||
</td> | ||
{hasEarningCols && ( | ||
amountEarned ? ( | ||
<> | ||
<td style={style.payRateTd}> | ||
{formatPayRateForReportTable(payRate)} | ||
</td> | ||
<td style={style.amountEarnedTd}> | ||
{formatAmountEarnedForReportTable(amountEarned)} | ||
</td> | ||
</> | ||
) : ( | ||
<> | ||
<td style={style.payRateTdUnpaid}> | ||
{payRate === null && ( | ||
<> — </> | ||
)} | ||
</td> | ||
<td style={style.amountEarnedTdUnpaid}> | ||
{amountEarned === null && ( | ||
<> — </> | ||
)} | ||
</td> | ||
</> | ||
) | ||
)} | ||
{hasSecondTzCol && ( | ||
<td style={style.secondaryTzTimes}> | ||
{hasTimes && hasSecondaryTzTimes && ( | ||
<Times {...jobTzTimes} {...commonTimesAttrs} /> | ||
)} | ||
</td> | ||
)} | ||
</tr> | ||
); | ||
} | ||
|
||
export default Row; |
58 changes: 58 additions & 0 deletions
58
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/MediumScreen/Row/style.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { labelWeight, contentAreaDividerColor, cellXPadding, cellYPadding } from '../style'; | ||
|
||
export default function getStyle(styleProp, colWidths = {}, isFirstRowInGroup) { | ||
|
||
const borderTopPxWidth = isFirstRowInGroup ? 1.5 : 0.7; | ||
const td = { | ||
borderColor: contentAreaDividerColor, | ||
borderWidth: `${borderTopPxWidth}px 0 0`, | ||
padding: `${cellYPadding} ${cellXPadding}` | ||
}; | ||
const numAmountTd = { | ||
...td, | ||
textAlign: 'right' | ||
}; | ||
|
||
return { | ||
tr: { | ||
...styleProp | ||
}, | ||
timesTd: { | ||
...td, | ||
textAlign: 'center', | ||
width: colWidths.times | ||
}, | ||
firstColNoTimes: { | ||
...td, | ||
textAlign: 'right', | ||
fontWeight: labelWeight, | ||
width: colWidths.times | ||
}, | ||
durationTd: { | ||
...numAmountTd, | ||
width: colWidths.duration | ||
}, | ||
payRateTd: { | ||
...numAmountTd, | ||
width: colWidths.payRate | ||
}, | ||
amountEarnedTd: { | ||
...numAmountTd, | ||
width: colWidths.amountEarned | ||
}, | ||
payRateTdUnpaid: { | ||
...numAmountTd, | ||
paddingRight: `calc(${cellXPadding} + 1.5em)`, | ||
width: colWidths.payRate | ||
}, | ||
amountEarnedTdUnpaid: { | ||
...numAmountTd, | ||
paddingRight: `calc(${cellXPadding} + 0.75em)`, | ||
width: colWidths.amountEarned | ||
}, | ||
secondaryTzTimes: { | ||
...td, | ||
width: colWidths.secondaryTzTimes | ||
}, | ||
}; | ||
}; |
23 changes: 23 additions & 0 deletions
23
.../src/components/MainApp/JobPage/TimePage/FullReport/Table/MediumScreen/RowsGroup/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import Row from '../Row'; | ||
|
||
function RowsGroup({ | ||
rows, | ||
...otherProps | ||
}) { | ||
|
||
return rows.map( | ||
(rowData, index) => ( | ||
<Row | ||
key={index} | ||
{...{ | ||
rowData, | ||
...otherProps | ||
}} | ||
isFirstInGroup={index === 0} | ||
/> | ||
) | ||
); | ||
} | ||
|
||
export default RowsGroup; |
59 changes: 59 additions & 0 deletions
59
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/MediumScreen/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react'; | ||
import getStyle from './style'; | ||
import Thead from './Head'; | ||
import RowsGroup from './RowsGroup'; | ||
|
||
function Table({ | ||
rowGroups, | ||
hasTimes, | ||
hasSecondTzCol, | ||
hasEarningCols, | ||
date, | ||
style: styleProp, | ||
hasSecondaryTzTimes: hasSecondTzTimesProp, | ||
primaryTimezone, | ||
secondaryTimezone, | ||
hasSecondaryTzTimes, | ||
colWidths, | ||
colRefs | ||
}) { | ||
|
||
const commonAttrs = { | ||
date, | ||
hasEarningCols, | ||
hasSecondTzCol, | ||
colWidths, | ||
}; | ||
|
||
// const style = getStyle(styleProp, colWidths); | ||
|
||
return ( | ||
<> | ||
<Thead | ||
{...{ | ||
...commonAttrs, | ||
hasTimes, | ||
primaryTimezone, | ||
secondaryTimezone, | ||
hasSecondaryTzTimes, | ||
colRefs, | ||
}} | ||
/> | ||
<tbody> | ||
{rowGroups.map( | ||
({ rows, hasTimes: groupHasTimes = hasTimes }, index) => ( | ||
<RowsGroup | ||
key={index} | ||
{...commonAttrs} | ||
{...{ rows }} | ||
hasTimes={groupHasTimes} | ||
hasSecondaryTzTimes={groupHasTimes && hasSecondaryTzTimes} | ||
/> | ||
) | ||
)} | ||
</tbody> | ||
</> | ||
); | ||
} | ||
|
||
export default Table; |
5 changes: 5 additions & 0 deletions
5
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/MediumScreen/style.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from '../style'; | ||
|
||
export default function getStyle() { | ||
return {}; | ||
}; |
1 change: 1 addition & 0 deletions
1
.../src/components/MainApp/JobPage/TimePage/FullReport/Table/MediumScreen/utilities/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from '../../utilities'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.