From bcb231423da04ef4ffedd2d2ceecfd67a2062f5a Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 7 Nov 2023 14:23:10 +0530 Subject: [PATCH 1/5] fix: cycle and module card issue count fix --- web/components/cycles/cycles-board-card.tsx | 4 +--- web/components/modules/module-card-item.tsx | 11 +++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/web/components/cycles/cycles-board-card.tsx b/web/components/cycles/cycles-board-card.tsx index b480680a6a2..fdd13bbbb86 100644 --- a/web/components/cycles/cycles-board-card.tsx +++ b/web/components/cycles/cycles-board-card.tsx @@ -64,9 +64,7 @@ export const CyclesBoardCard: FC = (props) => { ? cycleTotalIssues === 0 ? "0 Issue" : cycleTotalIssues === cycle.completed_issues - ? cycleTotalIssues > 1 - ? `${cycleTotalIssues} Issues` - : `${cycleTotalIssues} Issue` + ? `${cycleTotalIssues} Issue${cycleTotalIssues > 1 ? "s" : ""}` : `${cycle.completed_issues}/${cycleTotalIssues} Issues` : "0 Issue"; diff --git a/web/components/modules/module-card-item.tsx b/web/components/modules/module-card-item.tsx index 0129b82279a..38df4ed3243 100644 --- a/web/components/modules/module-card-item.tsx +++ b/web/components/modules/module-card-item.tsx @@ -53,14 +53,13 @@ export const ModuleCardItem: React.FC = observer((props) => { const moduleStatus = MODULE_STATUS.find((status) => status.value === module.status); - const issueCount = - moduleTotalIssues === 0 + const issueCount = module + ? moduleTotalIssues === 0 ? "0 Issue" : moduleTotalIssues === module.completed_issues - ? moduleTotalIssues > 1 - ? `${moduleTotalIssues} Issues` - : `${moduleTotalIssues} Issue` - : `${module.completed_issues}/${moduleTotalIssues} Issues`; + ? `${moduleTotalIssues} Issue${moduleTotalIssues > 1 ? "s" : ""}` + : `${module.completed_issues}/${moduleTotalIssues} Issues` + : "0 Issue"; const handleAddToFavorites = (e: React.MouseEvent) => { e.stopPropagation(); From 8605f1422ee76f0533141cabdd16556abfa6a807 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 7 Nov 2023 14:23:56 +0530 Subject: [PATCH 2/5] fix: cycle and module list progress icon fix --- web/components/cycles/cycles-list-item.tsx | 8 +++++--- web/components/modules/module-list-item.tsx | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/web/components/cycles/cycles-list-item.tsx b/web/components/cycles/cycles-list-item.tsx index c294a5119ef..097a1807098 100644 --- a/web/components/cycles/cycles-list-item.tsx +++ b/web/components/cycles/cycles-list-item.tsx @@ -155,9 +155,11 @@ export const CyclesListItem: FC = (props) => { {isCompleted ? ( - {`!`} - ) : progress === 100 ? ( - + progress === 100 ? ( + + ) : ( + {`!`} + ) ) : ( {`${progress}%`} )} diff --git a/web/components/modules/module-list-item.tsx b/web/components/modules/module-list-item.tsx index 997ece953e7..385d318be42 100644 --- a/web/components/modules/module-list-item.tsx +++ b/web/components/modules/module-list-item.tsx @@ -134,9 +134,11 @@ export const ModuleListItem: React.FC = observer((props) => { {completedModuleCheck ? ( - {`!`} - ) : progress === 100 ? ( - + progress === 100 ? ( + + ) : ( + {`!`} + ) ) : ( {`${progress}%`} )} From 5a2e26e380633840d48d3f11dacbed204ae3b459 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 7 Nov 2023 14:31:22 +0530 Subject: [PATCH 3/5] fix: module card progress fix --- web/components/modules/module-list-item.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/components/modules/module-list-item.tsx b/web/components/modules/module-list-item.tsx index 385d318be42..3489311b9d1 100644 --- a/web/components/modules/module-list-item.tsx +++ b/web/components/modules/module-list-item.tsx @@ -50,7 +50,7 @@ export const ModuleListItem: React.FC = observer((props) => { const progress = isNaN(completionPercentage) ? 0 : Math.floor(completionPercentage); - const completedModuleCheck = module.status === "completed" && module.total_issues - module.completed_issues; + const completedModuleCheck = module.status === "completed"; const handleAddToFavorites = (e: React.MouseEvent) => { e.stopPropagation(); From d3c6ad36d39c8a198a0667ec8539ccca2e3a73b3 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 7 Nov 2023 14:38:41 +0530 Subject: [PATCH 4/5] style: cycle & module empty date label updated --- web/components/cycles/cycles-board-card.tsx | 13 +++++++++---- web/components/modules/module-card-item.tsx | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/web/components/cycles/cycles-board-card.tsx b/web/components/cycles/cycles-board-card.tsx index fdd13bbbb86..89e1bef893a 100644 --- a/web/components/cycles/cycles-board-card.tsx +++ b/web/components/cycles/cycles-board-card.tsx @@ -44,6 +44,7 @@ export const CyclesBoardCard: FC = (props) => { const isCompleted = cycleStatus === "completed"; const endDate = new Date(cycle.end_date ?? ""); const startDate = new Date(cycle.start_date ?? ""); + const isDateValid = cycle.start_date || cycle.end_date; const router = useRouter(); @@ -223,10 +224,14 @@ export const CyclesBoardCard: FC = (props) => {
- - {areYearsEqual ? renderShortDate(startDate, "_ _") : renderShortMonthDate(startDate, "_ _")} -{" "} - {areYearsEqual ? renderShortDate(endDate, "_ _") : renderShortMonthDate(endDate, "_ _")} - + {isDateValid ? ( + + {areYearsEqual ? renderShortDate(startDate, "_ _") : renderShortMonthDate(startDate, "_ _")} -{" "} + {areYearsEqual ? renderShortDate(endDate, "_ _") : renderShortMonthDate(endDate, "_ _")} + + ) : ( + No due date + )}
{cycle.is_favorite ? (