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

Issue 496/add recent activity page #537

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

paskal98
Copy link
Contributor

@paskal98 paskal98 commented Oct 23, 2024

Added activity page with infinity scroll list

Closes #496

@wbazant
Copy link
Collaborator

wbazant commented Oct 23, 2024

Okay, this is still a draft PR because I can see comments in the Cyrillic alphabet ;) but I had a rough read through!

I like that all the main pieces of the solution seem to be there, and that you were able to use the API to get the required data. What was the reason to fetch locations by ID? We should not need to do two API calls for something that can be a database join and, if it's just one or two fields that are missing it's much better if we add it to the API payload - you can open a ticket in https://github.com/falling-fruit/falling-fruit-api and stub out the data for now. Either Ethan will add it, or I'll be able to have a go myself.

Instead of changing state.list and state.location (which hold data needed the list page and location page respectively), it's going to be much better for maintainability if you define a new slice, state.activity, and keep the state there: it will look like

const { changes, isLoading, offset } = useSelector(state.activity)

in the component. The async / promise chaining code should also go there, and ideally your component will mostly be rendering and doing UI code.

We would also benefit if the organization of the changes follows a few other conventions in the code base:

  • the effect of first changes being loaded after the initial URL load goes in the src/components/connect folder, see src/components/connect/ConnectTypes.js
  • styles go in the same module as the component being styled
  • utils go in src/utils

Can you have a look at existing usages of state.type.typesAccess and compare to how you've used it currently? It's a class, with methods for accessing the data, so the rest of the code base shouldn't need to access state.type.typesAccess.localizedTypes.

Copy link
Collaborator

@wbazant wbazant left a comment

Choose a reason for hiding this comment

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

Marking the PR as not ready yet - see comments on the issue and in the PR

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.

Add recent activity page
2 participants