From eb439d8f54049d047681413b8b710e762b9e1abe Mon Sep 17 00:00:00 2001 From: akshat mittal Date: Fri, 9 Jan 2026 19:42:09 +0200 Subject: [PATCH] fix: improve member card styling with better chart layout and text hierarchy --- src/app/member/member-card.tsx | 31 +++++++------- src/components/charts/goals-bar-chart.tsx | 51 +++++++++++++++-------- src/components/charts/pie-chart.tsx | 10 ++--- 3 files changed, 56 insertions(+), 36 deletions(-) diff --git a/src/app/member/member-card.tsx b/src/app/member/member-card.tsx index 9d667b3..a4da157 100644 --- a/src/app/member/member-card.tsx +++ b/src/app/member/member-card.tsx @@ -27,6 +27,8 @@ type Member = RouterOutputs["organization"]["getMembers"][number]; type DashboardCharts = RouterOutputs["dashboard"]["getDashboardCharts"]; type Role = RouterOutputs["role"]["getByUser"][number]; +const CHART_HEIGHT = "h-[280px]"; + interface MemberCardProps { member: Member; dashboardCharts: DashboardCharts; @@ -172,17 +174,17 @@ export function MemberCard({ member, dashboardCharts }: MemberCardProps) { {uniqueTeams.length > 0 && ( -
-
+
+
- Teams + Teams
    {uniqueTeams.map((team) => (
  • {team.name} @@ -211,13 +213,13 @@ export function MemberCard({ member, dashboardCharts }: MemberCardProps) {
    {isLoading ? ( <> - - + + ) : ( <> -
    - +
    + Effort Distribution {rolesWithEffort.length > 0 ? ( @@ -232,7 +234,7 @@ export function MemberCard({ member, dashboardCharts }: MemberCardProps) { value: totalEffortPoints, label: "Total", }} - className="h-[260px] w-full" + className="h-full w-full" /> ) : (
    @@ -245,7 +247,8 @@ export function MemberCard({ member, dashboardCharts }: MemberCardProps) { metricIds={metricIdsWithGoals} showHeader={false} simpleLegend={true} - className="h-[340px] rounded-lg" + className={CHART_HEIGHT} + noBorder={true} /> )} @@ -257,19 +260,19 @@ export function MemberCard({ member, dashboardCharts }: MemberCardProps) { diff --git a/src/components/charts/goals-bar-chart.tsx b/src/components/charts/goals-bar-chart.tsx index 132f5df..7b51b80 100644 --- a/src/components/charts/goals-bar-chart.tsx +++ b/src/components/charts/goals-bar-chart.tsx @@ -12,7 +12,7 @@ import { TrendingDown, TrendingUp, } from "lucide-react"; -import { Bar, BarChart, Cell, XAxis, YAxis } from "recharts"; +import { Bar, BarChart, CartesianGrid, Cell, XAxis, YAxis } from "recharts"; import { Badge } from "@/components/ui/badge"; import { @@ -35,10 +35,13 @@ import { api } from "@/trpc/react"; interface GoalsBarChartProps { /** Array of metric IDs to display goal progress for */ metricIds: string[]; + /** Show header with title and goal count (default: true) */ showHeader?: boolean; className?: string; - /** Use simplified legend with only colored dots and names (no status badges, percentages, or tooltips) */ + /** Use simplified legend with only colored dots and names (default: false) */ simpleLegend?: boolean; + /** Remove border and background styling (default: false) */ + noBorder?: boolean; } const STATUS_CONFIG: Record< @@ -119,10 +122,10 @@ function formatTimeRemaining( } const STATUS_COLORS = { - exceeded: "hsl(142, 76%, 36%)", - onTrack: "hsl(217, 91%, 60%)", - behind: "hsl(38, 92%, 50%)", - atRisk: "hsl(0, 84%, 60%)", + exceeded: "#22c55e", // green-500 + onTrack: "#3b82f6", // blue-500 + behind: "#f59e0b", // amber-500 + atRisk: "#ef4444", // red-500 } as const; function getBarColor(progress: number, expectedProgress: number): string { @@ -291,6 +294,7 @@ export function GoalsBarChart({ showHeader = true, className, simpleLegend = false, + noBorder = false, }: GoalsBarChartProps) { // Fetch dashboard charts from cache (parent already fetched this) const { data: allCharts } = api.dashboard.getDashboardCharts.useQuery(); @@ -334,7 +338,8 @@ export function GoalsBarChart({ return (
    @@ -366,7 +371,11 @@ export function GoalsBarChart({ return (
    {showHeader && (
    @@ -383,20 +392,28 @@ export function GoalsBarChart({
    )} -
    - +
    + {noBorder && ( + + Goal Progress + + )} + + {simpleLegend ? ( -
    +
    {chartData.map((item) => (
    {showTooltip && ( @@ -41,8 +41,8 @@ export function MetricPieChart({ data={chartData} dataKey={dataKey} nameKey={xAxisKey} - innerRadius="40%" - outerRadius="70%" + innerRadius="50%" + outerRadius="85%" strokeWidth={2} isAnimationActive={true} animationDuration={800} @@ -92,8 +92,8 @@ export function MetricPieChart({ } wrapperStyle={{ - paddingTop: 8, - maxHeight: "80px", + paddingTop: 4, + maxHeight: "60px", overflowY: "auto", }} />