chore: standardize quotes in pnpm-lock.yaml and clean up formatting in various files for improved readability
This commit is contained in:
@@ -60,20 +60,20 @@ export default function TransactionsPage() {
|
||||
const [showReconciled, setShowReconciled] = useState<string>("all");
|
||||
const [period, setPeriod] = useState<Period>("all");
|
||||
const [customStartDate, setCustomStartDate] = useState<Date | undefined>(
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
const [customEndDate, setCustomEndDate] = useState<Date | undefined>(
|
||||
undefined
|
||||
undefined,
|
||||
);
|
||||
const [isCustomDatePickerOpen, setIsCustomDatePickerOpen] = useState(false);
|
||||
const [sortField, setSortField] = useState<SortField>("date");
|
||||
const [sortOrder, setSortOrder] = useState<SortOrder>("desc");
|
||||
const [selectedTransactions, setSelectedTransactions] = useState<Set<string>>(
|
||||
new Set()
|
||||
new Set(),
|
||||
);
|
||||
const [ruleDialogOpen, setRuleDialogOpen] = useState(false);
|
||||
const [ruleTransaction, setRuleTransaction] = useState<Transaction | null>(
|
||||
null
|
||||
null,
|
||||
);
|
||||
|
||||
// Get start date based on period
|
||||
@@ -188,7 +188,7 @@ export default function TransactionsPage() {
|
||||
// Use transactions from current page to find similar ones
|
||||
const normalizedDesc = normalizeDescription(ruleTransaction.description);
|
||||
const similarTransactions = transactionsData.transactions.filter(
|
||||
(t) => normalizeDescription(t.description) === normalizedDesc
|
||||
(t) => normalizeDescription(t.description) === normalizedDesc,
|
||||
);
|
||||
|
||||
if (similarTransactions.length === 0) return null;
|
||||
@@ -199,7 +199,7 @@ export default function TransactionsPage() {
|
||||
transactions: similarTransactions,
|
||||
totalAmount: similarTransactions.reduce((sum, t) => sum + t.amount, 0),
|
||||
suggestedKeyword: suggestKeyword(
|
||||
similarTransactions.map((t) => t.description)
|
||||
similarTransactions.map((t) => t.description),
|
||||
),
|
||||
};
|
||||
}, [ruleTransaction, transactionsData]);
|
||||
@@ -215,7 +215,7 @@ export default function TransactionsPage() {
|
||||
|
||||
// 1. Add keyword to category
|
||||
const category = metadata.categories.find(
|
||||
(c: { id: string }) => c.id === ruleData.categoryId
|
||||
(c: { id: string }) => c.id === ruleData.categoryId,
|
||||
);
|
||||
if (!category) {
|
||||
throw new Error("Category not found");
|
||||
@@ -223,7 +223,7 @@ export default function TransactionsPage() {
|
||||
|
||||
// Check if keyword already exists
|
||||
const keywordExists = category.keywords.some(
|
||||
(k: string) => k.toLowerCase() === ruleData.keyword.toLowerCase()
|
||||
(k: string) => k.toLowerCase() === ruleData.keyword.toLowerCase(),
|
||||
);
|
||||
|
||||
if (!keywordExists) {
|
||||
@@ -241,8 +241,8 @@ export default function TransactionsPage() {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ id, categoryId: ruleData.categoryId }),
|
||||
})
|
||||
)
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ export default function TransactionsPage() {
|
||||
queryClient.invalidateQueries({ queryKey: ["banking-metadata"] });
|
||||
setRuleDialogOpen(false);
|
||||
},
|
||||
[metadata, queryClient]
|
||||
[metadata, queryClient],
|
||||
);
|
||||
|
||||
const invalidateAll = useCallback(() => {
|
||||
@@ -282,7 +282,7 @@ export default function TransactionsPage() {
|
||||
if (!transactionsData) return;
|
||||
|
||||
const transaction = transactionsData.transactions.find(
|
||||
(t) => t.id === transactionId
|
||||
(t) => t.id === transactionId,
|
||||
);
|
||||
if (!transaction) return;
|
||||
|
||||
@@ -307,7 +307,7 @@ export default function TransactionsPage() {
|
||||
if (!transactionsData) return;
|
||||
|
||||
const transaction = transactionsData.transactions.find(
|
||||
(t) => t.id === transactionId
|
||||
(t) => t.id === transactionId,
|
||||
);
|
||||
if (!transaction || transaction.isReconciled) return;
|
||||
|
||||
@@ -330,12 +330,12 @@ export default function TransactionsPage() {
|
||||
|
||||
const setCategory = async (
|
||||
transactionId: string,
|
||||
categoryId: string | null
|
||||
categoryId: string | null,
|
||||
) => {
|
||||
if (!transactionsData) return;
|
||||
|
||||
const transaction = transactionsData.transactions.find(
|
||||
(t) => t.id === transactionId
|
||||
(t) => t.id === transactionId,
|
||||
);
|
||||
if (!transaction) return;
|
||||
|
||||
@@ -357,7 +357,7 @@ export default function TransactionsPage() {
|
||||
if (!transactionsData) return;
|
||||
|
||||
const transactionsToUpdate = transactionsData.transactions.filter((t) =>
|
||||
selectedTransactions.has(t.id)
|
||||
selectedTransactions.has(t.id),
|
||||
);
|
||||
|
||||
setSelectedTransactions(new Set());
|
||||
@@ -369,8 +369,8 @@ export default function TransactionsPage() {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ ...t, isReconciled: reconciled }),
|
||||
})
|
||||
)
|
||||
}),
|
||||
),
|
||||
);
|
||||
invalidateTransactions();
|
||||
} catch (error) {
|
||||
@@ -382,7 +382,7 @@ export default function TransactionsPage() {
|
||||
if (!transactionsData) return;
|
||||
|
||||
const transactionsToUpdate = transactionsData.transactions.filter((t) =>
|
||||
selectedTransactions.has(t.id)
|
||||
selectedTransactions.has(t.id),
|
||||
);
|
||||
|
||||
setSelectedTransactions(new Set());
|
||||
@@ -394,8 +394,8 @@ export default function TransactionsPage() {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ ...t, categoryId }),
|
||||
})
|
||||
)
|
||||
}),
|
||||
),
|
||||
);
|
||||
invalidateTransactions();
|
||||
} catch (error) {
|
||||
@@ -409,7 +409,7 @@ export default function TransactionsPage() {
|
||||
setSelectedTransactions(new Set());
|
||||
} else {
|
||||
setSelectedTransactions(
|
||||
new Set(transactionsData.transactions.map((t) => t.id))
|
||||
new Set(transactionsData.transactions.map((t) => t.id)),
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -445,7 +445,7 @@ export default function TransactionsPage() {
|
||||
`/api/banking/transactions?id=${transactionId}`,
|
||||
{
|
||||
method: "DELETE",
|
||||
}
|
||||
},
|
||||
);
|
||||
if (!response.ok) throw new Error("Failed to delete transaction");
|
||||
invalidateTransactions();
|
||||
|
||||
Reference in New Issue
Block a user