2023-02-08 13:20:08 +00:00
|
|
|
import React from "react";
|
|
|
|
|
2023-02-20 13:30:40 +00:00
|
|
|
import { ProgressBar } from "components/ui";
|
2023-02-08 13:20:08 +00:00
|
|
|
|
|
|
|
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-05-17 07:28:01 +00:00
|
|
|
className={`flex w-full items-center gap-4 justify-between rounded-sm p-1 text-xs ${
|
2023-04-20 08:11:24 +00:00
|
|
|
onClick ? "cursor-pointer hover:bg-brand-surface-1" : ""
|
|
|
|
} ${selected ? "bg-brand-surface-1" : ""}`}
|
2023-03-15 06:14:44 +00:00
|
|
|
onClick={onClick}
|
|
|
|
>
|
2023-03-04 12:17:03 +00:00
|
|
|
<div className="flex w-1/2 items-center justify-start gap-2">{title}</div>
|
|
|
|
<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-02-10 12:32:18 +00:00
|
|
|
<span className="h-4 w-4 ">
|
2023-02-20 13:30:40 +00:00
|
|
|
<ProgressBar value={completed} maxValue={total} />
|
2023-02-10 12:32:18 +00:00
|
|
|
</span>
|
2023-05-18 13:37:01 +00:00
|
|
|
<span className="w-8 text-right">
|
|
|
|
{isNaN(Math.floor((completed / total) * 100))
|
|
|
|
? "0"
|
|
|
|
: Math.floor((completed / total) * 100)}
|
|
|
|
%
|
|
|
|
</span>
|
2023-02-08 13:20:08 +00:00
|
|
|
</div>
|
2023-02-10 12:32:18 +00:00
|
|
|
<span>of</span>
|
|
|
|
<span>{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
|
|
|
);
|