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

[WEB-1176] chore: filter dropdown indicator and code refactor #4379

Merged
merged 5 commits into from
May 7, 2024

Conversation

anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented May 6, 2024

Changes:

This PR includes following changes:

  • Applied filter indicator added to filter select dropdown.
  • Code refactor.

Issue link: [WEB-1176]

Media:

Before After
before after

Copy link
Collaborator

@SatishGandham SatishGandham left a comment

Choose a reason for hiding this comment

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

Please follow the dry principle, and move the common code to a utility function.

@@ -61,6 +62,13 @@ export const ArchivedCyclesHeader: FC = observer(() => {
}
};

const appliedFilters: TCycleFilters = {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we are not using applied filters for display purposes and only dependent on the boolean value, can you bailout early as soon as you come across a filter.

const hasFilters = objectHasValues(currentProjectArchivedFilters ?? {})

// Put this in a utilities file
objectHasValues = (obj)=>{
	// run the for loop here.
}

@@ -26,6 +27,24 @@ export const calculateTotalFilters = (filters: TFilters): number =>
.reduce((curr, prev) => curr + prev, 0)
: 0;

/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can use the existing function above using typescript generics. Please create an issue for that and we will track it as a separate change.

@SatishGandham SatishGandham merged commit 2aef40b into preview May 7, 2024
11 of 12 checks passed
@SatishGandham SatishGandham deleted the chore/filter-select-dropdown-improvement branch May 7, 2024 09:26
@sriramveeraghanta sriramveeraghanta added this to the v0.20-dev milestone May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants