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 mobile table styling outside record table (#10407) #10663

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

Conversation

eliasylonen
Copy link
Contributor

@eliasylonen eliasylonen commented Mar 4, 2025

Fix to issue #10407 now including a fix to ChipFieldDisplay throwing an error outside a record table.

This works now, but refactoring is needed before merging.

@eliasylonen eliasylonen requested a review from lucasbordeau March 4, 2025 20:30
@eliasylonen eliasylonen self-assigned this Mar 4, 2025
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

This PR refactors mobile table styling by removing data-testid-based styles and introducing a new label visibility system for chip fields in mobile views.

  • Added new useIsChipFieldDisplayLabelHidden hook in /packages/twenty-front/src/modules/object-record/record-field/meta-types/display/hooks/useIsChipFieldDisplayLabelHidden.ts to manage label visibility based on mobile context
  • Removed mobile-specific styling from RecordTableBody that was using data-testid selectors
  • Added isLabelHidden prop propagation through ChipFieldDisplay -> RecordChip -> LinkAvatarChip -> Chip component chain
  • Modified RecordTableCellSoftFocusMode to hide first column button on mobile devices
  • Fixed ChipFieldDisplay error when used outside record table context with fallback instanceId

8 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile


const isRecordTableScrolledLeft = useRecoilComponentValueV2(
isRecordTableScrolledLeftComponentState,
instanceStateContext?.instanceId || 'EMPTY', // TODO: Ugly, find a better way to avoid throwing when instance state context is not found
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has to be changed before merging.

This EMPTY placeholder is here to make useAvailableComponentInstanceIdOrThrow inside useRecoilComponentValueV2 not throw if instance state context is not found.

One option could be to add a parameter like throwOnMissingInstanceStateContext to useRecoilComponentValueV2.

What do you think @lucasbordeau, would that be a good solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants