chore: clean up code by removing trailing whitespace and ensuring consistent formatting across various files = prettier
This commit is contained in:
@@ -158,7 +158,9 @@ export function BalanceLineChart({
|
||||
className="w-3 h-3 rounded-full"
|
||||
style={{
|
||||
backgroundColor: entry.color,
|
||||
transform: isHovered ? "scale(1.2)" : "scale(1)",
|
||||
transform: isHovered
|
||||
? "scale(1.2)"
|
||||
: "scale(1)",
|
||||
transition: "transform 0.15s",
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -115,4 +115,3 @@ export function CategoryBarChart({
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,7 @@ import { useState } from "react";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CategoryIcon } from "@/components/ui/category-icon";
|
||||
import {
|
||||
PieChart,
|
||||
Pie,
|
||||
Cell,
|
||||
Tooltip,
|
||||
ResponsiveContainer,
|
||||
} from "recharts";
|
||||
import { PieChart, Pie, Cell, Tooltip, ResponsiveContainer } from "recharts";
|
||||
import { Layers, List, ChevronDown, ChevronUp } from "lucide-react";
|
||||
import type { Category } from "@/lib/types";
|
||||
|
||||
@@ -48,8 +42,8 @@ export function CategoryPieChart({
|
||||
const [groupByParent, setGroupByParent] = useState(true);
|
||||
const [isExpanded, setIsExpanded] = useState(false);
|
||||
const hasParentData = dataByParent && dataByParent.length > 0;
|
||||
const baseData = (groupByParent && hasParentData) ? dataByParent : data;
|
||||
|
||||
const baseData = groupByParent && hasParentData ? dataByParent : data;
|
||||
|
||||
// Limit to top 8 by default, show all if expanded
|
||||
const maxItems = 8;
|
||||
const currentData = isExpanded ? baseData : baseData.slice(0, maxItems);
|
||||
@@ -64,7 +58,11 @@ export function CategoryPieChart({
|
||||
variant={groupByParent ? "default" : "ghost"}
|
||||
size="sm"
|
||||
onClick={() => setGroupByParent(!groupByParent)}
|
||||
title={groupByParent ? "Afficher toutes les catégories" : "Regrouper par catégories parentes"}
|
||||
title={
|
||||
groupByParent
|
||||
? "Afficher toutes les catégories"
|
||||
: "Regrouper par catégories parentes"
|
||||
}
|
||||
className="w-full md:w-auto text-xs md:text-sm"
|
||||
>
|
||||
{groupByParent ? (
|
||||
@@ -197,4 +195,3 @@ export function CategoryPieChart({
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,11 @@ export function CategoryTrendChart({
|
||||
variant={groupByParent ? "default" : "ghost"}
|
||||
size="sm"
|
||||
onClick={() => setGroupByParent(!groupByParent)}
|
||||
title={groupByParent ? "Afficher toutes les catégories" : "Regrouper par catégories parentes"}
|
||||
title={
|
||||
groupByParent
|
||||
? "Afficher toutes les catégories"
|
||||
: "Regrouper par catégories parentes"
|
||||
}
|
||||
>
|
||||
{groupByParent ? (
|
||||
<>
|
||||
@@ -173,15 +177,17 @@ export function CategoryTrendChart({
|
||||
content={() => {
|
||||
// Get all category IDs from data
|
||||
const allCategoryIds = Array.from(categoryTotals.keys());
|
||||
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap justify-center gap-x-4 gap-y-1 mt-2">
|
||||
{allCategoryIds.map((categoryId) => {
|
||||
const categoryInfo = getCategoryInfo(categoryId);
|
||||
const categoryName = getCategoryName(categoryId);
|
||||
if (!categoryInfo && categoryId !== "uncategorized") return null;
|
||||
|
||||
const isInDisplayCategories = displayCategories.includes(categoryId);
|
||||
if (!categoryInfo && categoryId !== "uncategorized")
|
||||
return null;
|
||||
|
||||
const isInDisplayCategories =
|
||||
displayCategories.includes(categoryId);
|
||||
const isSelected =
|
||||
selectedCategories.length === 0
|
||||
? isInDisplayCategories
|
||||
@@ -198,8 +204,8 @@ export function CategoryTrendChart({
|
||||
if (selectedCategories.includes(categoryId)) {
|
||||
setSelectedCategories(
|
||||
selectedCategories.filter(
|
||||
(id) => id !== categoryId
|
||||
)
|
||||
(id) => id !== categoryId,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
setSelectedCategories([
|
||||
@@ -234,8 +240,9 @@ export function CategoryTrendChart({
|
||||
{categoriesToShow.map((categoryId, index) => {
|
||||
const categoryInfo = getCategoryInfo(categoryId);
|
||||
const categoryName = getCategoryName(categoryId);
|
||||
if (!categoryInfo && categoryId !== "uncategorized") return null;
|
||||
|
||||
if (!categoryInfo && categoryId !== "uncategorized")
|
||||
return null;
|
||||
|
||||
const isSelected =
|
||||
selectedCategories.length === 0 ||
|
||||
selectedCategories.includes(categoryId);
|
||||
@@ -245,7 +252,10 @@ export function CategoryTrendChart({
|
||||
type="monotone"
|
||||
dataKey={categoryId}
|
||||
name={categoryName}
|
||||
stroke={categoryInfo?.color || CATEGORY_COLORS[index % CATEGORY_COLORS.length]}
|
||||
stroke={
|
||||
categoryInfo?.color ||
|
||||
CATEGORY_COLORS[index % CATEGORY_COLORS.length]
|
||||
}
|
||||
strokeWidth={isSelected ? 2 : 1}
|
||||
strokeOpacity={isSelected ? 1 : 0.3}
|
||||
dot={false}
|
||||
@@ -265,4 +275,3 @@ export function CategoryTrendChart({
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,4 +91,3 @@ export function IncomeExpenseTrendChart({
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,4 +8,3 @@ export { CategoryTrendChart } from "./category-trend-chart";
|
||||
export { SavingsTrendChart } from "./savings-trend-chart";
|
||||
export { IncomeExpenseTrendChart } from "./income-expense-trend-chart";
|
||||
export { YearOverYearChart } from "./year-over-year-chart";
|
||||
|
||||
|
||||
@@ -73,4 +73,3 @@ export function MonthlyChart({ data, formatCurrency }: MonthlyChartProps) {
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,13 @@ export function SavingsTrendChart({
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<AreaChart data={data}>
|
||||
<defs>
|
||||
<linearGradient id="savingsGradient" x1="0" y1="0" x2="0" y2="1">
|
||||
<linearGradient
|
||||
id="savingsGradient"
|
||||
x1="0"
|
||||
y1="0"
|
||||
x2="0"
|
||||
y2="1"
|
||||
>
|
||||
<stop
|
||||
offset="5%"
|
||||
stopColor={isPositive ? "#22c55e" : "#ef4444"}
|
||||
@@ -113,4 +119,3 @@ export function SavingsTrendChart({
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ export function StatsSummaryCards({
|
||||
<div
|
||||
className={cn(
|
||||
"text-lg md:text-2xl font-bold",
|
||||
savings >= 0 ? "text-emerald-600" : "text-red-600"
|
||||
savings >= 0 ? "text-emerald-600" : "text-red-600",
|
||||
)}
|
||||
>
|
||||
{formatCurrency(savings)}
|
||||
@@ -83,4 +83,3 @@ export function StatsSummaryCards({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,13 @@ export function TopExpensesList({
|
||||
<div className="space-y-3 md:space-y-4">
|
||||
{expenses.map((expense, index) => {
|
||||
const category = categories.find(
|
||||
(c) => c.id === expense.categoryId
|
||||
(c) => c.id === expense.categoryId,
|
||||
);
|
||||
return (
|
||||
<div key={expense.id} className="flex items-start gap-2 md:gap-3">
|
||||
<div
|
||||
key={expense.id}
|
||||
className="flex items-start gap-2 md:gap-3"
|
||||
>
|
||||
<div className="w-6 h-6 md:w-8 md:h-8 rounded-full bg-muted flex items-center justify-center text-xs md:text-sm font-semibold shrink-0">
|
||||
{index + 1}
|
||||
</div>
|
||||
@@ -84,4 +87,3 @@ export function TopExpensesList({
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,4 +88,3 @@ export function YearOverYearChart({
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user