From e60ef36bfe62ead679c2e8ba9ce233516af68d86 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Wed, 24 Apr 2024 20:20:41 +0530 Subject: [PATCH] fix: module and cycle event propagation (#4280) --- .../cycles/board/cycles-board-card.tsx | 28 +-- .../cycles/list/cycles-list-item.tsx | 107 +++++----- web/components/modules/module-card-item.tsx | 183 +++++++++--------- web/components/modules/module-list-item.tsx | 142 +++++++------- 4 files changed, 235 insertions(+), 225 deletions(-) diff --git a/web/components/cycles/board/cycles-board-card.tsx b/web/components/cycles/board/cycles-board-card.tsx index 3b596360a..a7ea62946 100644 --- a/web/components/cycles/board/cycles-board-card.tsx +++ b/web/components/cycles/board/cycles-board-card.tsx @@ -149,7 +149,7 @@ export const CyclesBoardCard: FC = observer((props) => { const daysLeft = findHowManyDaysLeft(cycleDetails.end_date) ?? 0; return ( -
+
@@ -231,23 +231,23 @@ export const CyclesBoardCard: FC = observer((props) => { ) : ( No due date )} -
- {isEditingAllowed && ( - { - if (cycleDetails.is_favorite) handleRemoveFromFavorites(e); - else handleAddToFavorites(e); - }} - selected={!!cycleDetails.is_favorite} - /> - )} - - -
+
+ {isEditingAllowed && ( + { + if (cycleDetails.is_favorite) handleRemoveFromFavorites(e); + else handleAddToFavorites(e); + }} + selected={!!cycleDetails.is_favorite} + /> + )} + + +
); }); diff --git a/web/components/cycles/list/cycles-list-item.tsx b/web/components/cycles/list/cycles-list-item.tsx index d6bc484b1..a7194ecbd 100644 --- a/web/components/cycles/list/cycles-list-item.tsx +++ b/web/components/cycles/list/cycles-list-item.tsx @@ -154,7 +154,7 @@ export const CyclesListItem: FC = observer((props) => { const daysLeft = findHowManyDaysLeft(cycleDetails.end_date) ?? 0; return ( - <> +
{ @@ -199,58 +199,61 @@ export const CyclesListItem: FC = observer((props) => { {renderDate && `${renderFormattedDate(startDate) ?? `_ _`} - ${renderFormattedDate(endDate) ?? `_ _`}`}
-
- {currentCycle && ( -
- {currentCycle.value === "current" - ? `${daysLeft} ${daysLeft > 1 ? "days" : "day"} left` - : `${currentCycle.label}`} -
- )} - -
- -
- {cycleDetails.assignee_ids && cycleDetails.assignee_ids?.length > 0 ? ( - - {cycleDetails.assignee_ids?.map((assignee_id) => { - const member = getUserDetails(assignee_id); - return ; - })} - - ) : ( - - - - )} -
-
- - {isEditingAllowed && !isArchived && ( - { - if (cycleDetails.is_favorite) handleRemoveFromFavorites(e); - else handleAddToFavorites(e); - }} - selected={!!cycleDetails.is_favorite} - /> - )} - -
-
+ - +
+
+ {currentCycle && ( +
+ {currentCycle.value === "current" + ? `${daysLeft} ${daysLeft > 1 ? "days" : "day"} left` + : `${currentCycle.label}`} +
+ )} + +
+ +
+ {cycleDetails.assignee_ids && cycleDetails.assignee_ids?.length > 0 ? ( + + {cycleDetails.assignee_ids?.map((assignee_id) => { + const member = getUserDetails(assignee_id); + return ; + })} + + ) : ( + + + + )} +
+
+ + {isEditingAllowed && !isArchived && ( + { + if (cycleDetails.is_favorite) handleRemoveFromFavorites(e); + else handleAddToFavorites(e); + }} + selected={!!cycleDetails.is_favorite} + /> + )} + +
+
+
+ ); }); diff --git a/web/components/modules/module-card-item.tsx b/web/components/modules/module-card-item.tsx index 2f2601ce5..99af55bc3 100644 --- a/web/components/modules/module-card-item.tsx +++ b/web/components/modules/module-card-item.tsx @@ -144,106 +144,107 @@ export const ModuleCardItem: React.FC = observer((props) => { : "0 Issue"; return ( - -
-
-
- - {moduleDetails.name} - -
- {moduleStatus && ( - - {moduleStatus.label} - - )} - -
-
-
- -
-
-
- - {issueCount ?? "0 Issue"} -
- {moduleDetails.member_ids?.length > 0 && ( - -
- - {moduleDetails.member_ids.map((member_id) => { - const member = getUserDetails(member_id); - return ; - })} - -
+
+ +
+
+
+ + {moduleDetails.name} - )} -
- - -
-
-
+
+ {moduleStatus && ( + + {moduleStatus.label} + + )} +
- +
-
- {isDateValid ? ( - <> - - {renderFormattedDate(startDate) ?? "_ _"} - {renderFormattedDate(endDate) ?? "_ _"} - - - ) : ( - No due date - )} - -
- {isEditingAllowed && ( - { - if (moduleDetails.is_favorite) handleRemoveFromFavorites(e); - else handleAddToFavorites(e); - }} - selected={!!moduleDetails.is_favorite} - /> +
+
+
+ + {issueCount ?? "0 Issue"} +
+ {moduleDetails.member_ids?.length > 0 && ( + +
+ + {moduleDetails.member_ids.map((member_id) => { + const member = getUserDetails(member_id); + return ; + })} + +
+
)} - {workspaceSlug && projectId && ( - +
+ + +
+
+
+
+
+ + +
+ {isDateValid ? ( + <> + + {renderFormattedDate(startDate) ?? "_ _"} - {renderFormattedDate(endDate) ?? "_ _"} + + + ) : ( + No due date )}
+ +
+ {isEditingAllowed && ( + { + if (moduleDetails.is_favorite) handleRemoveFromFavorites(e); + else handleAddToFavorites(e); + }} + selected={!!moduleDetails.is_favorite} + /> + )} + {workspaceSlug && projectId && ( + + )}
- +
); }); diff --git a/web/components/modules/module-list-item.tsx b/web/components/modules/module-list-item.tsx index 7503811fb..152ad8ca3 100644 --- a/web/components/modules/module-list-item.tsx +++ b/web/components/modules/module-list-item.tsx @@ -135,7 +135,7 @@ export const ModuleListItem: React.FC = observer((props) => { const completedModuleCheck = moduleDetails.status === "completed"; return ( -
+
{ @@ -143,33 +143,39 @@ export const ModuleListItem: React.FC = observer((props) => { openModuleOverview(e); } }} - className="relative flex w-full items-center justify-between gap-3 overflow-hidden" > -
-
- - - {completedModuleCheck ? ( - progress === 100 ? ( - - ) : ( - {`!`} - ) - ) : progress === 100 ? ( - - ) : ( - {`${progress}%`} - )} - - - - {moduleDetails.name} - +
+
+
+
+ + + {completedModuleCheck ? ( + progress === 100 ? ( + + ) : ( + {`!`} + ) + ) : progress === 100 ? ( + + ) : ( + {`${progress}%`} + )} + + + + {moduleDetails.name} + +
+ +
- +
+ +
{moduleStatus && ( = observer((props) => { )}
- -
-
- {renderDate && ( - - {renderFormattedDate(startDate) ?? "_ _"} - {renderFormattedDate(endDate) ?? "_ _"} - - )} -
+
+
+ {renderDate && ( + + {renderFormattedDate(startDate) ?? "_ _"} - {renderFormattedDate(endDate) ?? "_ _"} + + )} +
-
- -
- {moduleDetails.member_ids.length > 0 ? ( - - {moduleDetails.member_ids.map((member_id) => { - const member = getUserDetails(member_id); - return ; - })} - - ) : ( - - - - )} -
-
+
+ +
+ {moduleDetails.member_ids.length > 0 ? ( + + {moduleDetails.member_ids.map((member_id) => { + const member = getUserDetails(member_id); + return ; + })} + + ) : ( + + + + )} +
+
- {isEditingAllowed && !isArchived && ( - { - if (moduleDetails.is_favorite) handleRemoveFromFavorites(e); - else handleAddToFavorites(e); - }} - selected={moduleDetails.is_favorite} - /> - )} - {workspaceSlug && projectId && ( - - )} + {isEditingAllowed && !isArchived && ( + { + if (moduleDetails.is_favorite) handleRemoveFromFavorites(e); + else handleAddToFavorites(e); + }} + selected={moduleDetails.is_favorite} + /> + )} + {workspaceSlug && projectId && ( + + )} +