Skip to content

feat: APP-545 mobile projects filters#2595

Merged
blushi merged 8 commits intodevfrom
feat-APP-545-mobile-projects-filters
Feb 13, 2025
Merged

feat: APP-545 mobile projects filters#2595
blushi merged 8 commits intodevfrom
feat-APP-545-mobile-projects-filters

Conversation

@blushi
Copy link
Member

@blushi blushi commented Feb 10, 2025

Description

Closes: https://regennetwork.atlassian.net/browse/APP-545


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • provided a link to the relevant issue or specification
  • provided instructions on how to test
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

How to test

From https://deploy-preview-2595--regen-marketplace.netlify.app/projects/1

  • check the filters on desktop are still working as before
  • check the filters on mobile are only applied after clicking "apply filters" and the number of selected filters that is displayed corresponds to the number of types of filters that are different from their initial values (ie for credit classes, even if you select/unselect multiple credit classes, that will only correspond to 1)

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items
.

I have...

  • confirmed all author checklist items have been addressed
  • reviewed code correctness and readability
  • verified React components follow DRY principles
  • reviewed documentation is accurate
  • reviewed tests
  • manually tested (if applicable)

@netlify
Copy link

netlify bot commented Feb 10, 2025

Deploy Preview for regen-website ready!

Name Link
🔨 Latest commit c86bfcf
🔍 Latest deploy log https://app.netlify.com/sites/regen-website/deploys/67adb5bb80c4e10008c271ad
😎 Deploy Preview https://deploy-preview-2595--regen-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Feb 10, 2025

Deploy Preview for terrasos ready!

Name Link
🔨 Latest commit c86bfcf
🔍 Latest deploy log https://app.netlify.com/sites/terrasos/deploys/67adb5bb0553ae00087e7064
😎 Deploy Preview https://deploy-preview-2595--terrasos.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@blushi blushi requested a review from r41ph February 10, 2025 12:50
@blushi
Copy link
Member Author

blushi commented Feb 10, 2025

@erikalogie @S4mmyb see testing instructions

@erikalogie
Copy link
Collaborator

LGTM

Copy link
Contributor

@r41ph r41ph left a comment

Choose a reason for hiding this comment

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

The implementation looks good, I'm approving these changes with just a couple of minor comments in the code. Also, as I've mentioned, I wonder if we really need all this additional logic for applying the filters after clicking 'Apply filters' on mobile.

The initial issue was about having an awkward UX because the filters were applied behind the modal and the users had to manually close the modal to be able to see the results. The current solution introduces more code to maintain, and users still need to click a button and wait for filters to apply, which they didn't have to before.

Would it make sense to reconsider if this extra complexity is necessary, or if we could achieve a similar UX with a simpler approach? For example, instead of the X (close button) we could have a single button bellow that changes its state from 'close' (if no filters have changed) to 'see projects' when filters are modified?


export const getCreditClassSelectedFilters = (
creditClassSelectedFilters: Record<string, boolean>,
export const getCreditClassFilters = (
Copy link
Contributor

Choose a reason for hiding this comment

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

A more descriptive name might be setAllCreditClassFilters because the function is setting every filter to a given value

Copy link
Member Author

@blushi blushi Feb 10, 2025

Choose a reason for hiding this comment

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

I've just dropped the "Selected" in this function name
With the way we use it (in a setter function), changing it might look a bit repetitive, no?
setCreditClassFilters(setAllCreditClassFilters(creditClassSelectedFilters, false));
but I agree we could find a better name

'filterPermissionlessCredits',
{
selected: getFilterSelected(event.target.checked),
selected: getFilterSelected(checked),
Copy link
Contributor

Choose a reason for hiding this comment

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

Since it returns a filter status, I'd consider renaming this function to something like getFilterStatus

getCreditClassSelectedFilters(creditClassSelectedFilters, true),
);
if (selectAllEnabled) {
if (mobile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could avoid repetition by creating a helper function:

...

const updateFilters = (newState: boolean) => {
  const updatedFilters = getCreditClassFilters(creditClassSelectedFilters, newState);
  if (mobile) {
    setTempCreditClassFilters(updatedFilters);
  } else {
    setCreditClassFilters(updatedFilters);
  }
};
...

and then in both Subtitle set the right state

...
onClick={() => {
  if (selectAllEnabled) {
    updateFilters(true);
  }
}}
...

@blushi
Copy link
Member Author

blushi commented Feb 10, 2025

The implementation looks good, I'm approving these changes with just a couple of minor comments in the code. Also, as I've mentioned, I wonder if we really need all this additional logic for applying the filters after clicking 'Apply filters' on mobile.

The initial issue was about having an awkward UX because the filters were applied behind the modal and the users had to manually close the modal to be able to see the results. The current solution introduces more code to maintain, and users still need to click a button and wait for filters to apply, which they didn't have to before.

Would it make sense to reconsider if this extra complexity is necessary, or if we could achieve a similar UX with a simpler approach? For example, instead of the X (close button) we could have a single button bellow that changes its state from 'close' (if no filters have changed) to 'see projects' when filters are modified?

From what we had discussed with @erikalogie, she wanted the filters to be applied only after clicking the "apply filters" button, hence the need for storing an additional temporary state for the filters but open to update this if you think this adds too many clicks @erikalogie

@erikalogie
Copy link
Collaborator

The implementation looks good, I'm approving these changes with just a couple of minor comments in the code. Also, as I've mentioned, I wonder if we really need all this additional logic for applying the filters after clicking 'Apply filters' on mobile.
The initial issue was about having an awkward UX because the filters were applied behind the modal and the users had to manually close the modal to be able to see the results. The current solution introduces more code to maintain, and users still need to click a button and wait for filters to apply, which they didn't have to before.
Would it make sense to reconsider if this extra complexity is necessary, or if we could achieve a similar UX with a simpler approach? For example, instead of the X (close button) we could have a single button bellow that changes its state from 'close' (if no filters have changed) to 'see projects' when filters are modified?

From what we had discussed with @erikalogie, she wanted the filters to be applied only after clicking the "apply filters" button, hence the need for storing an additional temporary state for the filters but open to update this if you think this adds too many clicks @erikalogie

This implementation looks good to me, though I understand what Ralph is saying.

@r41ph
Copy link
Contributor

r41ph commented Feb 11, 2025

Both UX/UI and technical implementations look good. What I wonder is whether we need all the logic behind applying the filters at the end of the selection process (which is code that we'll need to maintain and that adds complexity) or if we could achieve the same UX improvements with minor UI changes, as I mentioned in my previous comment.

Arguably, applying filters immediately behind the modal, as we already do, is a better UX experience because users don’t have to wait when they click 'Apply Filters', as the results are already updated.

@blushi
Copy link
Member Author

blushi commented Feb 12, 2025

@erikalogie any thoughts?

@r41ph
Copy link
Contributor

r41ph commented Feb 12, 2025

Hey @erikalogie in a chat with @blushi she pointed out that one of the UI/UX requirements for this feature is that if a user selects a filter(s) and then clicks close, those filters should not be applied. I wasn't aware of that when I shared my thoughts about this feature. With this requirement in mind, my previous point may no longer be as relevant.

@erikalogie
Copy link
Collaborator

@r41ph ah ok, makes sense. Thanks for always thinking through this UX stuff and bringing up good ideas. Let's leave this as-is in this case.

@blushi blushi force-pushed the feat-APP-545-mobile-projects-filters branch from 47dcc58 to c86bfcf Compare February 13, 2025 09:04
@blushi blushi enabled auto-merge (squash) February 13, 2025 09:05
@blushi blushi merged commit 56601df into dev Feb 13, 2025
15 of 18 checks passed
@blushi blushi deleted the feat-APP-545-mobile-projects-filters branch February 13, 2025 09:07
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.

3 participants