-
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.
began small & extra-small screen width report table contents
- Loading branch information
Showing
13 changed files
with
471 additions
and
10 deletions.
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
...nt/src/components/MainApp/JobPage/TimePage/FullReport/Table/ExtraSmallScreen/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,99 @@ | ||
import React from 'react'; | ||
import { | ||
formatDurationForReportTable, | ||
formatAmountEarnedForReportTable, | ||
formatPayRateForReportTable | ||
} from '../utilities'; | ||
import getStyle from './style'; | ||
import Times from '../../Times'; | ||
import TwoTzTimes from '../../TwoTzTimes'; | ||
|
||
function Row({ | ||
hasTimes, | ||
primaryTimezone, | ||
secondaryTimezone, | ||
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 && ( | ||
<TwoTzTimes | ||
{...{ | ||
primaryTimezone, | ||
secondaryTimezone | ||
}} | ||
primaryTimezoneTimes={sessTzTimes} | ||
secondaryTimezoneTimes={jobTzTimes} | ||
{...commonTimesAttrs} | ||
/> | ||
)) || | ||
(hasTimes && ( | ||
<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; |
59 changes: 59 additions & 0 deletions
59
...nt/src/components/MainApp/JobPage/TimePage/FullReport/Table/ExtraSmallScreen/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,59 @@ | ||
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`, | ||
whiteSpace: 'nowrap', | ||
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 | ||
}, | ||
}; | ||
}; |
53 changes: 53 additions & 0 deletions
53
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/ExtraSmallScreen/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,53 @@ | ||
import React from 'react'; | ||
// import getStyle from './style'; | ||
// import { getTimezoneAbbreviation } from './utilities'; | ||
import Thead from '../Head'; | ||
import RowsGroup from '../RowsGroup'; | ||
import Row from './Row'; | ||
|
||
function ExtraSmallWidthTableContent({ | ||
rowGroups, | ||
hasTimes, | ||
hasSecondaryTzTimes, | ||
colRefs, | ||
...otherProps | ||
}) { | ||
|
||
const commonAttrs = { | ||
...otherProps, | ||
hasSecondTzCol: false | ||
}; | ||
|
||
const primaryTzLabel = hasTimes && hasSecondaryTzTimes && 'Times'; | ||
// const style = getStyle(styleProp, colWidths); | ||
|
||
return ( | ||
<> | ||
<Thead | ||
{...{ | ||
...commonAttrs, | ||
hasTimes, | ||
hasSecondaryTzTimes, | ||
colRefs, | ||
primaryTzLabel | ||
}} | ||
/> | ||
<tbody> | ||
{rowGroups.map( | ||
({ rows, hasTimes: groupHasTimes = hasTimes }, index) => ( | ||
<RowsGroup | ||
key={index} | ||
{...commonAttrs} | ||
{...{ rows }} | ||
RowComponent={Row} | ||
hasTimes={groupHasTimes} | ||
hasSecondaryTzTimes={groupHasTimes && hasSecondaryTzTimes} | ||
/> | ||
) | ||
)} | ||
</tbody> | ||
</> | ||
); | ||
} | ||
|
||
export default ExtraSmallWidthTableContent; |
5 changes: 5 additions & 0 deletions
5
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/ExtraSmallScreen/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
.../components/MainApp/JobPage/TimePage/FullReport/Table/ExtraSmallScreen/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
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
99 changes: 99 additions & 0 deletions
99
client/src/components/MainApp/JobPage/TimePage/FullReport/Table/SmallScreen/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,99 @@ | ||
import React from 'react'; | ||
import { | ||
formatDurationForReportTable, | ||
formatAmountEarnedForReportTable, | ||
formatPayRateForReportTable | ||
} from '../utilities'; | ||
import getStyle from './style'; | ||
import Times from '../../Times'; | ||
import TwoTzTimes from '../../TwoTzTimes'; | ||
|
||
function Row({ | ||
hasTimes, | ||
primaryTimezone, | ||
secondaryTimezone, | ||
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 && ( | ||
<TwoTzTimes | ||
{...{ | ||
primaryTimezone, | ||
secondaryTimezone | ||
}} | ||
primaryTimezoneTimes={sessTzTimes} | ||
secondaryTimezoneTimes={jobTzTimes} | ||
{...commonTimesAttrs} | ||
/> | ||
)) || | ||
(hasTimes && ( | ||
<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; |
Oops, something went wrong.