Skip to content
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

Add to workflow UX improvements #1978

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion client/components/Coverages/CoverageItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IContactItem, IG2ContentType, IPlanningCoverageItem, IPlanningItem} from

import * as selectors from '../../selectors';
import * as actions from '../../actions';
import {WORKFLOW_STATE} from '../../constants';
import {COVERAGES, WORKFLOW_STATE} from '../../constants';
import {
getCreator,
getItemInArrayById,
Expand All @@ -20,6 +20,7 @@ import {getUserInterfaceLanguageFromCV} from '../../utils/users';
import {Item, Column, Row, Border, ActionMenu} from '../UI/List';
import {StateLabel, InternalNoteLabel} from '../../components';
import {CoverageIcons} from './CoverageIcons';
import {Label} from 'superdesk-ui-framework';

interface IProps {
coverage: IPlanningCoverageItem;
Expand All @@ -39,6 +40,7 @@ interface IProps {
}

interface IState {
addedToWorkflow: boolean;
userAssigned?: IUser;
deskAssigned?: IDesk;
coverageProvider?: string;
Expand Down Expand Up @@ -70,6 +72,7 @@ export class CoverageItemComponent extends React.Component<IProps, IState> {
coverageDateText: '',
internalNoteFieldPrefix: '',
coverageInWorkflow: false,
addedToWorkflow: false,
};

this.updateViewAttributes = this.updateViewAttributes.bind(this);
Expand Down Expand Up @@ -120,8 +123,13 @@ export class CoverageItemComponent extends React.Component<IProps, IState> {
userAssigned: null,
displayContentType: '',
coverageDateText: '',
addedToWorkflow: false,
Copy link
Member

Choose a reason for hiding this comment

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

what about using addedToWorkflow: coverage.workflow_status === COVERAGES.WORKFLOW_STATE.ACTIVE so you don't need a block below?

};

if (coverage.workflow_status === COVERAGES.WORKFLOW_STATE.ACTIVE) {
newState.addedToWorkflow = true;
}

if (!isPreview) {
newState.userAssigned = getCreator(
coverage,
Expand Down Expand Up @@ -230,6 +238,14 @@ export class CoverageItemComponent extends React.Component<IProps, IState> {
`${this.state.internalNoteFieldPrefix}.workflow_status` : 'state'}
showHeaderText={false}
/>
{this.state.addedToWorkflow && (
<div>
<Label
text={gettext('Added to workflow')}
type="success"
/>
</div>
)}
<StateLabel
item={this.state.coverageInWorkflow ? get(coverage, 'assigned_to', {}) : coverage}
fieldName={this.state.coverageInWorkflow ? 'state' : 'workflow_status'}
Expand Down
4 changes: 3 additions & 1 deletion client/utils/planning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,9 @@ function getCoverageIcon(
}

function getCoverageIconColor(coverage: IPlanningCoverageItem): string {
if (get(coverage, 'assigned_to.state') === ASSIGNMENTS.WORKFLOW_STATE.COMPLETED) {
if (coverage.workflow_status === COVERAGES.WORKFLOW_STATE.ACTIVE) {
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't you have a different color here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, fritz wants to have this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, fritz wants this one

return 'var(--sd-colour-success)';
} else if (get(coverage, 'assigned_to.state') === ASSIGNMENTS.WORKFLOW_STATE.COMPLETED) {
return 'var(--sd-colour-success)';
} else if (isCoverageDraft(coverage) || get(coverage, 'workflow_status') === COVERAGES.WORKFLOW_STATE.ACTIVE) {
return 'var(--sd-colour-highlight)';
Expand Down
Loading