chore: clean up code by removing trailing whitespace and ensuring consistent formatting across various files = prettier

This commit is contained in:
Julien Froidefond
2025-12-01 08:37:30 +01:00
parent 757b1b84ab
commit e715779de7
98 changed files with 5453 additions and 3126 deletions

View File

@@ -84,7 +84,7 @@ export function suggestKeyword(descriptions: string[]): string {
if (sorted.length > 0) {
// Return the longest frequent keyword
return sorted.reduce((best, current) =>
current[0].length > best[0].length ? current : best
current[0].length > best[0].length ? current : best,
)[0];
}
@@ -92,4 +92,3 @@ export function suggestKeyword(descriptions: string[]): string {
const firstKeywords = extractKeywords(descriptions[0]);
return firstKeywords[0] || descriptions[0].slice(0, 15);
}

View File

@@ -1,4 +1,3 @@
export { RuleGroupCard } from "./rule-group-card";
export { RuleCreateDialog } from "./rule-create-dialog";
export { RulesSearchBar } from "./rules-search-bar";

View File

@@ -65,7 +65,7 @@ export function RuleCreateDialog({
if (!keyword) return null;
const lowerKeyword = keyword.toLowerCase();
return categories.find((c) =>
c.keywords.some((k) => k.toLowerCase() === lowerKeyword)
c.keywords.some((k) => k.toLowerCase() === lowerKeyword),
);
}, [keyword, categories]);
@@ -136,7 +136,8 @@ export function RuleCreateDialog({
<div className="flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400">
<AlertCircle className="h-3 w-3" />
<span>
Ce mot-clé existe déjà dans &quot;{existingCategory.name}&quot;
Ce mot-clé existe déjà dans &quot;{existingCategory.name}
&quot;
</span>
</div>
)}
@@ -202,8 +203,9 @@ export function RuleCreateDialog({
<div className="flex items-center gap-2 text-sm text-success">
<CheckCircle2 className="h-4 w-4" />
<span>
Le mot-clé &quot;<strong>{keyword}</strong>&quot; sera ajouté à la
catégorie &quot;<strong>{selectedCategory?.name}</strong>&quot;
Le mot-clé &quot;<strong>{keyword}</strong>&quot; sera ajouté
à la catégorie &quot;<strong>{selectedCategory?.name}</strong>
&quot;
</span>
</div>
</div>
@@ -225,4 +227,3 @@ export function RuleCreateDialog({
</Dialog>
);
}

View File

@@ -38,7 +38,9 @@ export function RuleGroupCard({
formatCurrency,
formatDate,
}: RuleGroupCardProps) {
const [selectedCategoryId, setSelectedCategoryId] = useState<string | null>(null);
const [selectedCategoryId, setSelectedCategoryId] = useState<string | null>(
null,
);
const isMobile = useIsMobile();
const avgAmount =
@@ -59,7 +61,11 @@ export function RuleGroupCard({
onClick={onToggleExpand}
>
<div className="flex items-center gap-2 md:gap-3 flex-1 min-w-0">
<Button variant="ghost" size="icon" className="h-5 w-5 md:h-6 md:w-6 shrink-0">
<Button
variant="ghost"
size="icon"
className="h-5 w-5 md:h-6 md:w-6 shrink-0"
>
{isExpanded ? (
<ChevronDown className="h-3 w-3 md:h-4 md:w-4" />
) : (
@@ -72,7 +78,10 @@ export function RuleGroupCard({
<span className="font-medium text-xs md:text-base text-foreground truncate">
{group.displayName}
</span>
<Badge variant="secondary" className="text-[10px] md:text-xs shrink-0">
<Badge
variant="secondary"
className="text-[10px] md:text-xs shrink-0"
>
{group.transactions.length} 💳
</Badge>
</div>
@@ -91,7 +100,7 @@ export function RuleGroupCard({
<div
className={cn(
"font-semibold tabular-nums text-sm",
isDebit ? "text-destructive" : "text-success"
isDebit ? "text-destructive" : "text-success",
)}
>
{formatCurrency(group.totalAmount)}
@@ -158,10 +167,7 @@ export function RuleGroupCard({
{isMobile ? (
<div className="max-h-64 overflow-y-auto divide-y divide-border">
{group.transactions.map((transaction) => (
<div
key={transaction.id}
className="p-3 hover:bg-muted/50"
>
<div key={transaction.id} className="p-3 hover:bg-muted/50">
<div className="flex items-start justify-between gap-2">
<div className="flex-1 min-w-0">
<p className="text-xs md:text-sm font-medium truncate">
@@ -181,7 +187,7 @@ export function RuleGroupCard({
"text-xs md:text-sm font-semibold tabular-nums shrink-0",
transaction.amount < 0
? "text-destructive"
: "text-success"
: "text-success",
)}
>
{formatCurrency(transaction.amount)}
@@ -228,7 +234,7 @@ export function RuleGroupCard({
"px-4 py-2 text-right tabular-nums whitespace-nowrap",
transaction.amount < 0
? "text-destructive"
: "text-success"
: "text-success",
)}
>
{formatCurrency(transaction.amount)}
@@ -244,4 +250,3 @@ export function RuleGroupCard({
</div>
);
}

View File

@@ -75,4 +75,3 @@ export function RulesSearchBar({
</div>
);
}