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:
@@ -55,23 +55,23 @@ export default function StatisticsPage() {
|
||||
const { data, isLoading } = useBankingData();
|
||||
const isMobile = useIsMobile();
|
||||
const [sheetOpen, setSheetOpen] = useState(false);
|
||||
|
||||
|
||||
// Persister les filtres dans le localStorage
|
||||
const [period, setPeriod] = useLocalStorage<Period>(
|
||||
"statistics-period",
|
||||
"6months"
|
||||
"6months",
|
||||
);
|
||||
const [selectedAccounts, setSelectedAccounts] = useLocalStorage<string[]>(
|
||||
"statistics-selected-accounts",
|
||||
["all"]
|
||||
["all"],
|
||||
);
|
||||
const [selectedCategories, setSelectedCategories] = useLocalStorage<string[]>(
|
||||
"statistics-selected-categories",
|
||||
["all"]
|
||||
["all"],
|
||||
);
|
||||
const [excludeInternalTransfers, setExcludeInternalTransfers] =
|
||||
useLocalStorage("statistics-exclude-internal-transfers", true);
|
||||
|
||||
|
||||
// Pour les dates, on stocke les ISO strings et on les convertit
|
||||
const [customStartDateISO, setCustomStartDateISO] = useLocalStorage<
|
||||
string | null
|
||||
@@ -79,17 +79,17 @@ export default function StatisticsPage() {
|
||||
const [customEndDateISO, setCustomEndDateISO] = useLocalStorage<
|
||||
string | null
|
||||
>("statistics-custom-end-date", null);
|
||||
|
||||
|
||||
// Convertir les ISO strings en Date
|
||||
const customStartDate = useMemo(
|
||||
() => (customStartDateISO ? new Date(customStartDateISO) : undefined),
|
||||
[customStartDateISO]
|
||||
[customStartDateISO],
|
||||
);
|
||||
const customEndDate = useMemo(
|
||||
() => (customEndDateISO ? new Date(customEndDateISO) : undefined),
|
||||
[customEndDateISO]
|
||||
[customEndDateISO],
|
||||
);
|
||||
|
||||
|
||||
// Fonctions pour mettre à jour les dates avec persistance
|
||||
const setCustomStartDate = (date: Date | undefined) => {
|
||||
setCustomStartDateISO(date ? date.toISOString() : null);
|
||||
@@ -97,7 +97,7 @@ export default function StatisticsPage() {
|
||||
const setCustomEndDate = (date: Date | undefined) => {
|
||||
setCustomEndDateISO(date ? date.toISOString() : null);
|
||||
};
|
||||
|
||||
|
||||
const [isCustomDatePickerOpen, setIsCustomDatePickerOpen] = useState(false);
|
||||
|
||||
// Nettoyer les dates personnalisées quand on change de période (sauf si on passe à "custom")
|
||||
@@ -106,7 +106,13 @@ export default function StatisticsPage() {
|
||||
setCustomStartDateISO(null);
|
||||
setCustomEndDateISO(null);
|
||||
}
|
||||
}, [period, customStartDateISO, customEndDateISO, setCustomStartDateISO, setCustomEndDateISO]);
|
||||
}, [
|
||||
period,
|
||||
customStartDateISO,
|
||||
customEndDateISO,
|
||||
setCustomStartDateISO,
|
||||
setCustomEndDateISO,
|
||||
]);
|
||||
|
||||
// Get start date based on period
|
||||
const startDate = useMemo(() => {
|
||||
@@ -1031,7 +1037,11 @@ export default function StatisticsPage() {
|
||||
selected={customStartDate}
|
||||
onSelect={(date) => {
|
||||
setCustomStartDate(date);
|
||||
if (date && customEndDate && date > customEndDate) {
|
||||
if (
|
||||
date &&
|
||||
customEndDate &&
|
||||
date > customEndDate
|
||||
) {
|
||||
setCustomEndDate(undefined);
|
||||
}
|
||||
}}
|
||||
@@ -1071,26 +1081,26 @@ export default function StatisticsPage() {
|
||||
</div>
|
||||
{customStartDate && customEndDate && (
|
||||
<div className="flex gap-2 pt-2 border-t px-3 pb-3">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="flex-1"
|
||||
onClick={() => {
|
||||
setCustomStartDate(undefined);
|
||||
setCustomEndDate(undefined);
|
||||
}}
|
||||
>
|
||||
Réinitialiser
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
className="flex-1"
|
||||
onClick={() => setIsCustomDatePickerOpen(false)}
|
||||
>
|
||||
Valider
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="flex-1"
|
||||
onClick={() => {
|
||||
setCustomStartDate(undefined);
|
||||
setCustomEndDate(undefined);
|
||||
}}
|
||||
>
|
||||
Réinitialiser
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
className="flex-1"
|
||||
onClick={() => setIsCustomDatePickerOpen(false)}
|
||||
>
|
||||
Valider
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user