Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline map page state management #221

Merged
merged 5 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ docker-compose.yaml
!.yarn/sdks
!.yarn/versions

# IntelliJ
.idea/workspace.xml
.idea/tasks.xml


# For ignoring static files
*.png
*.jpg
*.jpg

.vite
.vite
7 changes: 7 additions & 0 deletions .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 0 additions & 99 deletions .idea/workspace.xml

This file was deleted.

2 changes: 1 addition & 1 deletion deps/web-components
6 changes: 3 additions & 3 deletions src/pages/map/map-interface/app-state/handlers/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SETTINGS, apiV2Prefix } from "@macrostrat-web/settings";
import axios from "axios";
import { joinURL } from "~/pages/map/map-interface/utils";
import { ColumnGeoJSONRecord } from "../reducers";
import { UPDATE_FILTERED_COLUMNS } from "../reducers/filtered-columns";
import { ColumnGeoJSONRecord } from "./columns";
import { UPDATE_COLUMN_FILTERS } from "../reducers/core/types";
import { XDDSnippet } from "~/types";

export const base = apiV2Prefix;
Expand Down Expand Up @@ -54,7 +54,7 @@ function buildColumnQueryParams(filters) {

export async function fetchFilteredColumns(
providedFilters
): Promise<UPDATE_FILTERED_COLUMNS | void> {
): Promise<UPDATE_COLUMN_FILTERS | void> {
let queryString = buildColumnQueryParams(providedFilters);
let url = `${base}/columns`;
if (Object.keys(queryString).length === 0) {
Expand Down
7 changes: 5 additions & 2 deletions src/pages/map/map-interface/app-state/handlers/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function runFilter(filter: Filter): Promise<FilterData> {
return {
category: "lithology",
id: filter.name ?? filter.id,
name: filter.name ?? filter.id,
name: filter.name ?? filter.id.toString(),
type: filter.type,
legend_ids: [],
};
Expand Down Expand Up @@ -169,11 +169,13 @@ export const fetchIntervalFilter = async (
type LithologyClassFilter = {
type: FilterType.LithologyClasses;
name: string;
id: number;
};

type LithologyTypeFilter = {
type: FilterType.LithologyTypes;
name: string;
id: number;
};

type LithologyFilter = {
Expand Down Expand Up @@ -285,7 +287,8 @@ async function fetchAllLithTypes(
return {
category: "lithology",
id,
name: id,
// TODO: revisit name/id differences
name: id.toString(),
type,
legend_ids,
};
Expand Down
Loading
Loading