Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
fix(app): better capacity percentage presentation #31
Browse files Browse the repository at this point in the history
  • Loading branch information
yehezkieldio committed Mar 2, 2024
1 parent 7b82839 commit 5e72984
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ export function DetailedSubTrashbinPage() {
refetch();
});

const capacity =
subtrashbin?.currentCapacity === 0
? 0
: 100 - (((subtrashbin?.currentCapacity as number) / (subtrashbin?.maxCapacity ?? 0)) as number) * 100;

console.log("capacity", capacity);
console.log("max capacity", subtrashbin?.maxCapacity);
console.log("current capacity", subtrashbin?.currentCapacity);

const { t } = useTranslation();

return (
Expand Down Expand Up @@ -159,12 +168,7 @@ export function DetailedSubTrashbinPage() {
<Label htmlFor="openCount" className="text-xs">
{t("operator.subtrashbin.detailed.capacity")}
</Label>
<Input
readOnly
type="text"
id="openCount"
value={`${subtrashbin?.currentCapacity} / ${subtrashbin?.maxCapacity}`}
/>
<Input readOnly type="text" id="openCount" value={`${capacity}% / 100%`} />
</div>
</div>
<Separator className="my-4" />
Expand Down

0 comments on commit 5e72984

Please sign in to comment.