2023-02-08 13:20:08 +00:00
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
type TSingleProgressStatsProps = {
|
|
|
|
title: any;
|
|
|
|
completed: number;
|
|
|
|
total: number;
|
2023-03-15 06:14:44 +00:00
|
|
|
onClick?: () => void;
|
|
|
|
selected?: boolean;
|
2023-02-08 13:20:08 +00:00
|
|
|
};
|
|
|
|
|
2023-02-10 12:32:18 +00:00
|
|
|
export const SingleProgressStats: React.FC<TSingleProgressStatsProps> = ({
|
|
|
|
title,
|
|
|
|
completed,
|
|
|
|
total,
|
2023-03-15 06:14:44 +00:00
|
|
|
onClick,
|
|
|
|
selected = false,
|
2023-02-10 12:32:18 +00:00
|
|
|
}) => (
|
2023-03-15 06:14:44 +00:00
|
|
|
<div
|
2023-12-10 10:18:10 +00:00
|
|
|
className={`flex w-full items-center justify-between gap-4 rounded-sm p-1 text-xs ${
|
2023-07-10 07:17:00 +00:00
|
|
|
onClick ? "cursor-pointer hover:bg-custom-background-90" : ""
|
|
|
|
} ${selected ? "bg-custom-background-90" : ""}`}
|
2023-03-15 06:14:44 +00:00
|
|
|
onClick={onClick}
|
|
|
|
>
|
2023-06-20 11:02:02 +00:00
|
|
|
<div className="w-1/2">{title}</div>
|
2023-03-04 12:17:03 +00:00
|
|
|
<div className="flex w-1/2 items-center justify-end gap-1 px-2">
|
2023-03-29 20:01:43 +00:00
|
|
|
<div className="flex h-5 items-center justify-center gap-1">
|
2023-05-18 13:37:01 +00:00
|
|
|
<span className="w-8 text-right">
|
2024-01-22 15:12:09 +00:00
|
|
|
{isNaN(Math.round((completed / total) * 100)) ? "0" : Math.round((completed / total) * 100)}%
|
2023-05-18 13:37:01 +00:00
|
|
|
</span>
|
2023-02-08 13:20:08 +00:00
|
|
|
</div>
|
2023-06-20 11:02:02 +00:00
|
|
|
<span>of {total}</span>
|
2023-02-08 13:20:08 +00:00
|
|
|
</div>
|
2023-02-10 12:32:18 +00:00
|
|
|
</div>
|
2023-02-08 13:20:08 +00:00
|
|
|
);
|