-
Notifications
You must be signed in to change notification settings - Fork 44
Cleanup TaskItems and collect similar container code #1753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if ( | ||
specialTaskCSS === 'Characterisation' && | ||
diffractionPlanLength === undefined | ||
) { | ||
taskCSS += ' warning'; | ||
break; | ||
} | ||
taskCSS += ' success'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there is a special style for characterisations that is applied if the Task has been collected but no diffraction plan was chosen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
let taskCSS = this.props.selected | ||
? 'task-head task-head-selected' | ||
: 'task-head'; | ||
|
||
taskCSS += ' uncollected'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the css applied to characterisation items was slightly different from the others, due to the warning style that I explained in another comment. The uncollected
class does also only exist in this component. However, this one only sets the background to the same color as task-head
does, hence I removed it (it was unnecessary)
getPlot(state) { | ||
if (state === TASK_UNCOLLECTED) { | ||
return <span />; | ||
} | ||
|
||
return ( | ||
<div className="float-end"> | ||
<a href="#" onClick={this.showXRFPlot}> | ||
Plot available | ||
</a> | ||
</div> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this component was supposed to render a link for the plot, but it is never rendered, hence I removed all logic related to 1d plots in XRFTaskItem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it would be super nice if we could try to get those plots work again :).
import { Component } from 'react'; | ||
import { Collapse, ProgressBar } from 'react-bootstrap'; | ||
|
||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, :)
I guess some of the CSS could be moved to a separate css file but I think this PR is good as it is. It could be done in a future PR. |
27f956e
to
7f50313
Compare
Oh Yes definitely, that's why it was on my next steps task list;) Just wanted to keep this PR as simple as possible:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

Wow, that was a lot of duplicated code! 😮
Nice clean-up here and in other PRs generally like #1790. Always satisfying. 😁
This PR is a first (of probably many) PRs to try to clean up the different
TaskItems
components by doing two things essentially:TaskItemContainer
: Every component had the exact same header rendering logic, so I created a single component to extract and centralise this code and make it easier to refacture/maintain. To make it easy to review, I did not make any changes to the code itself yet. (Will definitely in a later PR)TaskItems
:This includes:
deleteTask
,headerOnClick
and headerOnContextmethods which were moved to
TaskItemContainer`deleteButton
,toggleChecked
methods and internalstate
, which were present in every component but never usedXRFTaskItem
: it existed, but the Modal was never shown (always remained infalsy
state) for now I removed it as part of a cleanup, but this could be added and/or fixed in a later PRSo while there are a lot changes in this PR, it is mainly one repetitive change in every file
Next steps are (not necessary in this order):
props