Skip to content

Conversation

walesch-yan
Copy link
Collaborator

This PR is a follow-up to #1775. It includes the following changes concerning the CSS styles of the queue components:

  • gathered duplicated styles applied in many files in the corresponding modules
  • removed duplicated style parameters
  • moved large style definitions to modules
  • improved conditional styling in TaskItemContainer

Comment on lines -227 to -243
const padding = i > 0 ? '1em' : '0em';
const padding = i > 0 ? '1.5em' : '0.5em';
return (
<div key={`wedge-${i}`}>
<div
className={styles.dataPath}
style={{
borderLeft: '1px solid #DDD',
borderRight: '1px solid #DDD',
paddingTop: padding,
}}
>
<div
style={{
borderTop: '1px solid #DDD',
padding: '0.5em',
display: 'flex',
justifyContent: 'space-around',
alignItems: 'center',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and also in TaskItem I merged the styles and created 1 single div for both. That is also the reason why I increased the conditional padding in both cases by 0.5em

Comment on lines -231 to -234
<i
style={{ marginLeft: 0 }}
className="fa fa-copy"
aria-hidden="true"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of this marginLeft style is a consequence of removing the applied style on all font-awesome icons in #1775. Hence, setting marginLeft to 0 is not necessary anymore, as it is the default.

Comment on lines -50 to -58
const delTaskCSS = {
display: 'flex',
marginLeft: 'auto',
alignItems: 'center',
paddingLeft: '10px',
paddingRight: '10px',
color: '#d9534f',
cursor: 'pointer',
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this to module

Comment on lines -61 to +58
let pbarBsStyle = 'info';

switch (state) {
case TASK_RUNNING: {
taskCSS += ` ${styles.taskRunning}`;
pbarBsStyle = 'info';
break;
}
case TASK_COLLECTED: {
pbarBsStyle = 'success';
if (
specialTaskCSS === 'Characterisation' &&
diffractionPlanLength === undefined
) {
taskCSS += ` ${styles.taskWarning}`;
break;
}
taskCSS += ` ${styles.taskSuccess}`;
break;
}
case TASK_COLLECT_FAILED: {
taskCSS += ` ${styles.taskError}`;
pbarBsStyle = 'danger';
break;
}
// No default
}
taskCSS += ` ${
warningTaskCSS ? styles.taskWarning : stateBasedStyles[state] || ''
}`;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments on this:

  • instead of passing specialTaskCSS and diffractionPLanLength, now only one prop (warningTaskCSS) is passed if the warning style should be applied. Only CharacterisationTaskItem uses this prop.
  • replaced the switch statement with a look-up table for styles.
  • removed pbarStyle because the ProgressBar is only rendered if state equals TASK_RUNNING hence the conditional setting was unnecessary

Comment on lines -102 to +88
<b>
<span className="node-name" style={{ display: 'flex' }}>
{pointIDString} {dataLabel}
{state === TASK_RUNNING && (
<span
style={{
width: '150px',
right: '60px',
position: 'absolute',
}}
>
<ProgressBar
variant={pbarBsStyle}
striped
style={{ marginBottom: 0, height: '18px' }}
min={0}
max={1}
animated={progress < 1}
label={`${(progress * 100).toPrecision(3)} %`}
now={progress}
/>
</span>
)}
</span>
</b>
<span className={styles.nodeName} style={{ fontWeight: 'bold' }}>
{pointIDString} {dataLabel}
</span>
{state === TASK_RUNNING && (
<ProgressBar
variant="info"
striped
className={styles.progressBar}
min={0}
max={1}
animated={progress < 1}
label={`${(progress * 100).toPrecision(3)} %`}
now={progress}
/>
)}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced span and b tags here with proper styling

@marcus-oscarsson marcus-oscarsson added this pull request to the merge queue Jul 16, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jul 16, 2025
@walesch-yan walesch-yan added this pull request to the merge queue Jul 17, 2025
@marcus-oscarsson marcus-oscarsson removed this pull request from the merge queue due to the queue being cleared Jul 17, 2025
@walesch-yan walesch-yan merged commit aa02da1 into develop Jul 17, 2025
24 checks passed
@walesch-yan walesch-yan deleted the yw-cleanup-css branch July 17, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant