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

Improve aggregate footer cell display #9124

Merged
merged 18 commits into from
Dec 19, 2024
Merged

Conversation

ijreilly
Copy link
Collaborator

No description provided.

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 improves aggregate value display in table footers and fixes related rendering issues across the application.

  • Replaced falsy checks with isDefined() in object-records-to-graphql-connection.helper.ts to properly handle zero values in aggregations
  • Added specialized formatting for different field types (percentage, decimals) in computeAggregateValueAndLabel.ts
  • Added new aggregateFooterCell scroll wrapper context in ScrollWrapperContexts.tsx for better footer cell behavior
  • Hardcoded UUID for 'No Value' column in mapViewGroupsToRecordGroupDefinitions.ts to prevent unnecessary re-renders
  • Standardized first column width using FIRST_TH_WIDTH constant across table components for consistency

14 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

text={value ? formatNumber(Number(value)) : '-'}
color={'transparent'}
/>
<Tag text={value ? value.toString() : '-'} color={'transparent'} />
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: removing formatNumber() means numbers won't be properly formatted (e.g. 1000000 will show as '1000000' instead of '1M' or '1,000,000'). Consider keeping number formatting for better readability

Comment on lines +51 to +52
} else if (!isDefined(aggregateValue)) {
value = '-';
Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider using null instead of '-' to maintain consistent typing across the codebase

Comment on lines +89 to +93
{isDefined(aggregateValue) ? (
<StyledValueContainer>
<StyledLabel>{aggregateLabel}</StyledLabel>
<StyledValue>{aggregateValue}</StyledValue>
</StyledValueContainer>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: StyledValueContainer's flex-grow behavior combined with flex: 1 0 0 might cause layout issues in narrow columns. Consider using flex: 1 1 auto instead to allow shrinking.

Comment on lines 89 to 93
<ScrollWrapper
contextProviderName="aggregateFooterCell"
componentInstanceId="AggregateFooterCellScrollWrapperContext"
defaultEnableYScroll={false}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Using the same componentInstanceId 'AggregateFooterCellScrollWrapperContext' for all footer cells could cause conflicts if multiple cells need independent scroll contexts

@@ -4,14 +4,15 @@ import { MOBILE_VIEWPORT } from 'twenty-ui';
import { TABLE_CELL_CHECKBOX_MIN_WIDTH } from '@/object-record/record-table/record-table-cell/components/RecordTableCellCheckbox';
import { TABLE_CELL_GRIP_WIDTH } from '@/object-record/record-table/record-table-cell/components/RecordTableCellGrip';
import { RecordTableFooterCell } from '@/object-record/record-table/record-table-footer/components/RecordTableFooterCell';
import { FIRST_TH_WIDTH } from '@/object-record/record-table/record-table-header/components/RecordTableHeader';
import { visibleTableColumnsComponentSelector } from '@/object-record/record-table/states/selectors/visibleTableColumnsComponentSelector';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';

const StyledTableFoot = styled.thead`
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: thead element is used for footer markup which is semantically incorrect

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

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

Tested locally, LGTM 👏! Left a few comments

@ijreilly ijreilly enabled auto-merge (squash) December 19, 2024 14:14
@ijreilly ijreilly merged commit ed56a68 into main Dec 19, 2024
22 checks passed
@ijreilly ijreilly deleted the fix-re-render-view-groups branch December 19, 2024 14:36
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.

4 participants