Skip to content

Commit 9631c2e

Browse files
committed
Milestone New Concept
1 parent 6d779da commit 9631c2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1952
-74
lines changed
Lines changed: 3 additions & 0 deletions
Loading

src/assets/icons/icon-dots.svg

Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading

src/assets/icons/x-mark-thin.svg

Lines changed: 6 additions & 0 deletions
Loading

src/components/Layout/Layout.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const Layout = (props) => {
2929
</div>
3030
<Footer />
3131
<GatewayDest name="fullscreen-page" className="mobile-page-gateway" />
32+
<GatewayDest name="right-sidebar" className="right-sidebar-container" />
3233
</div>
3334
)
3435
}

src/components/Layout/Layout.scss

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,35 @@
2323
background-color: $tc-gray-neutral-light;
2424
}
2525
}
26+
27+
.right-sidebar-container {
28+
position: fixed;
29+
top: 0;
30+
bottom: 0;
31+
right: 0;
32+
width: 310px;
33+
z-index: 9999;
34+
transform: translateX(310px);
35+
transition: transform 225ms ease;
36+
37+
&:not(:empty) {
38+
transform: translateX(0);
39+
40+
&::before {
41+
content: '';
42+
position: absolute;
43+
top: -100vh;
44+
left: -100vw;
45+
width: 200vw;
46+
height: 200vh;
47+
z-index: -1;
48+
}
49+
50+
@media screen and (max-width: $screen-md - 1px) {
51+
width: 100%;
52+
transition: none;
53+
}
54+
}
55+
}
2656
}
57+

src/components/User/UserTooltip.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@
4949
}
5050
}
5151

52+
&.size-50 {
53+
.tooltip-target {
54+
.Avatar {
55+
height: 50px;
56+
width: 50px;
57+
}
58+
}
59+
}
60+
5261
.stack-avatar-0 {
5362
z-index: 3;
5463
}

src/projects/actions/project.js

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,14 @@ function createProductsTimelineAndMilestone(project) {
286286
*
287287
* @return {Promise} project
288288
*/
289-
export function createProjectPhaseAndProduct(project, productTemplate, status = PHASE_STATUS_DRAFT, startDate, endDate, createTimeline = true) {
289+
export function createProjectPhaseAndProduct(project, productTemplate, status = PHASE_STATUS_DRAFT, startDate, endDate, createTimeline = true, budget, details) {
290290
const param = {
291291
status,
292292
name: productTemplate.name,
293293
description: productTemplate.description,
294-
productTemplateId: productTemplate.id
294+
productTemplateId: productTemplate.id,
295+
budget,
296+
details,
295297
}
296298
if (startDate) {
297299
param['startDate'] = startDate.format('YYYY-MM-DD')
@@ -356,12 +358,12 @@ function createPhaseAndMilestonesRequest(project, productTemplate, status = PHAS
356358
* @param {*} startDate
357359
* @param {*} endDate
358360
*/
359-
export function createPhaseWithoutTimeline(project, productTemplate, status, startDate, endDate) {
361+
export function createPhaseWithoutTimeline(project, productTemplate, status, startDate, endDate, budget, details) {
360362
return (dispatch) => {
361363
console.log(CREATE_PROJECT_PHASE)
362364
return dispatch({
363365
type: CREATE_PROJECT_PHASE,
364-
payload: createProjectPhaseAndProduct(project, productTemplate, status, startDate, endDate, false)
366+
payload: createProjectPhaseAndProduct(project, productTemplate, status, startDate, endDate, false, budget, details)
365367
})
366368
}
367369
}
@@ -505,75 +507,78 @@ export function updatePhase(projectId, phaseId, updatedProps, phaseIndex) {
505507
updatedProps.endDate = moment(updatedProps.endDate).format('YYYY-MM-DD')
506508
}
507509

510+
let result
508511
return dispatch({
509512
type: UPDATE_PHASE,
510513
payload: updatePhaseAPI(projectId, phaseId, updatedProps, phaseIndex).then()
511-
}).then(() => {
514+
})
515+
.then(res => result = res)
516+
.then(() => {
512517
// finds active milestone, if exists in timeline
513-
const activeMilestone = timeline ? _.find(timeline.milestones, m => m.status === PHASE_STATUS_ACTIVE) : null
514-
// this will be done after updating timeline (if timeline update is required)
515-
// or immediately if timeline update is not required
516-
// update product milestone strictly after updating timeline
517-
// otherwise it could happened like this:
518-
// - send request to update timeline
519-
// - send request to update milestone
520-
// - get updated milestone
521-
// - get updated timeline (without updated milestone)
522-
// so otherwise we can end up with the timeline without updated milestone
523-
const optionallyUpdateFirstMilestone = () => {
518+
const activeMilestone = timeline ? _.find(timeline.milestones, m => m.status === PHASE_STATUS_ACTIVE) : null
519+
// this will be done after updating timeline (if timeline update is required)
520+
// or immediately if timeline update is not required
521+
// update product milestone strictly after updating timeline
522+
// otherwise it could happened like this:
523+
// - send request to update timeline
524+
// - send request to update milestone
525+
// - get updated milestone
526+
// - get updated timeline (without updated milestone)
527+
// so otherwise we can end up with the timeline without updated milestone
528+
const optionallyUpdateFirstMilestone = () => {
524529
// update first product milestone only if
525530
// - there is a milestone, obviously
526531
// - phase's status is changed
527532
// - phase's status is changed to active
528533
// - there is not active milestone alreay (this can happen when phase is made active more than once
529534
// e.g. Active => Paused => Active)
530-
if (projectVersion !== 'v4' && timeline && !activeMilestone && phaseActivated ) {
535+
if (projectVersion !== 'v4' && timeline && !activeMilestone && phaseActivated ) {
536+
dispatch(
537+
updateProductMilestone(
538+
productId,
539+
timeline.id,
540+
timeline.milestones[0].id,
541+
{status:MILESTONE_STATUS.ACTIVE}
542+
)
543+
)
544+
}
545+
}
546+
547+
if (timeline && (startDateChanged || phaseActivated)) {
531548
dispatch(
532-
updateProductMilestone(
549+
updateProductTimeline(
533550
productId,
534551
timeline.id,
535-
timeline.milestones[0].id,
536-
{status:MILESTONE_STATUS.ACTIVE}
552+
{
553+
name: timeline.name,
554+
startDate: updatedProps.startDate,
555+
reference: timeline.reference,
556+
referenceId: timeline.referenceId,
557+
}
537558
)
538-
)
559+
).then(optionallyUpdateFirstMilestone)
560+
} else {
561+
optionallyUpdateFirstMilestone()
539562
}
540-
}
541-
542-
if (timeline && (startDateChanged || phaseActivated)) {
543-
dispatch(
544-
updateProductTimeline(
545-
productId,
546-
timeline.id,
547-
{
548-
name: timeline.name,
549-
startDate: updatedProps.startDate,
550-
reference: timeline.reference,
551-
referenceId: timeline.referenceId,
552-
}
553-
)
554-
).then(optionallyUpdateFirstMilestone)
555-
} else {
556-
optionallyUpdateFirstMilestone()
557-
}
558563

559-
// update project caused by phase updates
560-
}).then(() => {
561-
const project = state.projectState.project
564+
// update project caused by phase updates
565+
}).then(() => {
566+
const project = state.projectState.project
562567

563-
// if one phase moved to ACTIVE status, make project ACTIVE too
564-
if (
565-
_.includes([PROJECT_STATUS_DRAFT, PROJECT_STATUS_IN_REVIEW, PROJECT_STATUS_REVIEWED], project.status) &&
568+
// if one phase moved to ACTIVE status, make project ACTIVE too
569+
if (
570+
_.includes([PROJECT_STATUS_DRAFT, PROJECT_STATUS_IN_REVIEW, PROJECT_STATUS_REVIEWED], project.status) &&
566571
phase.status !== PHASE_STATUS_ACTIVE &&
567572
updatedProps.status === PHASE_STATUS_ACTIVE &&
568573
hasPermission(PERMISSIONS.EDIT_PROJECT_STATUS)
569-
) {
570-
dispatch(
571-
updateProject(projectId, {
572-
status: PROJECT_STATUS_ACTIVE
573-
}, true)
574-
)
575-
}
576-
})
574+
) {
575+
dispatch(
576+
updateProject(projectId, {
577+
status: PROJECT_STATUS_ACTIVE
578+
}, true)
579+
)
580+
}
581+
}).then(() => result)
577582
}
578583
}
579584

src/projects/detail/components/CreatePhaseForm/CreatePhaseForm.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class CreatePhaseForm extends React.Component {
225225
const {
226226
milestones
227227
} = this.state
228-
228+
229229
const ms = _.map(milestones, (m, index) => {
230230
return (
231231
<div styleName="milestone-item" key={m.pseudoId}>

0 commit comments

Comments
 (0)