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

Create locations pages and map #1613

Open
wants to merge 12 commits into
base: john/20024-zod-poc
Choose a base branch
from

Conversation

johnclary
Copy link
Member

@johnclary johnclary commented Nov 25, 2024

Associated issues

Testing

URL to test: Local

  1. You will need to delete the crashesListViewQueryConfig entry from your localstorage
  2. Use the sidebar to navigate to the locations page
  3. Search by location ID
  4. search by the location name
  5. toggle the advanced filter switches on/off
  6. sort and paginate through results
  7. Refresh the page to see that your search is persisted
  8. Navigate to a location details page
  9. Verify that the location map loads correctly and is zoomed on the location polygon
  10. See that the card to the right of the map displays the location ID

Ship list

  • Check migrations for any conflicts with latest migrations in main branch
  • Confirm Hasura role permissions for necessary access
  • Code reviewed
  • Product manager approved

}

if (!data) {
// todo: loading spinner (would be nice to use a spinner inside cards)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -110,7 +110,7 @@ export default function SidebarLayout({ children }: { children: ReactNode }) {
<SideBarListItem
isCollapsed={isCollapsed}
isCurrentPage={segments.includes("locations")}
Icon={FaMap}
Icon={FaLocationDot}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i changed the sidebar icon to the map marker, this feels a lot more intuitive to me than the folding map icon

// name: "cr3_crash_count",
// relationshipName: "locations_list_view"
// }
};
Copy link
Member Author

@johnclary johnclary Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the current data cards can render relationships to lookup tables, but there no is mechanism to render card values through other relationships, like the locations <> locations_list_view one-to-one relationship. it felt like a big enough lift to leave out of scope. and probably not worth touching until we settle the question of if we want to stick with zod-generated types 🤔

@@ -0,0 +1,3 @@
import { locationColumns } from "./locationColumns";

export const locationCardColumns = [locationColumns.location_id];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels a bit silly but i'm matching the pattern i used to set up the crash data card column arrays 🤷

})
.optional(),
coordinates: z.array(z.array(z.array(coordinateSchema))),
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we were going to define more geojson types i would go searching for a library that has already solved this problem

@@ -269,7 +281,7 @@ const getWhereExp = (filterGroups: FilterGroup[]): string => {
.map((filterGroup) => filterGroupToWhereExp(filterGroup))
// remove any null values, which are returned when a fitler group is empty
.filter((x) => !!x);
return andExps.length > 0 ? `{ _and: [ ${andExps.join("\n")} ]}` : "";
return andExps.length > 0 ? `{ _and: [ ${andExps.join("\n")} ]}` : "{}";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when building out the locations list i initially had no filters configured, and the querybuilder was generating an invalid where condition as a result. the empty braces are valid graphql and fixed the problem 👍

/**
* The search fields that are available to select from when searching
*/
searchFields: SearchFilterField[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these used to be hardcoded specifically for crashes

@johnclary johnclary changed the title Locations pages Create locations pages and map Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant