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