-
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
Improve aggregate footer cell display #9124
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 improves aggregate value display in table footers and fixes related rendering issues across the application.
- Replaced falsy checks with
isDefined()
inobject-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 inScrollWrapperContexts.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'} /> |
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: 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
} else if (!isDefined(aggregateValue)) { | ||
value = '-'; |
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: consider using null instead of '-' to maintain consistent typing across the codebase
{isDefined(aggregateValue) ? ( | ||
<StyledValueContainer> | ||
<StyledLabel>{aggregateLabel}</StyledLabel> | ||
<StyledValue>{aggregateValue}</StyledValue> | ||
</StyledValueContainer> |
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: 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.
<ScrollWrapper | ||
contextProviderName="aggregateFooterCell" | ||
componentInstanceId="AggregateFooterCellScrollWrapperContext" | ||
defaultEnableYScroll={false} | ||
> |
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: 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` |
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: thead element is used for footer markup which is semantically incorrect
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.
Tested locally, LGTM 👏! Left a few comments
No description provided.