Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions space/constants/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import {
} from "types/issue";
// icons
import {
BacklogStateIcon,
UnstartedStateIcon,
StartedStateIcon,
CompletedStateIcon,
CancelledStateIcon,
} from "components/icons";
BacklogGroupIcon,
CancelledGroupIcon,
CompletedGroupIcon,
StartedGroupIcon,
UnstartedGroupIcon,
} from "@plane/ui";

// all issue views
export const issueViews: any = {
Expand Down Expand Up @@ -92,35 +92,35 @@ export const issueGroups: IIssueGroup[] = [
title: "Backlog",
color: "#d9d9d9",
className: `text-[#d9d9d9] bg-[#d9d9d9]/10`,
icon: BacklogStateIcon,
icon: BacklogGroupIcon,
},
{
key: "unstarted",
title: "Unstarted",
color: "#3f76ff",
className: `text-[#3f76ff] bg-[#3f76ff]/10`,
icon: UnstartedStateIcon,
icon: UnstartedGroupIcon,
},
{
key: "started",
title: "Started",
color: "#f59e0b",
className: `text-[#f59e0b] bg-[#f59e0b]/10`,
icon: StartedStateIcon,
icon: StartedGroupIcon,
},
{
key: "completed",
title: "Completed",
color: "#16a34a",
className: `text-[#16a34a] bg-[#16a34a]/10`,
icon: CompletedStateIcon,
icon: CompletedGroupIcon,
},
{
key: "cancelled",
title: "Cancelled",
color: "#dc2626",
className: `text-[#dc2626] bg-[#dc2626]/10`,
icon: CancelledStateIcon,
icon: CancelledGroupIcon,
},
];

Expand Down
17 changes: 10 additions & 7 deletions web/components/cycles/cycles-board-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (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();

Expand All @@ -64,9 +65,7 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (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";

Expand Down Expand Up @@ -225,10 +224,14 @@ export const CyclesBoardCard: FC<ICyclesBoardCard> = (props) => {
</Tooltip>

<div className="flex items-center justify-between">
<span className="text-xs text-custom-text-300">
{areYearsEqual ? renderShortDate(startDate, "_ _") : renderShortMonthDate(startDate, "_ _")} -{" "}
{areYearsEqual ? renderShortDate(endDate, "_ _") : renderShortMonthDate(endDate, "_ _")}
</span>
{isDateValid ? (
<span className="text-xs text-custom-text-300">
{areYearsEqual ? renderShortDate(startDate, "_ _") : renderShortMonthDate(startDate, "_ _")} -{" "}
{areYearsEqual ? renderShortDate(endDate, "_ _") : renderShortMonthDate(endDate, "_ _")}
</span>
) : (
<span className="text-xs text-custom-text-400">No due date</span>
)}
<div className="flex items-center gap-1.5 z-10">
{cycle.is_favorite ? (
<button type="button" onClick={handleRemoveFromFavorites}>
Expand Down
8 changes: 5 additions & 3 deletions web/components/cycles/cycles-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ export const CyclesListItem: FC<TCyclesListItem> = (props) => {
<span className="flex-shrink-0">
<CircularProgressIndicator size={38} percentage={progress}>
{isCompleted ? (
<span className="text-sm text-custom-primary-100">{`!`}</span>
) : progress === 100 ? (
<Check className="h-3 w-3 text-custom-primary-100 stroke-[2]" />
progress === 100 ? (
<Check className="h-3 w-3 text-custom-primary-100 stroke-[2]" />
) : (
<span className="text-sm text-custom-primary-100">{`!`}</span>
)
) : (
<span className="text-xs text-custom-text-300">{`${progress}%`}</span>
)}
Expand Down
28 changes: 18 additions & 10 deletions web/components/modules/module-card-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,19 @@ export const ModuleCardItem: React.FC<Props> = observer((props) => {
const endDate = new Date(module.target_date ?? "");
const startDate = new Date(module.start_date ?? "");

const isDateValid = module.target_date || module.start_date;

const areYearsEqual = startDate.getFullYear() === endDate.getFullYear();

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<HTMLButtonElement>) => {
e.stopPropagation();
Expand Down Expand Up @@ -200,10 +201,17 @@ export const ModuleCardItem: React.FC<Props> = observer((props) => {
</Tooltip>

<div className="flex items-center justify-between">
<span className="text-xs text-custom-text-300">
{areYearsEqual ? renderShortDate(startDate, "_ _") : renderShortMonthDate(startDate, "_ _")} -{" "}
{areYearsEqual ? renderShortDate(endDate, "_ _") : renderShortMonthDate(endDate, "_ _")}
</span>
{isDateValid ? (
<>
<span className="text-xs text-custom-text-300">
{areYearsEqual ? renderShortDate(startDate, "_ _") : renderShortMonthDate(startDate, "_ _")} -{" "}
{areYearsEqual ? renderShortDate(endDate, "_ _") : renderShortMonthDate(endDate, "_ _")}
</span>
</>
) : (
<span className="text-xs text-custom-text-400">No due date</span>
)}

<div className="flex items-center gap-1.5 z-10">
{module.is_favorite ? (
<button type="button" onClick={handleRemoveFromFavorites}>
Expand Down
10 changes: 6 additions & 4 deletions web/components/modules/module-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const ModuleListItem: React.FC<Props> = 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<HTMLButtonElement>) => {
e.stopPropagation();
Expand Down Expand Up @@ -134,9 +134,11 @@ export const ModuleListItem: React.FC<Props> = observer((props) => {
<span className="flex-shrink-0">
<CircularProgressIndicator size={38} percentage={progress}>
{completedModuleCheck ? (
<span className="text-sm text-custom-primary-100">{`!`}</span>
) : progress === 100 ? (
<Check className="h-3 w-3 text-custom-primary-100 stroke-[2]" />
progress === 100 ? (
<Check className="h-3 w-3 text-custom-primary-100 stroke-[2]" />
) : (
<span className="text-sm text-custom-primary-100">{`!`}</span>
)
) : (
<span className="text-xs text-custom-text-300">{`${progress}%`}</span>
)}
Expand Down