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

Implement pingers page #2

Merged
merged 14 commits into from
Jul 14, 2024

Conversation

dmitrijs-balcers
Copy link
Contributor

@dmitrijs-balcers dmitrijs-balcers commented Jun 22, 2024

  • Add new route to see pingers
  • Show all pingers on one page
  • Each pinger should fit the selected polygon by centering and zooming accordingly
  • Disable editing on every pinger map in all pingers view
  • Modify pinger creation page, to pinger update page
    • Have to implement update
  • Make links to each individual pinger to allow modification
  • Add links from all pingers page to individual modification page
  • Add ability to delete pinger from all pingers page
    • To be investigated, seems like BE is not removing pinger
  • Add ability to delete pinger from individual pinger page (? not sure if necessary) lets do this in another PR
  • Mobile ready
  • tests

to test use: http:https://localhost:3000/#/pingers/<id>,<unsubscribe_key>

#1

@dmitrijs-balcers dmitrijs-balcers marked this pull request as draft June 22, 2024 14:17
src/pages/Pingers/Pingers.tsx Outdated Show resolved Hide resolved
src/components/RegionSelector/RegionSelector.tsx Outdated Show resolved Hide resolved
src/pages/Pingers/Pingers.tsx Outdated Show resolved Hide resolved
@dmitrijs-balcers dmitrijs-balcers force-pushed the list-all-pingers branch 2 times, most recently from baa5350 to 04a68c7 Compare July 1, 2024 20:25
@dmitrijs-balcers dmitrijs-balcers force-pushed the list-all-pingers branch 2 times, most recently from c8a19d2 to fad142b Compare July 1, 2024 23:08
@dmitrijs-balcers dmitrijs-balcers force-pushed the list-all-pingers branch 2 times, most recently from e3a1885 to c37fa72 Compare July 2, 2024 20:05
Comment on lines 47 to 49
if (pingers.error) {
return <h1>Error: {JSON.stringify(pingers.error)}</h1>;
}
Copy link
Member

Choose a reason for hiding this comment

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

💬 suggestion: ‏Would you mind just console.loging the error (and maybe sending to bugsnag too) instead of showing it in the UI. The users shouldn't see the error messages. So ideally just a friendly error message is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not fluent in graphql and bugsnag, but it seems to me that this should already handle reporting to it:
https://github.com/dmitrijs-balcers/pinger-app/blob/1acc627fc140d14af5403eebe23f942c51bfa8fb/src/shared/apollo-client.ts#L10

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Just a few small nitpicks.

Plus: could you please take care of the eslint warnings?

WARNING in src/components/Form/Fields/RegionField/RegionField.tsx
  Line 43:10:  'center' is assigned a value but never used  @typescript-eslint/no-unused-vars
  Line 44:10:  'zoom' is assigned a value but never used    @typescript-eslint/no-unused-vars

src/components/Form/Form.tsx
  Line 5:3:  'DropdownItemProps' is defined but never used  @typescript-eslint/no-unused-vars

src/components/RegionSelector/RegionSelector.tsx
  Line 35:6:  React Hook useCallback has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the useCallback call and refer to those specific props inside useCallback  react-hooks/exhaustive-deps

src/pages/Pingers/Pingers.tsx
  Line 1:33:    'gql' is defined but never used                                                                                                                     @typescript-eslint/no-unused-vars
  Line 134:5:   React Hook useCallback has missing dependencies: 'pinger.id' and 'pinger.unsubscribe_key'. Either include them or remove the dependency array       react-hooks/exhaustive-deps
  Line 196:12:  React Hook React.useCallback has missing dependencies: 'onUnsubscribe' and 'unsubscribePinger'. Either include them or remove the dependency array  react-hooks/exhaustive-deps

src/pages/Pingers/Pingers.tsx Outdated Show resolved Hide resolved
@dmitrijs-balcers
Copy link
Contributor Author

dmitrijs-balcers commented Jul 4, 2024

Ahh Matiss, one moment I found a bug. With latest commit I broke this:
image
It is not updating map center and zoom, let me fix that


Fixed, all good now

@dmitrijs-balcers dmitrijs-balcers changed the title [WIP] Implement pingers page Implement pingers page Jul 7, 2024
@dmitrijs-balcers
Copy link
Contributor Author

@MatissJanis this might have slipped through your notifications. PR I think is ready for you to check 🙏

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

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

Ok, one final comment (apologies for not noticing this before):

Screenshot 2024-07-09 at 19 19 33

we are missing a message/view if there are no pingers.

@dmitrijs-balcers
Copy link
Contributor Author

@MatissJanis fixed and updated apollo/client functionality, otherwise I couldn't use maxUsageCount: 2, in tests, do you think that would be a problem? It didn't see that it would introduce any issues in communication with API.

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for adding this!

@MatissJanis MatissJanis merged commit 1403c4e into brokalys:master Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants