From c20670c3a56f9dc7c1f187bf8960d6ff48ab39da Mon Sep 17 00:00:00 2001 From: LuizFNJ Date: Wed, 12 Feb 2025 23:37:06 +0100 Subject: [PATCH] Change progress antd to MUI --- src/components/Metrics/MetricsOverview.tsx | 2 +- src/components/Metrics/ReviewProgress.tsx | 93 ++++++++++++++----- .../Personality/PersonalityCard.tsx | 5 +- 3 files changed, 70 insertions(+), 30 deletions(-) diff --git a/src/components/Metrics/MetricsOverview.tsx b/src/components/Metrics/MetricsOverview.tsx index 5114e4ff0..c8c6c3972 100644 --- a/src/components/Metrics/MetricsOverview.tsx +++ b/src/components/Metrics/MetricsOverview.tsx @@ -44,7 +44,7 @@ const MetricsOverview = ({ stats }) => { ) : ( t("metrics:empytOverview") )} - + ); diff --git a/src/components/Metrics/ReviewProgress.tsx b/src/components/Metrics/ReviewProgress.tsx index 9a029bbce..a4336628a 100644 --- a/src/components/Metrics/ReviewProgress.tsx +++ b/src/components/Metrics/ReviewProgress.tsx @@ -1,30 +1,33 @@ import React from "react"; -import { Progress, ProgressProps } from "antd"; +import { + Grid, + LinearProgress, + CircularProgress, + linearProgressClasses, + circularProgressClasses +} from "@mui/material"; +import styled from "styled-components"; import ReviewColors from "../../constants/reviewColors"; import colors from "../../styles/colors"; -import StatsReviewColors from "../../constants/statsReviewColors"; import { useTranslation } from "next-i18next"; const ReviewProgress = ({ reviews, statsProps }) => { const { t } = useTranslation(); + + return reviews.map((review) => { + const BorderLinearProgress = styled(LinearProgress)(() => ({ + [`& .${linearProgressClasses.bar}`]: { + borderRadius: 10, + backgroundColor: ReviewColors[review._id] || colors.black, + }, + })); - const getStyle = (reviewId) => { - const defaultStyle: ProgressProps = { - strokeWidth: statsProps.strokeWidth || 18, - width: statsProps.width || 80, - strokeLinecap: statsProps.type === "circle" ? "square" : "round", - trailColor: colors.neutralTertiary, - }; - - return { - ...defaultStyle, - strokeColor: StatsReviewColors[reviewId] || colors.black, - }; - }; + const BorderCircularProgress = styled(CircularProgress)(() => ({ + [`& .${circularProgressClasses.circle}`]: { + color: ReviewColors[review._id] || colors.black, + }, + })); - return reviews.map((review) => { - const format = - statsProps.format === "count" ? () => review.count : null; return (
{ {statsProps.countInTitle && `${review.count} `} {t(`claimReviewForm:${review._id}`)} - -
+ {statsProps.type === "circle" ? + + + +

+ {review.count} +

+
+ : + + + + + +

+ {review.percentage}% +

+
+
+ } + ); }); }; diff --git a/src/components/Personality/PersonalityCard.tsx b/src/components/Personality/PersonalityCard.tsx index 39bb6fd1d..834ec8970 100644 --- a/src/components/Personality/PersonalityCard.tsx +++ b/src/components/Personality/PersonalityCard.tsx @@ -208,10 +208,7 @@ const PersonalityCard = ({