-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f49e93e
commit c4b8cd9
Showing
7 changed files
with
90 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
parseAsArrayOf, | ||
parseAsFloat, | ||
parseAsInteger, | ||
parseAsString, | ||
parseAsJson, | ||
} from "next-usequerystate/parsers"; | ||
|
||
import { DEFAULT_BBOX, DEFAULT_MAP_SETTINGS } from "@/constants/map"; | ||
|
||
export const datasetsParser = parseAsArrayOf(parseAsInteger).withDefault([]); | ||
|
||
export const layersParser = parseAsArrayOf(parseAsInteger).withDefault([]); | ||
export const layersSettingsParser = parseAsJson<{ | ||
[key: string]: Record<string, unknown>; | ||
}>(); | ||
|
||
export const bboxParser = parseAsArrayOf(parseAsFloat).withDefault(DEFAULT_BBOX); | ||
export const mapSettingsParser = | ||
parseAsJson<typeof DEFAULT_MAP_SETTINGS>().withDefault(DEFAULT_MAP_SETTINGS); | ||
|
||
export const countryParser = parseAsString.withDefault(""); | ||
export const countriesComparisonParser = parseAsArrayOf(parseAsString).withDefault([]); | ||
|
||
export const projectParser = parseAsInteger; | ||
export const pillarsParser = parseAsArrayOf(parseAsInteger).withDefault([]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
export function GET_CATEGORIES_OPTIONS(search?: string) { | ||
return { | ||
"pagination[pageSize]": 100, | ||
populate: "datasets", | ||
sort: "name:asc", | ||
filters: { | ||
...(!!search && { | ||
datasets: { | ||
name: { | ||
$containsi: search, | ||
}, | ||
}, | ||
}), | ||
}, | ||
}; | ||
} | ||
|
||
export function GET_DATASETS_OPTIONS(search?: string, categoryId?: number) { | ||
return { | ||
"pagination[pageSize]": 100, | ||
filters: { | ||
category: categoryId, | ||
...(!!search && { | ||
name: { | ||
$containsi: search, | ||
}, | ||
}), | ||
}, | ||
populate: "*", | ||
sort: "name:asc", | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters