feat(dependencies): add Lottie animation libraries and refactor NotFoundPage
- Added `@lottiefiles/dotlottie-react` and `lottie-react` dependencies for enhanced animation capabilities. - Refactored the NotFoundPage component to utilize a dedicated NotFoundContent component, improving code organization and readability. - Updated package.json and pnpm-lock.yaml to reflect new dependencies and their versions.
This commit is contained in:
@@ -101,6 +101,37 @@ const buildTenderFilterFormValues = (params: Record<string, any>) => ({
|
||||
),
|
||||
});
|
||||
|
||||
/** RHF `reset` does not drop fields omitted from the payload — merge empties so URL sync / clear-all match the UI. */
|
||||
const TENDER_FILTER_FORM_DEFAULTS: Record<string, any> = {
|
||||
q: "",
|
||||
title: "",
|
||||
description: "",
|
||||
country: "",
|
||||
country_codes: "",
|
||||
notice_type: "",
|
||||
notice_types: "",
|
||||
form_types: "",
|
||||
main_classification: "",
|
||||
classifications: "",
|
||||
cpv_codes: "",
|
||||
created_at_range: [],
|
||||
tender_deadline_range: [],
|
||||
publication_date_range: [],
|
||||
submission_deadline_range: [],
|
||||
};
|
||||
|
||||
const mergeTenderFilterFormState = (params: Record<string, any>) => {
|
||||
const built = buildTenderFilterFormValues(params);
|
||||
return {
|
||||
...TENDER_FILTER_FORM_DEFAULTS,
|
||||
...built,
|
||||
created_at_range: built.created_at_range ?? [],
|
||||
tender_deadline_range: built.tender_deadline_range ?? [],
|
||||
publication_date_range: built.publication_date_range ?? [],
|
||||
submission_deadline_range: built.submission_deadline_range ?? [],
|
||||
};
|
||||
};
|
||||
|
||||
const mapDateRangeFilters = (values: Record<string, any>) => {
|
||||
const mappedValues = { ...values };
|
||||
|
||||
@@ -250,7 +281,7 @@ const useTenderListPresenter = () => {
|
||||
newParams[key] = value;
|
||||
}
|
||||
setParams(newParams);
|
||||
filterFormReset(buildTenderFilterFormValues(newParams));
|
||||
filterFormReset(mergeTenderFilterFormState(newParams));
|
||||
}, [searchParams, filterFormReset]);
|
||||
|
||||
const { data, error, isPending } = useTendersQuery(params);
|
||||
@@ -377,8 +408,14 @@ const useTenderListPresenter = () => {
|
||||
};
|
||||
|
||||
const clearAllFilters = useCallback(() => {
|
||||
const cleared: Record<string, any> = {
|
||||
...apiDefaultParams,
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
};
|
||||
filterFormReset(mergeTenderFilterFormState(cleared));
|
||||
router.push(pathName);
|
||||
}, [pathName, router]);
|
||||
}, [pathName, router, filterFormReset]);
|
||||
const columns = [
|
||||
"row",
|
||||
"title",
|
||||
|
||||
Reference in New Issue
Block a user