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

task bar color in progress #528

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 3 commits
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
20 changes: 19 additions & 1 deletion src/components/member-profile/active-task/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { timeWas } from '@helper-functions/time-was';
import { percentageofDaysRemaining } from '@helper-functions/taskProgress';
import { estimatedDays } from '@helper-functions/estimated-days';
import { progressIndicator } from '@helper-functions/progressIndicator';
// import { useState, useEffect } from 'react';
vvaibhavdesai marked this conversation as resolved.
Show resolved Hide resolved

const ActiveTask = ({ taskDetails }) => {
const { title, purpose, startedOn, endsOn, percentCompleted } = taskDetails;
Expand All @@ -21,6 +22,20 @@ const ActiveTask = ({ taskDetails }) => {
);
const showProgressIndicator = progressIndicator(showEstimatedDay, classNames);

const handleProgressBarColor = () => {
const colorOptions = [];
if (percentageOfDaysRemaining >= percentOfTaskLeft) {
colorOptions.push(classNames.progressIndicatorGreen); // green
} else if (percentageOfDaysRemaining < 50 && percentOfTaskLeft > 75) {
colorOptions.push(classNames.progressIndicatorOrange); // orange
} else if (percentageOfDaysRemaining < 25 && percentOfTaskLeft > 35) {
colorOptions.push(classNames.progressIndicatorRed); // red
} else {
colorOptions.push(classNames.progressIndicatorYellow); // yellow
}
return colorOptions;
};
vvaibhavdesai marked this conversation as resolved.
Show resolved Hide resolved

return (
<div className={classNames.container}>
<div className={classNames.taskSection}>
Expand All @@ -40,7 +55,10 @@ const ActiveTask = ({ taskDetails }) => {
<div className={classNames.progressBar}>
<div
className={showProgressIndicator}
style={{ width: `${percentCompleted}%` }}
style={{
width: `${percentCompleted}%`,
backgroundColor: `${handleProgressBarColor}`,
vvaibhavdesai marked this conversation as resolved.
Show resolved Hide resolved
}}
data-testid="progressIndicator"
/>
</div>
Expand Down