Skip to content

Commit

Permalink
Revert "Highlight the late tasks in the Action Task List"
Browse files Browse the repository at this point in the history
  • Loading branch information
tituomin authored Nov 14, 2024
1 parent d1a6afc commit 0c63f53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 54 deletions.
53 changes: 5 additions & 48 deletions components/actions/TaskList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ import RichText from 'components/common/RichText';
import { useLocale, useTranslations } from 'next-intl';
import { usePlan } from 'context/plan';
import { getDateFormat } from 'utils/dates.utils';
import { setLightness } from 'polished';
import {
StyledStatusBadge,
StyledStatusWrapper,
StyledStatusIndicator,
StyledStatusLabel,
} from 'components/common/StatusBadge';

const StyledDate = styled.span`
font-size: ${(props) => props.theme.fontSizeSm};
Expand Down Expand Up @@ -107,14 +100,6 @@ const ListGroupTitle = styled.h3`

const ListGroupItem = styled(BaseListGroupItem)`
padding: ${(props) => props.theme.spaces.s050};
background: ${(props) =>
props.isLate
? setLightness(0.95, props.theme.taskStatusColors.late)
: 'transparent'};
border: ${(props) =>
props.isLate ? `1px solid ${props.theme.taskStatusColors.late}` : 'none'};
border-radius: ${(props) => props.theme.cardBorderRadius};
margin-bottom: 8px;
&:first-child {
border-top-left-radius: ${(props) => props.theme.cardBorderRadius};
Expand All @@ -131,19 +116,11 @@ const ListGroupItem = styled(BaseListGroupItem)`
}
`;

const StyledStatusBadgeNoBorder = styled(StyledStatusBadge)`
border: none;
`;

function parseTimestamp(timestamp) {
const timeFormat = 'L';
return dayjs(timestamp).format(timeFormat);
}

const isTaskLate = (task, completed) => {
return !completed && new Date(task.dueAt) < new Date();
};

const Task = (props) => {
const t = useTranslations();
const locale = useLocale();
Expand All @@ -158,8 +135,6 @@ const Task = (props) => {
getDateFormat(dateFormat)
);

const isLate = isTaskLate(task, completed);

return (
<TaskWrapper>
{completed ? (
Expand Down Expand Up @@ -203,17 +178,6 @@ const Task = (props) => {
</>
)}
</TaskContent>
{isLate && (
<StyledStatusBadgeNoBorder
style={{ marginLeft: 'auto' }}
$statusColor={theme.taskStatusColors.late}
>
<StyledStatusWrapper>
<StyledStatusIndicator $statusColor={theme.taskStatusColors.late} />
<StyledStatusLabel>{t('late')}</StyledStatusLabel>
</StyledStatusWrapper>
</StyledStatusBadgeNoBorder>
)}
</TaskWrapper>
);
};
Expand All @@ -232,18 +196,11 @@ function TaskList(props) {
function filterTasks(state, completed) {
return sortedTasks
.filter((item) => item.state === state)
.map((item) => {
const isLate = isTaskLate(item, completed);
return (
<ListGroupItem
key={item.id}
className={`state--${item.state}`}
isLate={isLate}
>
<Task task={item} theme={theme} completed={completed} />
</ListGroupItem>
);
});
.map((item) => (
<ListGroupItem key={item.id} className={`state--${item.state}`}>
<Task task={item} theme={theme} completed={completed} />
</ListGroupItem>
));
}

const notStartedTasks = filterTasks('NOT_STARTED', false);
Expand Down
8 changes: 4 additions & 4 deletions components/common/StatusBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type StatusProps = {
$statusColor: string;
};

export const StyledStatusBadge = styled.div<StatusProps>`
const StyledStatusBadge = styled.div<StatusProps>`
display: inline-block;
border: ${({ $subtle, $statusColor }) =>
$subtle ? 'none' : `2px solid ${$statusColor}`};
Expand All @@ -28,23 +28,23 @@ const StyledStatusBadgeWithReason = styled(StyledStatusBadge)`
display: block;
`;

export const StyledStatusIndicator = styled.div<StatusProps>`
const StyledStatusIndicator = styled.div<StatusProps>`
background: ${({ $statusColor }) => $statusColor};
border-radius: 10px;
width: 10px;
height: 10px;
flex-shrink: 0;
`;

export const StyledStatusLabel = styled.div<{ $subtle?: boolean }>`
const StyledStatusLabel = styled.div<{ $subtle?: boolean }>`
color: ${({ theme }) => theme.textColor.primary};
font-size: ${({ theme }) => theme.fontSizeSm};
line-height: ${({ theme }) => theme.lineHeightSm};
font-weight: ${({ $subtle, theme }) =>
$subtle ? theme.fontWeightNormal : theme.fontWeightBold};
`;

export const StyledStatusWrapper = styled.div`
const StyledStatusWrapper = styled.div`
display: flex;
gap: ${({ theme }) => theme.spaces.s050};
align-items: center;
Expand Down
3 changes: 1 addition & 2 deletions locales/en/actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,5 @@
"action-dependencies": "{context, select, CASE_STUDY {Case study dependencies} STRATEGY {Strategy dependencies} other {Action dependencies}}",
"no-action-version-available": "No --{versionType}--- version available",
"feedback-on-category": "Give feedback on this category",
"feedback-on-category-description": "You can leave a comment or feedback on this category",
"late": "Late"
"feedback-on-category-description": "You can leave a comment or feedback on this category"
}

0 comments on commit 0c63f53

Please sign in to comment.