Skip to content

Commit

Permalink
Merge pull request #221 from UW-Macrostrat/streamline-url-functions
Browse files Browse the repository at this point in the history
Streamline map page state management
  • Loading branch information
davenquinn authored Jun 12, 2024
2 parents 76d4283 + 1c44dac commit 3d8a8b1
Show file tree
Hide file tree
Showing 19 changed files with 327 additions and 432 deletions.
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

0 comments on commit 3d8a8b1

Please sign in to comment.