chore: clean up code by removing trailing whitespace and ensuring consistent formatting across various files = prettier
This commit is contained in:
@@ -18,11 +18,15 @@ import {
|
||||
AccountEditDialog,
|
||||
AccountBulkActions,
|
||||
} from "@/components/accounts";
|
||||
import {
|
||||
FolderEditDialog,
|
||||
} from "@/components/folders";
|
||||
import { FolderEditDialog } from "@/components/folders";
|
||||
import { useBankingData } from "@/lib/hooks";
|
||||
import { updateAccount, deleteAccount, addFolder, updateFolder, deleteFolder } from "@/lib/store-db";
|
||||
import {
|
||||
updateAccount,
|
||||
deleteAccount,
|
||||
addFolder,
|
||||
updateFolder,
|
||||
deleteFolder,
|
||||
} from "@/lib/store-db";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Building2, Folder, Plus, List, LayoutGrid } from "lucide-react";
|
||||
@@ -46,7 +50,7 @@ function FolderDropZone({
|
||||
<div
|
||||
ref={setNodeRef}
|
||||
className={cn(
|
||||
isOver && "ring-2 ring-primary ring-offset-2 rounded-lg p-2"
|
||||
isOver && "ring-2 ring-primary ring-offset-2 rounded-lg p-2",
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
@@ -85,7 +89,7 @@ export default function AccountsPage() {
|
||||
activationConstraint: {
|
||||
distance: 8,
|
||||
},
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
if (isLoading || !data) {
|
||||
@@ -202,7 +206,9 @@ export default function AccountsPage() {
|
||||
|
||||
const handleSaveFolder = async () => {
|
||||
const parentId =
|
||||
folderFormData.parentId === "folder-root" ? null : folderFormData.parentId;
|
||||
folderFormData.parentId === "folder-root"
|
||||
? null
|
||||
: folderFormData.parentId;
|
||||
|
||||
try {
|
||||
if (editingFolder) {
|
||||
@@ -231,7 +237,7 @@ export default function AccountsPage() {
|
||||
const handleDeleteFolder = async (folderId: string) => {
|
||||
if (
|
||||
!confirm(
|
||||
"Supprimer ce dossier ? Les comptes seront déplacés à la racine."
|
||||
"Supprimer ce dossier ? Les comptes seront déplacés à la racine.",
|
||||
)
|
||||
)
|
||||
return;
|
||||
@@ -270,7 +276,9 @@ export default function AccountsPage() {
|
||||
} else if (overId.startsWith("account-")) {
|
||||
// Déplacer vers le dossier du compte cible
|
||||
const targetAccountId = overId.replace("account-", "");
|
||||
const targetAccount = data.accounts.find((a) => a.id === targetAccountId);
|
||||
const targetAccount = data.accounts.find(
|
||||
(a) => a.id === targetAccountId,
|
||||
);
|
||||
if (targetAccount) {
|
||||
targetFolderId = targetAccount.folderId;
|
||||
}
|
||||
@@ -289,7 +297,7 @@ export default function AccountsPage() {
|
||||
folderId: targetFolderId,
|
||||
};
|
||||
const updatedAccounts = data.accounts.map((a) =>
|
||||
a.id === accountId ? updatedAccount : a
|
||||
a.id === accountId ? updatedAccount : a,
|
||||
);
|
||||
update({
|
||||
...data,
|
||||
@@ -311,7 +319,6 @@ export default function AccountsPage() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const getTransactionCount = (accountId: string) => {
|
||||
return data.transactions.filter((t) => t.accountId === accountId).length;
|
||||
};
|
||||
@@ -370,7 +377,7 @@ export default function AccountsPage() {
|
||||
<p
|
||||
className={cn(
|
||||
"text-2xl font-bold",
|
||||
totalBalance >= 0 ? "text-emerald-600" : "text-red-600"
|
||||
totalBalance >= 0 ? "text-emerald-600" : "text-red-600",
|
||||
)}
|
||||
>
|
||||
{formatCurrency(totalBalance)}
|
||||
@@ -438,21 +445,21 @@ export default function AccountsPage() {
|
||||
(f) => f.id === account.folderId,
|
||||
);
|
||||
|
||||
return (
|
||||
<AccountCard
|
||||
key={account.id}
|
||||
account={account}
|
||||
folder={folder}
|
||||
transactionCount={getTransactionCount(account.id)}
|
||||
onEdit={handleEdit}
|
||||
onDelete={handleDelete}
|
||||
formatCurrency={formatCurrency}
|
||||
isSelected={selectedAccounts.has(account.id)}
|
||||
onSelect={toggleSelectAccount}
|
||||
draggableId={`account-${account.id}`}
|
||||
compact={isCompactView}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
<AccountCard
|
||||
key={account.id}
|
||||
account={account}
|
||||
folder={folder}
|
||||
transactionCount={getTransactionCount(account.id)}
|
||||
onEdit={handleEdit}
|
||||
onDelete={handleDelete}
|
||||
formatCurrency={formatCurrency}
|
||||
isSelected={selectedAccounts.has(account.id)}
|
||||
onSelect={toggleSelectAccount}
|
||||
draggableId={`account-${account.id}`}
|
||||
compact={isCompactView}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</FolderDropZone>
|
||||
@@ -559,7 +566,7 @@ export default function AccountsPage() {
|
||||
<Card>
|
||||
<CardContent className="p-4">
|
||||
{data.accounts.find(
|
||||
(a) => a.id === activeId.replace("account-", "")
|
||||
(a) => a.id === activeId.replace("account-", ""),
|
||||
)?.name || ""}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user