"Name" column is visible on table view but not on kanban view (#6427)

This PR was created by [GitStart](https://gitstart.com/) to address the
requirements from this ticket:
[TWNTY-4238](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-4238).
This ticket was imported from:
[TWNTY-4238](https://github.com/twentyhq/twenty/issues/4238)

 --- 

## Description

- We moved the filter from RecordIndexContainer to RecordBoardCard, this
change will fix the fix issue that the name column was not visible in
Kanban view and will keep the behavior in the Kanban card. The options
dropdown uses the same state that the card uses, but the name is
rendered on the card because, for the name field, the card uses another
data because the render of the name is different from the render of the
other fields, so we removed the filter in the state, but we need to
filter only in the card to avoid duplicated data, we could not find any
other case that this filter is useful for another component
- We updated the type in RecordBoardFieldDefinition to fix TS error in
RecordBoardCard file

### Demo

<https://jam.dev/c/7c9db8e1-9b53-49cf-a44c-0b0fec5b1988>

### Refs

- #4238

Fixes #4238

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
This commit is contained in:
gitstart-app[bot] 2024-07-27 11:58:51 +02:00 committed by GitHub
parent 368f142f3a
commit 3ff24658e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 7 deletions

View File

@ -210,6 +210,10 @@ export const RecordBoardCard = () => {
return null;
}
const visibleFieldDefinitionsFiltered = visibleFieldDefinitions.filter(
(boardField) => !boardField.isLabelIdentifier,
);
return (
<StyledBoardCardWrapper onContextMenu={handleContextMenu}>
<RecordValueSetterEffect recordId={recordId} />
@ -252,7 +256,7 @@ export const RecordBoardCard = () => {
isOpen={!isCardInCompactMode || !isCompactModeActive}
initial={false}
>
{visibleFieldDefinitions.map((fieldDefinition) => (
{visibleFieldDefinitionsFiltered.map((fieldDefinition) => (
<PreventSelectOnClickContainer
key={fieldDefinition.fieldMetadataId}
>

View File

@ -6,4 +6,5 @@ export type RecordBoardFieldDefinition<T extends FieldMetadata> =
viewFieldId?: string;
position: number;
isVisible?: boolean;
isLabelIdentifier?: boolean;
};

View File

@ -93,10 +93,6 @@ export const RecordIndexContainer = ({
setTableColumns(newFieldDefinitions);
const newRecordIndexFieldDefinitions = newFieldDefinitions.filter(
(boardField) => !boardField.isLabelIdentifier,
);
const existingRecordIndexFieldDefinitions = snapshot
.getLoadable(recordIndexFieldDefinitionsState)
.getValue();
@ -104,10 +100,10 @@ export const RecordIndexContainer = ({
if (
!isDeeplyEqual(
existingRecordIndexFieldDefinitions,
newRecordIndexFieldDefinitions,
newFieldDefinitions,
)
) {
set(recordIndexFieldDefinitionsState, newRecordIndexFieldDefinitions);
set(recordIndexFieldDefinitionsState, newFieldDefinitions);
}
},
[columnDefinitions, setTableColumns],