-
Notifications
You must be signed in to change notification settings - Fork 165
feat(1263): Add purpose & status to task card, based on task card in website-my #1319
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
base: develop
Are you sure you want to change the base?
Changes from 7 commits
96602a6
8f34209
c790c99
045a8d6
d615a30
2088552
90f78e4
a30aebe
f89f1a8
de52c89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,10 @@ import task, { | |
| import { useState } from 'react'; | ||
| import styles from '@/components/tasks/card/card.module.scss'; | ||
| import { PENDING, SAVED, ERROR_STATUS } from '../constants'; | ||
| import { useUpdateTaskMutation } from '@/app/services/tasksApi'; | ||
| import { | ||
| useUpdateTaskMutation, | ||
| useUpdateSelfTaskMutation, | ||
| } from '@/app/services/tasksApi'; | ||
| import { StatusIndicator } from './StatusIndicator'; | ||
| import TaskDropDown from '../TaskDropDown'; | ||
| import { TASK_STATUS_MAPING } from '@/constants/constants'; | ||
|
|
@@ -14,6 +17,7 @@ type Props = { | |
| task: task; | ||
| setEditedTaskDetails: React.Dispatch<React.SetStateAction<CardTaskDetails>>; | ||
| isDevMode?: boolean; | ||
| isSelfTask?: boolean; | ||
| }; | ||
|
|
||
| // TODO: remove this after fixing the card beautify status | ||
|
|
@@ -33,9 +37,11 @@ const TaskStatusEditMode = ({ | |
| task, | ||
| setEditedTaskDetails, | ||
| isDevMode, | ||
| isSelfTask, | ||
| }: Props) => { | ||
| const [saveStatus, setSaveStatus] = useState(''); | ||
| const [updateTask] = useUpdateTaskMutation(); | ||
| const [updateSelfTask] = useUpdateSelfTaskMutation(); | ||
|
|
||
| const onChangeUpdateTaskStatus = ({ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
const onChangeUpdateTaskStatus = async ({
newStatus,
newProgress,
}: taskStatusUpdateHandleProp) => {
setSaveStatus(PENDING);
const payload: { status: string; percentCompleted?: number } = {
status: newStatus,
};
if (newProgress !== undefined) {
payload.percentCompleted = newProgress;
}
setEditedTaskDetails((prev: CardTaskDetails) => ({
...prev,
...payload,
}));
try{
if (isDevMode && isSelfTask){
await updateSelfTask({ id: task.id, task: payload })
} else {
await updateTask({ id: task.id, task: payload });
}
} catch(error){
setSaveStatus(ERROR_STATUS);
} finally {
setTimeout(() => {
setSaveStatus('');
}, 3000);
}
};
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will update in next commit. But not sure about removing setTimeout, will check and update that as well.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| newStatus, | ||
|
|
@@ -52,10 +58,16 @@ const TaskStatusEditMode = ({ | |
| ...prev, | ||
| ...payload, | ||
| })); | ||
| const response = updateTask({ | ||
| id: task.id, | ||
| task: payload, | ||
| }); | ||
| const response = | ||
| isDevMode && isSelfTask | ||
| ? updateSelfTask({ | ||
| id: task.id, | ||
| task: payload, | ||
| }) | ||
| : updateTask({ | ||
| id: task.id, | ||
| task: payload, | ||
| }); | ||
|
|
||
| response | ||
| .unwrap() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,16 @@ | |
| color: #aeaeae; | ||
| } | ||
|
|
||
| .cardPurposeAndStatusFont { | ||
| font-size: 1.1rem; | ||
| color: #555; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use a predefined color from
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the colors that I used are not present in variables.css. I have taken them from my site. |
||
| } | ||
| .cardPurposeText { | ||
| padding: 8px; | ||
| color: #aeaeae; | ||
| font-size: 1rem; | ||
| } | ||
|
|
||
| .cardStatusFont { | ||
| font-size: 1.3rem; | ||
| font-weight: 500; | ||
|
|
@@ -247,10 +257,37 @@ | |
| justify-content: space-between; | ||
| } | ||
|
|
||
| .taskStatusDateAndPurposeContainer { | ||
| display: grid; | ||
| align-items: baseline; | ||
| grid-template-columns: 2fr 3fr; | ||
| gap: 2rem; | ||
| grid-auto-flow: column; | ||
| margin-bottom: 1rem; | ||
| } | ||
|
|
||
| .taskStatusEditMode { | ||
| margin-top: 0.8rem; | ||
| } | ||
|
|
||
| .taskStatusUpdate { | ||
| border: 1px solid #000000b3; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't find any existing css variables for this one. |
||
| border-radius: 4px; | ||
| font-size: inherit; | ||
| font-weight: bolder; | ||
| background-color: transparent; | ||
| color: #041187; | ||
|
Saitharun279 marked this conversation as resolved.
Outdated
|
||
| padding: 0.5rem; | ||
| height: 2.5rem; | ||
| width: 10rem; | ||
| transition: 250ms ease-in-out; | ||
| } | ||
|
|
||
| .taskStatusUpdate:hover { | ||
| background-color: #041187; | ||
|
Saitharun279 marked this conversation as resolved.
Outdated
|
||
| color: #ffffff; | ||
| } | ||
|
|
||
| .taskTagLevelWrapper { | ||
| display: flex; | ||
| padding-top: 0.5rem; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test verifies the UI state changes but doesn't confirm the actual API call functionality. Consider adding an assertion to verify that
updateSelfTaskMutationis called with the correct parameters:This would ensure the status update is properly propagated to the API layer, not just reflected in the UI component.
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.