diff --git a/app/(base)/dashboard/[userId]/page.tsx b/app/(base)/dashboard/[userId]/page.tsx index a7a4ada..88958a1 100644 --- a/app/(base)/dashboard/[userId]/page.tsx +++ b/app/(base)/dashboard/[userId]/page.tsx @@ -5,7 +5,7 @@ import DashboardGaugeSection from "@/components/Dashboard/DashboardGaugeSection" import DashboardRadarSection from "@/components/Dashboard/DashboardRadarSection"; import DashboardEmotionsSection from "@/components/Dashboard/DashboardEmotionsSection"; import DashboardSurveyCalendar from "@/components/Dashboard/DashboardSurveyCalendar"; -import PCPSection from "@/components/Dashboard/DashboardPCPSection"; +import DashboardPCPSection from "@/components/Dashboard/DashboardPCPSection"; import Loader from "@/components/Loader"; import { getRulerGraphInfo } from "@/services/user-dashboard"; @@ -83,7 +83,7 @@ const Dashboard = async ({ params }: { params: { userId: string } }) => {
- +
diff --git a/components/Dashboard/DashboardEmotionsSection.tsx b/components/Dashboard/DashboardEmotionsSection.tsx index 81ae953..c4c970b 100644 --- a/components/Dashboard/DashboardEmotionsSection.tsx +++ b/components/Dashboard/DashboardEmotionsSection.tsx @@ -2,7 +2,7 @@ import React from "react"; import { Tooltip } from "@mantine/core"; import GrowthCircle from "@/components/GrowthCircle"; - +import InfoToolTip from "@/components/InfoToolTip"; interface EmotionsSectionProps { emotionsData: { title: string; @@ -14,11 +14,17 @@ interface EmotionsSectionProps { const DashboardEmotionsSection: React.FC = ({ emotionsData, }) => ( -
-

- Emotions Summary -

-
+
+ +
+

+ Emotions Summary +

+
+
{emotionsData.map((circle, index) => (
{ + switch (title) { + case "Productivity Level": + return "Represents the current productivity feeling rate.
Higher percentage indicates greater productivity."; + case "Self Perception Level": + return "Shows how individuals perceive their own performance.
Higher values indicate greater self-confidence."; + case "Stress Level": + return "Indicates the current stress level.
Higher percentages reflect higher stress."; + default: + return "This is a summary of your overall statistics."; + } +}; + const DashboardGaugeSection: React.FC = ({ gaugeData }) => (
{gaugeData.map((gauge, index) => ( @@ -17,6 +31,10 @@ const DashboardGaugeSection: React.FC = ({ gaugeData }) => ( key={index} className="flex w-fit flex-col rounded-xl bg-white px-10 py-5 drop-shadow-lg" > + = ({ PCPData }) => ( -
+
+

Personal Career Plan

diff --git a/components/Dashboard/DashboardRadarSection.tsx b/components/Dashboard/DashboardRadarSection.tsx index 48a4170..b253be2 100644 --- a/components/Dashboard/DashboardRadarSection.tsx +++ b/components/Dashboard/DashboardRadarSection.tsx @@ -1,12 +1,17 @@ import React from "react"; import { RadarChart } from "@mantine/charts"; +import InfoToolTip from "@/components/InfoToolTip"; interface RadarSectionProps { radarData: { statistic: string; punctuation: number }[]; } const DashboardRadarSection: React.FC = ({ radarData }) => ( -
+
+

Overall Statistics

= ({ completedSurveys, }) => (
+ + { const surveysToday = completedSurveys.filter((survey) => dateMatches(survey.date, date), diff --git a/components/GrowthCircle.tsx b/components/GrowthCircle.tsx index c6f749c..9623c10 100644 --- a/components/GrowthCircle.tsx +++ b/components/GrowthCircle.tsx @@ -10,15 +10,20 @@ interface GradientColor { interface GrowthCircleProps { percentage: number; // Expected to be between 0 and 100 gradient: GradientColor; + minSize?: number; // Optional minimum size + maxSize?: number; // Optional maximum size } -const GrowthCircle = ({ percentage, gradient }: GrowthCircleProps) => { +const GrowthCircle = ({ + percentage, + gradient, + minSize = 50, + maxSize = 150, +}: GrowthCircleProps) => { const [gradientId] = useState(`gradient${gradientIdCounter++}`); - // Base size for the circle - const baseSize = 400; - // Calculate radius based on percentage - const radius = (percentage / 100) * (baseSize / 2); + // Calculate the radius based on percentage and ensure it is between minSize/2 and maxSize/2 + const radius = (maxSize / 2 - minSize / 2) * (percentage / 100) + minSize / 2; const size = radius * 2; // Calculate the font size as 40% of the radius const fontSize = radius * 0.4; diff --git a/components/InfoToolTip.tsx b/components/InfoToolTip.tsx new file mode 100644 index 0000000..dff245f --- /dev/null +++ b/components/InfoToolTip.tsx @@ -0,0 +1,48 @@ +import React from "react"; +import { Tooltip } from "@mantine/core"; +import InfoIcon from "@/components/icons/InfoIcon"; + +interface InfoToolTipProps { + description: string; + size?: "sm" | "md" | "lg"; +} + +const InfoToolTip = ({ description, size }: InfoToolTipProps) => { + let tooltipWidth; + switch (size) { + case "sm": + tooltipWidth = 220; + break; + case "md": + tooltipWidth = 280; + break; + case "lg": + tooltipWidth = 360; + break; + default: + tooltipWidth = 280; + } + + return ( +
+ } + position="left-start" + multiline + w={tooltipWidth} + transitionProps={{ duration: 200 }} + offset={{ mainAxis: -20, crossAxis: 28 }} + color="gray" + > + + +
+ ); +}; + +export default InfoToolTip;