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: Replace styled logo with Avatar component for workspace logo in NavigationDrawerHeader #9093

Merged
merged 10 commits into from
Dec 17, 2024

Conversation

muraliSingh7
Copy link
Contributor

This PR addresses issue #9042

  • Replaced the styled logo with the Avatar component.
  • Avatar now handles the case when no logo is uploaded by using the workspace name's first character as the placeholder.
  • This ensures a consistent fallback when the logo is undefined.

muraliSingh7 and others added 6 commits December 1, 2024 03:55
Changed the padding-left for the chip component when the variant is Transparent.
The padding-left is now set to 2px to ensure proper alignment, while other variants
continue to use the default horizontal padding.
- Increased padding-left for table cells from 6px to 8px for uniform spacing.
- Set padding to 0px for Chip component in transparent mode to prevent it from affecting cell padding and ensure consistent 8px left padding across all cells.
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Replaced the styled logo with Avatar component in NavigationDrawerHeader to provide consistent workspace logo display with fallback placeholder functionality.

  • Implemented Avatar component in /packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx using workspace name's first character as placeholder
  • Removed StyledLogo component and isNonEmptyString check for cleaner implementation
  • Added proper fallback handling when logo URL is invalid or undefined

💡 (3/5) Reply to the bot's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

Thanks @muraliSingh7. While testing your PR, I figured out that the multi-workspace case was not taken into consideration. I have replaced by Avatar component in multiworkspace dropdown too

<StyledLogo
logo={isNonEmptyString(logo) ? logo : DEFAULT_WORKSPACE_LOGO}
/>
<Avatar placeholder={name} avatarUrl={logo} />
Copy link
Member

Choose a reason for hiding this comment

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

no need to do name.charAt(0) here as the Avatar is already doing it internally

@@ -16,7 +17,7 @@ export const PageFavicon = () => {
getImageAbsoluteURI({
imageUrl: workspacePublicData.logo,
baseUrl: REACT_APP_SERVER_BASE_URL,
}) ?? ''
}) ?? DEFAULT_WORKSPACE_LOGO
Copy link
Member

Choose a reason for hiding this comment

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

@Bonapara FYI, I'm also making sure we have a Favicon (we cannot use the first letter trick here as the logo needs to be a png)

@charlesBochet charlesBochet merged commit fb8d193 into twentyhq:main Dec 17, 2024
9 checks passed
Copy link

Thanks @muraliSingh7 for your contribution!
This marks your 2nd PR on the repo. You're top 14% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

charlesBochet pushed a commit that referenced this pull request Dec 18, 2024
- Fixed icon shrinking on tabs. The introduction of EllipsisDisplay
takes 100% of the width, thus shrinking the icons.
- Removed scroll wrapper tablist. This was removed in #9016 but
reintroduced in #9089. This reintroduction made the dark border below
the active tab disappear.
- Used Avatar for icon and logo rendering following the changes made in
#9093
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.

4 participants