Skip to content

Commit 6dce7b4

Browse files
committed
Fix table layout
1 parent 18225a1 commit 6dce7b4

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import MilestoneMoveDateButton from '../components/MilestoneMoveDateButton'
1616
import * as milestoneHelper from '../components/helpers/milestone'
1717
import IconUnselect from '../../../../../assets/icons/icon-disselect.svg'
1818
import IconCopilot from '../../../../../assets/icons/icon-copilot.svg'
19-
import { CHALLENGE_ID_MAPPING, PHASE_STATUS_IN_REVIEW } from '../../../../../config/constants'
19+
import { CHALLENGE_ID_MAPPING, PHASE_STATUS_IN_REVIEW, PROJECT_STATUS_CANCELLED, PROJECT_STATUS_COMPLETED } from '../../../../../config/constants'
2020

2121
import './ManageMilestones.scss'
2222
import MilestoneApprovalButton from '../components/MilestoneApprovalButton'
@@ -256,8 +256,11 @@ class ManageMilestones extends React.Component {
256256
onChangeMilestones,
257257
isUpdatable,
258258
isCustomer,
259+
project,
259260
} = this.props
260261

262+
const hideCheckbox = project.status === PROJECT_STATUS_CANCELLED || project.status === PROJECT_STATUS_COMPLETED
263+
261264
// const isNeedApproval = project.status === PROJECT_STATUS_IN_REVIEW
262265
const isNeedApproval = !milestones.filter(ms => ms.selected === true).find(ms => !(ms.status === PHASE_STATUS_IN_REVIEW))
263266
const canShowApproval = isCustomer && isNeedApproval
@@ -325,7 +328,7 @@ class ManageMilestones extends React.Component {
325328
<table styleName="milestones-table">
326329
<colgroup>
327330
<col style={{ width: '20px' }} />
328-
<col style={{ width: '20px' }} />{/* CHECKBOX */}
331+
{hideCheckbox ? null : <col style={{ width: '20px' }} />}{/* CHECKBOX */}
329332
<col style={{ width: '8%' }} />{/* MILESTONE */}
330333
<col />{/* DESCRIPTION */}
331334
<col style={{ width: '12%' }} />{/* START DATE */}
@@ -339,6 +342,7 @@ class ManageMilestones extends React.Component {
339342
milestones={milestones}
340343
onChangeMilestones={onChangeMilestones}
341344
isUpdatable={isUpdatable || isCustomer}
345+
hideCheckbox={hideCheckbox}
342346
/>
343347
</thead>
344348
<tbody>
@@ -365,6 +369,7 @@ class ManageMilestones extends React.Component {
365369
onApprove={this.onApprove}
366370
phaseMembers={milestone.members}
367371
isApproving={milestonesInApproval.indexOf(milestone.id) !== -1}
372+
hideCheckbox={hideCheckbox}
368373
/>,
369374
...this.renderChallengeTable(milestone)
370375
]

src/projects/detail/components/SimplePlan/components/MilestoneRow/MilestoneRow.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ function MilestoneRow({
4545
phaseMembers,
4646
disableDeleteAction,
4747
isCustomer,
48-
isApproving
48+
isApproving,
49+
hideCheckbox
4950
}) {
5051
const isNeedApproval = milestone.status === PHASE_STATUS_IN_REVIEW
5152
const showApproval = isCustomer && isNeedApproval
@@ -58,11 +59,12 @@ function MilestoneRow({
5859
let milestoneRef
5960
let startDateRef
6061
let endDateRef
62+
const tdEl = hideCheckbox ? null : <td/>
6163

6264
return edit ? (
6365
<tr styleName="milestone-row" className="edit-milestone-row">
6466
{isUpdatable ? <td /> : null}
65-
{isEditingMilestone ? <td/ >: <td styleName="checkbox">
67+
{(isEditingMilestone || hideCheckbox) ? <td/ >: <td styleName="checkbox">
6668
<TCFormFields.Checkbox
6769
name={`select-${rowId}`}
6870
value={milestone.selected}
@@ -301,7 +303,7 @@ function MilestoneRow({
301303
) : (
302304
<tr styleName="milestone-row">
303305
{isUpdatable ? <td styleName="expand" onClick={() => onExpand(!isExpand, milestone)}>{isExpand ? <IconClose />: <IconExpand />}</td>: <td />}
304-
{isEditingMilestone ? <td/> : <td styleName="checkbox">
306+
{(isEditingMilestone || hideCheckbox) ? tdEl : <td styleName="checkbox">
305307
<TCFormFields.Checkbox
306308
name={`select-${rowId}`}
307309
value={milestone.selected}
@@ -402,6 +404,7 @@ MilestoneRow.propTypes = {
402404
disableDeleteAction: PT.bool,
403405
isCustomer: PT.bool,
404406
members: PT.object,
407+
hideCheckbox: PT.bool,
405408
}
406409

407410
export default MilestoneRow

0 commit comments

Comments
 (0)