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

feat: add FilterList to TreeDetails page #4

Merged
merged 6 commits into from
Jul 23, 2024
Merged

Conversation

lfjnascimento
Copy link
Collaborator

Visual reference

image

@lfjnascimento lfjnascimento requested a review from mari1912 July 23, 2024 15:27
@lfjnascimento lfjnascimento self-assigned this Jul 23, 2024
Copy link
Collaborator

@mari1912 mari1912 left a comment

Choose a reason for hiding this comment

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

It is working ok, but I noticed some things that could be improved:

  • An error happens if i open the filters model, select one and close the modal without filtering it, when i open it again and select other filter it will add the both of them, even though the first one is not selected
  • hover clean all state is too light, we cannot read the text
  • about status filter: true or false doesn't make sense
  • we should check what this refresh button is suppose to do, I don't think this should be there right now

@@ -92,7 +92,7 @@ const FilterList = ({
[itens, onClickItem],
);

if (removeOnEmpty && !itens) {
if (removeOnEmpty && !itens.length) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: items

Comment on lines +73 to +83
if (newFilter[filterField]) {
newFilter[filterField][value] = isSelected;
} else {
newFilter[filterField] = {
[value]: isSelected,
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

your call, but what about using ternary operator?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I prefer to use ternary only in expressions

Comment on lines 169 to 170
const treeUrl =
'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git';
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should not be a const, it should change according to the tree you are in

@@ -15,9 +15,14 @@ export interface ITabItem {
export interface ITabsComponent {
tabs: ITabItem[];
defaultTab: ITabItem;
FilterListElement?: JSX.Element;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: filterListElement

@@ -48,6 +53,8 @@ const TabsComponent = ({ defaultTab, tabs }: ITabsComponent): JSX.Element => {
return (
<Tabs defaultValue={defaultTab.name} className="w-full">
<TabsList className="w-full justify-start">{tabsTrigger}</TabsList>
<div className="py-6">{FilterListElement}</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure it is worth it for us to pass the whole element instead of a list with the filters and call the necessary ui here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In terms of processing, it's basically the same thing, we are passing a "reference" in both situations, but we gain more flexibility by passing an element here

@lfjnascimento lfjnascimento force-pushed the fix/filter_ branch 2 times, most recently from 4719c71 to 63e4ca3 Compare July 23, 2024 20:04
- make onClickItemHandler pass the value to onClickItem
- fix typo itens
- fix color on hover on cleanAll button
-  make the TreeDetails page own the filter instead of TreeDetailsFilter so
we can pass the filter to other components like FilterList
@lfjnascimento lfjnascimento merged commit 777bc55 into main Jul 23, 2024
4 checks passed
@lfjnascimento lfjnascimento deleted the fix/filter_ branch September 17, 2024 12:02
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.

2 participants