Skip to content

Commit

Permalink
feat(task_collection): add color support
Browse files Browse the repository at this point in the history
  • Loading branch information
r0xsh committed Nov 13, 2023
1 parent 086f478 commit aeac053
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Enum/TaskCollectionState.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ function toLabel() {
TaskCollectionState::CANCELLED => 'delivery.state.cancelled'
};
}

function toColor() {
return match ($this) {
TaskCollectionState::PENDING => 'grey',
TaskCollectionState::IN_DELIVERY => 'skyblue',
TaskCollectionState::DELIVERED => 'green',
TaskCollectionState::FAILED => 'orange',
TaskCollectionState::CANCELLED => 'red'
};
}
}
2 changes: 1 addition & 1 deletion templates/_partials/delivery/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</td>
{% set deliveryState = delivery.computeState() %}
<td>
<span title="{{ deliveryState.toLabel()|trans }}">
<span title="{{ deliveryState.toLabel()|trans }}" style="color: {{ deliveryState.toColor() }}">
<i class="fa fa-lg fa-{{ deliveryState.toFontAwesome() }}"></i>
</span>
</td>
Expand Down

0 comments on commit aeac053

Please sign in to comment.