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

Fix 4363 modify kanban menu #5337

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

kiridarivaki
Copy link

Changes:

  • Changed -/+ to eye and eye off icons
  • Changed menu width to 200px
  • Created separate menu for hidden fields
  • Added Edit Fields option to hidden fields menu
  • Added test file MenuItemSelectTag (wasn't included in the issue)

As this is my first pr, feedback is very welcome!
Note:
These changes cover most of #4363 . Should i make a separate pr for the implementation of "Disabled" state?

Copy link

github-actions bot commented May 8, 2024

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by 🚫 dangerJS against 9276261

@kiridarivaki kiridarivaki marked this pull request as ready for review May 9, 2024 09:11
@FelixMalfait
Copy link
Member

FelixMalfait commented May 14, 2024

@kiridarivaki This is great work for a first PR :) ! Thank you!

Could you please check the view switcher? I think it had a negative impact there

The rest looks good

Screenshot 2024-05-14 at 09 50 39

Would be great to tackle the "disabled" state in a separate PR yes!

@kiridarivaki
Copy link
Author

@FelixMalfait Thank you for noticing! Will work on it now:)

@kiridarivaki
Copy link
Author

@FelixMalfait sorry for bothering you with this, but locally, with my implemented changes, i can't see the problematic menu item in the view switcher:

Screenshot 2024-05-14 182126

@FelixMalfait
Copy link
Member

@kiridarivaki can you try adding a view?

@kiridarivaki
Copy link
Author

@FelixMalfait oh sorry you meant the misplacement of the pencil icon is the issue? Now i see it, thanks!

@FelixMalfait
Copy link
Member

@kiridarivaki yes exactly :)

@@ -158,6 +158,7 @@ export const RecordIndexOptionsDropdownContent = ({
onClick={() => handleSelectMenu('hiddenFields')}
LeftIcon={IconEyeOff}
RightIcon={IconChevronRight}
hasRightIcon={true}
Copy link
Member

Choose a reason for hiding this comment

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

why do you introduce this and not look at RightIcon directly?

Copy link
Author

Choose a reason for hiding this comment

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

i used hasRightIcon in line 73, because it caused a weird movement when hovering over the right icon, as i show in the video

Untitled.video.-.Made.with.Clipchamp.mp4

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! what I ment was hasRightIcon seems synonymous of !isUndefinedOrNull(RightIcon) no? maybe I'm missing something. But it doesn't seem like a clean component api if you can have rightIcon=XXX and hasRightIcon=false (contradiction)

<StyledMenuItemRightContent>
<MenuItemLeftContent LeftIcon={RightIcon ?? undefined} text={''} />
{hasRightIcon && (
<MenuItemLeftContent LeftIcon={RightIcon ?? undefined} />
Copy link
Member

Choose a reason for hiding this comment

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

LeftIcon={RightIcon} ? Feels off :)
Let's try to maintain a clean/beautiful/understandable API for all of our components
They should be usable as a standalone library, not built for a specific concept

Thanks 🙏

Copy link
Author

Choose a reason for hiding this comment

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

Oh yes, I wanted to ask you about it, as I saw that there is a MenuItemLeftContent but not a MenuItemRightContent. Should I create MenuItemRightContent? I though that adding a RightIcon prop to the MenuItemLeftContent isn't a good practice either. What is preferable? I'm sorry for the mediocre code quality, trying my best as I'm still learning :)

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the figma, what we externally want is a MenuItem that can optionally take a LeftIcon, a grip, a RightIcon (with hoverable behavior). This is our goal.

I actually think having this internally MenuItemLeftContent is a mistake and should not exist (I see it's already used as if it was an external component). I would say we should not introduce a MenuItemRightContent and do something similar as in packages/twenty-front/src/modules/ui/navigation/menu-item/components/MenuItemSelect.tsx to display the right Icon for now.

Bonus: If you feel confortable, I would advocate to move back the code of MenuItemLeftContent into MenuItem, and update MenuItemLeftContent usage by MenuItem usage.

Copy link
Author

Choose a reason for hiding this comment

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

@charlesBochet check Discord :)

@@ -14,7 +14,7 @@ type MenuItemLeftContentProps = {
className?: string;
LeftIcon: IconComponent | null | undefined;
showGrip?: boolean;
text: string;
text?: string;
Copy link
Member

Choose a reason for hiding this comment

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

What does it mean to have a MenuItem without content?

Copy link
Author

Choose a reason for hiding this comment

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

Should i make the text equal to an empty string? I thought text was not needed when creating the right content of the menu item as it's only an icon (line 70 in MenuItem.tsx)

Copy link
Member

Choose a reason for hiding this comment

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

see MenuItemSelect.tsx to see how to add a Right icon and implement it in MenuItem direclty. Do not MenuItemLeftContent

@FelixMalfait
Copy link
Member

Thanks for the updates! I see there's a small conflict with main, could you also please merge the most recent version of main? Hopefully we can merge that soon after the small fixes :)

@kiridarivaki
Copy link
Author

@FelixMalfait @charlesBochet Thank you for the feedback! I'll try my best to do these fixes and improve :)

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.

None yet

3 participants