-
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 5 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 |
|---|---|---|
|
|
@@ -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; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ import { | |
| import { useGetUsersByUsernameQuery } from '@/app/services/usersApi'; | ||
| import { ConditionalLinkWrapper } from './ConditionalLinkWrapper'; | ||
| import useUserData from '@/hooks/useUserData'; | ||
| import { useGetUserQuery } from '@/app/services/userApi'; | ||
| import { isTaskDetailsPageLinkEnabled } from '@/constants/FeatureFlags'; | ||
| import { useUpdateTaskMutation } from '@/app/services/tasksApi'; | ||
| import ProgressIndicator from './progressContainer/ProgressIndicator'; | ||
|
|
@@ -75,6 +76,8 @@ const Card: FC<CardProps> = ({ | |
|
|
||
| const { isUserAuthorized } = useUserData(); | ||
|
|
||
| const { data: userData } = useGetUserQuery(); | ||
|
|
||
| const [showEditButton, setShowEditButton] = useState(false); | ||
|
|
||
| const [keyLongPressed] = useKeyLongPressed(); | ||
|
|
@@ -266,6 +269,10 @@ const Card: FC<CardProps> = ({ | |
| setIsEditMode(true); | ||
| }; | ||
| const isEditable = shouldEdit && isUserAuthorized && isEditMode; | ||
| const isSelfTask = editedTaskDetails.assignee === userData?.username; | ||
| const verifiedTask = | ||
|
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.
I think the variable can be renamed to
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. Removed 100 percentage check and modified variable name to |
||
| editedTaskDetails.status === VERIFIED && | ||
| editedTaskDetails.percentCompleted === 100; | ||
|
|
||
| const getFormattedClosedAtDate = () => { | ||
| const closedAt = cardDetails?.github?.issue?.closedAt; | ||
|
|
@@ -543,7 +550,13 @@ const Card: FC<CardProps> = ({ | |
| </div> | ||
| )} | ||
| </div> | ||
| <div className={styles.taskStatusAndDateContainer}> | ||
| <div | ||
| className={ | ||
| isDevMode | ||
| ? styles.taskStatusDateAndPurposeContainer | ||
| : styles.taskStatusAndDateContainer | ||
| } | ||
| > | ||
| <div className={styles.dateInfo}> | ||
| <div className={styles.dateSection}> | ||
| <p className={styles.cardSpecialFont}> | ||
|
|
@@ -569,26 +582,45 @@ const Card: FC<CardProps> = ({ | |
| : `Started ${getStartedAgo()}`} | ||
| </span> | ||
| </div> | ||
| {/*card purpose*/} | ||
| {isDevMode && isSelfTask && editedTaskDetails.purpose && ( | ||
| <div> | ||
| <b className={styles.cardPurposeAndStatusFont}> | ||
| Purpose:{' '} | ||
| </b> | ||
| <span className={styles.cardPurposeText}> | ||
| {editedTaskDetails.purpose} | ||
|
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. do we have purpose field when we create the TCR from status site?
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. I just checked, it is not present in the TCR. |
||
| </span> | ||
| </div> | ||
| )} | ||
|
|
||
| {/* EDIT task status */} | ||
| <div className={styles.taskStatusEditMode}> | ||
| {isEditable ? ( | ||
| <TaskStatusEditMode | ||
| task={editedTaskDetails} | ||
| setEditedTaskDetails={setEditedTaskDetails} | ||
| isDevMode={isDevMode} | ||
| /> | ||
| ) : ( | ||
| <div className={styles.statusContainer} style={{}}> | ||
| <p className={styles.cardSpecialFont}>Status:</p> | ||
| <p | ||
| data-testid="task-status" | ||
| className={styles.statusText} | ||
| > | ||
| {beautifyStatus(cardDetails.status, isDevMode)} | ||
| </p> | ||
| </div> | ||
| )} | ||
| </div> | ||
| {!isDevMode && ( | ||
| <div className={styles.taskStatusEditMode}> | ||
| {isEditable ? ( | ||
| <TaskStatusEditMode | ||
| task={editedTaskDetails} | ||
| setEditedTaskDetails={setEditedTaskDetails} | ||
| isDevMode={isDevMode} | ||
| /> | ||
| ) : ( | ||
| <div className={styles.statusContainer} style={{}}> | ||
| <p className={styles.cardSpecialFont}> | ||
| Status: | ||
| </p> | ||
| <p | ||
| data-testid="task-status" | ||
| className={styles.statusText} | ||
| > | ||
| {beautifyStatus( | ||
| cardDetails.status, | ||
| isDevMode | ||
| )} | ||
| </p> | ||
| </div> | ||
| )} | ||
| </div> | ||
| )} | ||
| </div> | ||
|
|
||
| <div className={styles.contributor}> | ||
|
|
@@ -630,6 +662,29 @@ const Card: FC<CardProps> = ({ | |
| {showAssignButton() && <AssigneeButton />} | ||
| </div> | ||
|
|
||
| {/* EDIT task status */} | ||
| {isDevMode && ( | ||
| <div className={styles.taskStatusEditMode}> | ||
| {isEditable || (!verifiedTask && isSelfTask) ? ( | ||
| <TaskStatusEditMode | ||
| task={editedTaskDetails} | ||
| setEditedTaskDetails={setEditedTaskDetails} | ||
| isDevMode={isDevMode} | ||
| isSelfTask={isSelfTask} | ||
| /> | ||
| ) : ( | ||
| <div className={styles.statusContainer} style={{}}> | ||
| <p className={styles.cardSpecialFont}>Status:</p> | ||
| <p | ||
| data-testid="task-status" | ||
| className={styles.statusText} | ||
| > | ||
| {beautifyStatus(cardDetails.status, isDevMode)} | ||
| </p> | ||
| </div> | ||
| )} | ||
| </div> | ||
| )} | ||
| <div className={styles.cardItems}> | ||
| <div | ||
| className={`${styles.taskTagLevelWrapper} ${ | ||
|
|
||
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.
setEditedTaskDetailsafter the API call is successful preventing any inconsistent states?setTimeoutfrom thefinallyblock?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.
Will update in next commit.
But not sure about removing setTimeout, will check and update that as well.
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.
Done