- {selectedCategoryDetails.map((category) => {
+ {selectedCategoryDetails.map((category, colorIndex) => {
if (!category) return null;
const IconComponent = category.icon
? getIconComponent(category.icon)
: null;
- const colorIndex = selectedCategories.indexOf(category.id);
const color = CHART_COLORS[colorIndex % CHART_COLORS.length];
return (
diff --git a/src/features/dashboard/components/dashboard-metrics-cards.tsx b/src/features/dashboard/components/dashboard-metrics-cards.tsx
index f26c490..ecff3e6 100644
--- a/src/features/dashboard/components/dashboard-metrics-cards.tsx
+++ b/src/features/dashboard/components/dashboard-metrics-cards.tsx
@@ -11,11 +11,14 @@ import type { DashboardCardMetrics } from "@/features/dashboard/dashboard-metric
import MoneyValues from "@/shared/components/money-values";
import {
Card,
- CardFooter,
+ CardContent,
+ CardDescription,
CardHeader,
CardTitle,
} from "@/shared/components/ui/card";
+import { Separator } from "@/shared/components/ui/separator";
import { formatPercentage } from "@/shared/utils/percentage";
+import { cn } from "@/shared/utils/ui";
type DashboardMetricsCardsProps = {
metrics: DashboardCardMetrics;
@@ -28,35 +31,35 @@ const TREND_THRESHOLD = 0.005;
const CARDS = [
{
label: "Receitas",
+ subtitle: "Entradas do período",
key: "receitas",
icon: RiArrowUpLine,
invertTrend: false,
- cardClass: "",
iconClass: "text-success",
},
{
label: "Despesas",
+ subtitle: "Saídas do período",
key: "despesas",
icon: RiArrowDownLine,
invertTrend: true,
- cardClass: "",
iconClass: "text-destructive",
},
{
label: "Balanço",
+ subtitle: "Receitas menos despesas",
key: "balanco",
icon: RiScalesLine,
invertTrend: false,
- cardClass: "",
- iconClass: "text-amber-500",
+ iconClass: "text-warning",
},
{
label: "Previsto",
+ subtitle: "Saldo acumulado projetado",
key: "previsto",
icon: RiCalendarCheckLine,
invertTrend: false,
- cardClass: "border border-dashed",
- iconClass: "",
+ iconClass: "text-primary",
},
] as const;
@@ -91,8 +94,8 @@ const getPercentChange = (current: number, previous: number): string => {
: "—";
};
-const getTrendColor = (trend: Trend, invertTrend: boolean): string => {
- if (trend === "flat") return "text-muted-foreground";
+const getTrendBadgeClass = (trend: Trend, invertTrend: boolean): string => {
+ if (trend === "flat") return "bg-muted text-muted-foreground";
const isPositive = invertTrend ? trend === "down" : trend === "up";
return isPositive ? "text-success" : "text-destructive";
};
@@ -101,36 +104,61 @@ export function DashboardMetricsCards({ metrics }: DashboardMetricsCardsProps) {
return (
{CARDS.map(
- ({ label, key, icon: Icon, invertTrend, cardClass, iconClass }) => {
+ ({ label, subtitle, key, icon: Icon, invertTrend, iconClass }) => {
const metric = metrics[key];
const trend = getTrend(metric.current, metric.previous);
const TrendIcon = TREND_ICONS[trend];
- const trendColor = getTrendColor(trend, invertTrend);
+ const trendBadgeClass = getTrendBadgeClass(trend, invertTrend);
+ const percentChange = getPercentChange(
+ metric.current,
+ metric.previous,
+ );
return (
-
+
-
-
- {label}
-
-
-
-
-
- {getPercentChange(metric.current, metric.previous)}
+
+
+
+
+ {label}
+
+
+ {subtitle}
+
+
-
-
-
vs. mês anterior
-
+
+
+
+
+
+
+ {percentChange}
+
-
+
+
+
+ no mês anterior
+
+
);
},
diff --git a/src/features/dashboard/components/dashboard-welcome.tsx b/src/features/dashboard/components/dashboard-welcome.tsx
index c26da28..78f756e 100644
--- a/src/features/dashboard/components/dashboard-welcome.tsx
+++ b/src/features/dashboard/components/dashboard-welcome.tsx
@@ -6,12 +6,12 @@ export function DashboardWelcome({ name }: { name?: string | null }) {
const greeting = getGreeting();
return (
-
+
- {greeting}, {displayName}
+ {greeting}, {displayName}
-
{formattedDate}
+
{formattedDate}
);
diff --git a/src/features/dashboard/components/notes/note-list-item.tsx b/src/features/dashboard/components/notes/note-list-item.tsx
index af9e6a7..8ec43cf 100644
--- a/src/features/dashboard/components/notes/note-list-item.tsx
+++ b/src/features/dashboard/components/notes/note-list-item.tsx
@@ -40,20 +40,20 @@ export function NoteListItem({
-
+