Closed nina-py closed 3 years ago
Back to WIP as I have done a bit more on this but have run out of time to finish today. Today's commit:
Added a new Notification component (MUI Snackbar behind the scenes): this is used to show users if their actions, i.e. snoozing a prospect, have been successful.
Lifted up notifications from the Card component so that they're not destroyed on re-rendering prospect lists before anyone can read them.
Abstracted refetching queries away from the frontend and into the local API code: these will likely not be needed for the production API (they were not needed for the AWS AppSync API but the local API won't update cache without a bit of help).
Wired up 'snooze prospect' and 'reject prospect' mutations to buttons on the Edit & Approve form.
Outstanding tasks:
Today's commit details are:
Tests are lagging behind (sorry!), will fix existing ones and write more for new functionality in the next commit.
Ready for review. A few tests could be added for the Edit & Approve page - will do these in a follow-up PR alongside with tests for the Prospects page (there's one skipped test there now) that I have finally figured how to fix.
Goal
Get at least some of the mutations working, and the frontend responding to changes in prospect state.
Implementation Decisions
Updated schema to remove 'snoozedUntil' field and add 'SNOOZED' state.
'Snooze' and 'Reject' buttons now work on Prospects page.
Lists of prospects get updated every time a prospect is snoozed or rejected.
Note that:
1) I am currently refetching queries from the API when prospects are snoozed or rejected. This is the nuclear option and I will replace it with what is recommended in Apollo docs (but what I couldn't get running just yet) - an update function that manually updates the local Apollo cache.
2) Changes to prospects sent to the local API are not saved to disk for some reason (I have already made the file writable - it's not enough). They persist on the frontend as long as you keep the local GraphQL server running.
3) This PR only gets two mutations working out of ~6-7 that we need. I'm happy to keep working on this PR until the Edit and Edit & Approve mutations also work correctly (I think these would mean everything on the Prospects page is functional), or you could merge it as is and I'll continue on another branch.