-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
add: related object name to favorite in navigation drawer #8659
add: related object name to favorite in navigation drawer #8659
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR adds object type labels to favorites in the navigation drawer, displaying the related object name (e.g. "Company", "Person") next to each favorite item with a bullet point separator.
Key changes:
- Added
objectName
prop toNavigationDrawerItem
with styled container showing "· ObjectName" format - Implemented hover behavior to hide object name when hovering favorite items
- Added
StyledItemObjectName
component with proper styling and text capitalization - Passed
objectNameSingular
from favorite objects through to navigation components - Fixed display formatting with proper spacing and text overflow handling
4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
...twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
Outdated
Show resolved
Hide resolved
.navigation-drawer-item:hover & { | ||
display: none; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Hiding content on hover may cause accessibility issues for keyboard/screen reader users
</NavigationDrawerAnimatedCollapseWrapper> | ||
{objectName ? ( | ||
<StyledItemObjectName> | ||
{' · '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Non-breaking space should be used instead of regular space for better typography
@Bonapara this looks cool, could you review the behavior!? |
@harshrajeevsingh could you make sure only favorite's label is being truncated and not all of the navigation drawer item. |
@ehconitin Oh! I missed that part. I will make changes soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice code, one comment though
{objectName ? ( | ||
<StyledItemObjectName> | ||
{' · '} | ||
{objectName.charAt(0).toUpperCase() + objectName.slice(1)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use capitalize
from packages/twenty-front/src/utils/string/capitalize.ts
<NavigationDrawerAnimatedCollapseWrapper> | ||
<StyledItemLabel>{label}</StyledItemLabel> | ||
</NavigationDrawerAnimatedCollapseWrapper> | ||
<StyledLabelParent> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is the <NavigationDrawerAnimatedCollapseWrapper
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need it for collapse animation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martmull That's the issue. Using NavigationDrawerAnimatedCollapseWrapper
won't let the text truncate for any item because a width constraint is needed for the parent element to make it work.
Also, you can find StyledRightOptionsContainer
having margin-left: auto
, but it doesn't work due to the NavigationDrawerAnimatedCollapseWrapper
, we can see it working due to the StyledSpacer
.
I will see how I can make changes to the NavigationDrawerAnimatedCollapseWrapper
to make flex property work.
${({ hasObjectName }) => | ||
hasObjectName && | ||
` | ||
max-width: 12ch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think we should avoid exotic css properties like this one
Closes: #8549
Screencast.from.2024-11-22.00-35-00.webm