Skip to content

Commit

Permalink
"Name" column is visible on table view but not on kanban view (#6427)
Browse files Browse the repository at this point in the history
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](#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 <[email protected]>
  • Loading branch information
gitstart-app[bot] and gitstart-twenty authored Jul 27, 2024
1 parent 368f142 commit 3ff2465
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ export const RecordBoardCard = () => {
return null;
}

const visibleFieldDefinitionsFiltered = visibleFieldDefinitions.filter(
(boardField) => !boardField.isLabelIdentifier,
);

return (
<StyledBoardCardWrapper onContextMenu={handleContextMenu}>
<RecordValueSetterEffect recordId={recordId} />
Expand Down Expand Up @@ -252,7 +256,7 @@ export const RecordBoardCard = () => {
isOpen={!isCardInCompactMode || !isCompactModeActive}
initial={false}
>
{visibleFieldDefinitions.map((fieldDefinition) => (
{visibleFieldDefinitionsFiltered.map((fieldDefinition) => (
<PreventSelectOnClickContainer
key={fieldDefinition.fieldMetadataId}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export type RecordBoardFieldDefinition<T extends FieldMetadata> =
viewFieldId?: string;
position: number;
isVisible?: boolean;
isLabelIdentifier?: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,17 @@ export const RecordIndexContainer = ({

setTableColumns(newFieldDefinitions);

const newRecordIndexFieldDefinitions = newFieldDefinitions.filter(
(boardField) => !boardField.isLabelIdentifier,
);

const existingRecordIndexFieldDefinitions = snapshot
.getLoadable(recordIndexFieldDefinitionsState)
.getValue();

if (
!isDeeplyEqual(
existingRecordIndexFieldDefinitions,
newRecordIndexFieldDefinitions,
newFieldDefinitions,
)
) {
set(recordIndexFieldDefinitionsState, newRecordIndexFieldDefinitions);
set(recordIndexFieldDefinitionsState, newFieldDefinitions);
}
},
[columnDefinitions, setTableColumns],
Expand Down

0 comments on commit 3ff2465

Please sign in to comment.