Skip to content

Conversation

ehconitin
Copy link
Contributor

closes #9904

@ehconitin ehconitin requested a review from charlesBochet May 30, 2025 11:52
Copy link
Contributor

github-actions bot commented May 30, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:35747

This environment will automatically shut down when the PR is closed or after 5 hours.

@ehconitin
Copy link
Contributor Author

@greptileai trigger

disabled: !canAccessFullAdminPanel,
},
{
id: SETTINGS_ADMIN_TABS.CHECK_1,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

temporary seeds

return <SettingsAdminConfigVariables />;
case SETTINGS_ADMIN_TABS.HEALTH_STATUS:
return <SettingsAdminHealthStatus />;
case SETTINGS_ADMIN_TABS.CHECK_1:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same

CHECK_5: 'check-5',
CHECK_6: 'check-6',
CHECK_7: 'check-7',
CHECK_8: 'check-8',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same

@Bonapara
Copy link
Member

Bonapara commented May 30, 2025

Thanks for sharing @ehconitin

Current

CleanShot 2025-05-30 at 17 01 34@2x

Desired

Can you gather the "More" tab with the other tabs?

CleanShot 2025-05-30 at 16 59 03@2x

Also can you correct the chevron down icon color, font-weight & spacing?

CleanShot 2025-05-30 at 17 00 19@2x

https://www.figma.com/design/xt8O9mFeLl46C5InWwoMrN/Twenty?node-id=54106-118010&t=bBF5G2XnvwPP16NG-11

@ehconitin
Copy link
Contributor Author

@greptileai trigger

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

Implements a new tab list feature replacing scrollable tabs with a '+X more' dropdown for overflow tabs, following the design specifications from Figma.

  • Remove test tabs (CHECK_1 through CHECK_8) from SettingsAdminTabs.ts and SettingsAdminTabContent.tsx as they appear to be temporary development artifacts
  • Consider adding accessibility attributes (aria-labels, roles) to TabMoreButton and TabListDropdown components for better screen reader support
  • Add error boundaries around the tab overflow detection logic in isFirstOverflowingTab.ts to handle edge cases when elements are null
  • Consider adding ResizeObserver to handle dynamic width changes in TabList component
  • Add unit tests for the overflow calculation logic to ensure consistent behavior across different screen sizes

13 file(s) reviewed, 12 comment(s)
Edit PR Review Bot Settings | Greptile

</StyledTab>
);
};
Tab.displayName = 'Tab';
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 we need to add this here? Is it because of the forwardRef?
Seems non standard to me but we can revisit if there is a good reason

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes forward ref! Not related to this PR.
pretty sure this was added just for clear debugging in devtools

resetFirstHiddenTabIndex,
]);

const handleTabSelectFromDropdown = useCallback(
Copy link
Member

Choose a reason for hiding this comment

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

then you start using callbacks because you have re-renders because of useEffects

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.

Hi @ehconitin, thanks for taking this one

I'm not a fan of the current approach which is relying on refs and effects and is not re-usable for similar problems in the code base.

A different approach:

  • re-introduce a component that will render the child component without displaying it (visibility: hidden) => this component will contains a useEffect indeed
  • render all the tabs within NodeDimension and onDimensionChange increment a counter (you'll likely need to store all tab size in an array and take the sum
  • you can also leverage onDimensionChange callback to get the width of the container in a state
  • then you can easily compute how many tabs you can fit in the container

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.

Looks way better, let's fix the comments and the tests :)

return visibleTabs.length;
}

const availableWidth = containerWidth - TAB_LIST_LEFT_PADDING;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@charlesBochet
what should I do here? This padding isn't the case everytime, it is being styled in the parent to add paddings.
we could pass in padding as a prop but its not standard!

Copy link
Member

Choose a reason for hiding this comment

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

Indeed! We could get the "insideContainerWidth" by rendering a width:100% div within the container and using NodeDimension in this case

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.

TY @ehconitin for completing this and taking all the feedbacks
I think we can merge it as it is. If you have time, there are still two areas we could improve:

  • simplify the containerWidth calculation: I'm not sure we need to render all the children, a width:100% should suffice (or anything that would take all the width)
  • take padding into account indeed, it seems that we have a bit more room on show page tabs

@charlesBochet charlesBochet merged commit 6f156a6 into twentyhq:main Jun 5, 2025
8 checks passed
@ehconitin
Copy link
Contributor Author

Will do!

@ehconitin ehconitin deleted the new-tab-list branch June 6, 2025 07:43
charlesBochet added a commit that referenced this pull request Jun 6, 2025
closes #9904

---------

Co-authored-by: Charles Bochet <[email protected]>
abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 10, 2025
closes twentyhq#9904

---------

Co-authored-by: Charles Bochet <[email protected]>
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.

Tab Bar "More" dropdown button
5 participants