refactor: standardize quotation marks in pnpm-lock.yaml and improve code formatting across various components; enhance readability and maintain consistency in code style
This commit is contained in:
@@ -31,7 +31,10 @@ export function useTransactionsPage() {
|
||||
"all",
|
||||
]);
|
||||
const [showReconciled, setShowReconciled] = useState<string>("all");
|
||||
const [period, setPeriod] = useLocalStorage<Period>("transactions-period", "3months");
|
||||
const [period, setPeriod] = useLocalStorage<Period>(
|
||||
"transactions-period",
|
||||
"3months",
|
||||
);
|
||||
const [customStartDate, setCustomStartDate] = useState<Date | undefined>(
|
||||
undefined,
|
||||
);
|
||||
@@ -75,29 +78,29 @@ export function useTransactionsPage() {
|
||||
useEffect(() => {
|
||||
const categoryIdsParam = searchParams.get("categoryIds");
|
||||
const includeUncategorizedParam = searchParams.get("includeUncategorized");
|
||||
|
||||
|
||||
if (categoryIdsParam && metadata) {
|
||||
const categoryIds = categoryIdsParam.split(",");
|
||||
|
||||
|
||||
// Expand parent categories to include their children
|
||||
const expandedCategoryIds = new Set<string>(categoryIds);
|
||||
|
||||
|
||||
categoryIds.forEach((categoryId) => {
|
||||
// Check if this is a parent category
|
||||
const category = metadata.categories.find(
|
||||
(c: Category) => c.id === categoryId
|
||||
(c: Category) => c.id === categoryId,
|
||||
);
|
||||
if (category && category.parentId === null) {
|
||||
// Find all children of this parent
|
||||
const children = metadata.categories.filter(
|
||||
(c: Category) => c.parentId === categoryId
|
||||
(c: Category) => c.parentId === categoryId,
|
||||
);
|
||||
children.forEach((child: Category) => {
|
||||
expandedCategoryIds.add(child.id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setSelectedCategories(Array.from(expandedCategoryIds));
|
||||
setPage(0);
|
||||
} else if (includeUncategorizedParam === "true") {
|
||||
@@ -205,15 +208,18 @@ export function useTransactionsPage() {
|
||||
setPage(0);
|
||||
}, []);
|
||||
|
||||
const handlePeriodChange = useCallback((p: Period) => {
|
||||
setPeriod(p);
|
||||
setPage(0);
|
||||
if (p !== "custom") {
|
||||
setIsCustomDatePickerOpen(false);
|
||||
} else {
|
||||
setIsCustomDatePickerOpen(true);
|
||||
}
|
||||
}, [setPeriod]);
|
||||
const handlePeriodChange = useCallback(
|
||||
(p: Period) => {
|
||||
setPeriod(p);
|
||||
setPage(0);
|
||||
if (p !== "custom") {
|
||||
setIsCustomDatePickerOpen(false);
|
||||
} else {
|
||||
setIsCustomDatePickerOpen(true);
|
||||
}
|
||||
},
|
||||
[setPeriod],
|
||||
);
|
||||
|
||||
const handleCustomStartDateChange = useCallback((date: Date | undefined) => {
|
||||
setCustomStartDate(date);
|
||||
|
||||
Reference in New Issue
Block a user