Repository navigation
Show alll projects on a map #1485
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
81387f8
feat(projects): add station, capture, occurrence and member totals to…
mihow b200a01
feat(ui): add a sortable table view to the projects page
mihow c4b89c0
feat(projects): load project totals and recent activity only for the …
mihow c81d4ea
feat(ui): show cover images and recent activity in the projects table
mihow a99951e
refactor: name the projects overview fields once and show team size o…
mihow 7e9c242
test: keep one projects overview test per guarantee
mihow 2d00068
feat(projects): add a taxa count to the projects table and trim the d…
mihow f170a8c
feat(ui): show when each project was last updated in the projects table
mihow c20c849
fix(ui): hide the projects table's Updated at column by default
mihow fd6bf93
feat(projects): always return activity dates, and name the taxa count…
mihow 06987f5
refactor(ui): ask for project totals through the shared withCounts fe…
mihow ac6b1ac
test: build the projects overview test data once per class
mihow 7e4ff78
fix(projects): show team size to anyone allowed to open the team list
mihow 2552c8b
fix(ui): keep the projects toolbar in place when switching views
mihow f65d7bc
fix(ui): stop the Create new button from blinking out while projects …
mihow 57d01ec
feat(projects): return each project's centre point in the project list
mihow c4596f7
feat(ui): show projects on a map on the projects page
mihow 791e9fc
fix(ui): stop the map from crashing when a search leaves no markers
mihow a476ec1
feat(ui): ask for project centres only in the map view
mihow 8459dbe
fix(ui): cap the map zoom so a single marker shows its region instead…
mihow 80748f0
fix(ui): keep station maps zooming to their marker, cap only the proj…
mihow f1b5d58
feat(ui): show every project on the map without loading the table totals
mihow 553454b
feat(ui): cap the projects map at 300 projects
mihow bb5ebee
feat(ui): open map marker popups on hover as well as on click or tap
mihow 71c1e6d
refactor(projects): return a project's position as a location object …
mihow 4f754e4
fix(ui): show an error on the projects map when the request fails
mihow 2e03518
Merge remote-tracking branch 'origin/main' into feat/projects-map
mihow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,63 @@ | ||
| import { ErrorState } from 'components/error-state/error-state' | ||
| import { DEFAULT_ZOOM } from 'components/map/config' | ||
| import { MultiMarkerMap } from 'components/map/multi-marker-map/multi-marker-map' | ||
| import { Project } from 'data-services/models/project' | ||
| import { InfoBlock } from 'nova-ui-kit' | ||
| import { useMemo } from 'react' | ||
| import { APP_ROUTES } from 'utils/constants' | ||
| import { STRING, translate } from 'utils/language' | ||
|
|
||
| export const ProjectsMap = ({ | ||
| error, | ||
| isLoading, | ||
| projects = [], | ||
| }: { | ||
| error?: any | ||
| isLoading: boolean | ||
| projects?: Project[] | ||
| }) => { | ||
| const markers = useMemo( | ||
| () => | ||
| projects.flatMap((project) => | ||
| project.location | ||
| ? [ | ||
| { | ||
| position: project.location, | ||
| popupContent: <ProjectsMapPopupContent project={project} />, | ||
| }, | ||
| ] | ||
| : [] | ||
| ), | ||
| [projects] | ||
| ) | ||
|
|
||
| if (error) { | ||
| return <ErrorState error={error} /> | ||
| } | ||
|
|
||
| return ( | ||
| <MultiMarkerMap | ||
| className="h-[calc(100vh-320px)] min-h-[400px]" | ||
| isLoading={isLoading} | ||
| markers={markers} | ||
| // A project marker is a mean position, so street level would mislead. | ||
| maxZoom={DEFAULT_ZOOM} | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| const ProjectsMapPopupContent = ({ project }: { project: Project }) => ( | ||
| <InfoBlock | ||
| fields={[ | ||
| { | ||
| label: translate(STRING.FIELD_LABEL_PROJECT), | ||
| value: project.name, | ||
| to: APP_ROUTES.PROJECT_DETAILS({ projectId: project.id }), | ||
| }, | ||
| { | ||
| label: translate(STRING.NAV_ITEM_DEPLOYMENTS), | ||
| value: project.numDeployments, | ||
| }, | ||
| ]} | ||
| /> | ||
| ) |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.