-
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
Kanban card creation revamp #7169
Conversation
@Bonapara work is still in progress but let me know your thoughts from product perspective. 2024-09-20.10-43-09.mp4 |
Hi @ehconitin, thanks! Could you use the floating input instead of placing the input within the card? |
@Bonapara will do! 2024-09-20.14-43-36.mp4 |
@ehconitin you're right. When creating an opportunity, the card name should be the company name. This only applies to cards on other kanbans where users must set a record name manually. |
2024-09-20.19-44-03.mp4 |
Great! Can you apply this design? I was also wondering if we can make the |
@Bonapara Ah nvm got it. |
Yup, on it! |
@Bonapara 2024-09-20.23-29-41.mp4 |
Should I address #7002 in this PR in a similar manner, or handle it separately? Let me know what works best! |
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 pull request implements a new feature for creating records directly on the Kanban board, addressing issue #6957. Here's a summary of the key changes:
- Added a new text input for creating records in the RecordBoardCard component
- Updated RecordBoardColumnCardsContainer, RecordBoardColumnHeader, and RecordBoardColumnNewButton to support the new card creation functionality
- Introduced new state management with recordBoardNewRecordByColumnIdComponentFamilyState and recordBoardNewRecordByColumnIdSelector
- Modified the useAddNewCard hook to handle creating a new card with a title and position
- Updated RecordIndexPageKanbanAddButton to support creating a record directly on the Kanban board without navigating to the record detail page
These changes align with the desired behavior described in the issue, allowing users to set a record name when creating a new card on the Kanban board, similar to the table view functionality.
8 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings
const handleCreate = (text: string) => { | ||
if (text.trim() !== '' && position !== undefined) { | ||
handleAddNewCardClick(text.trim(), position); | ||
setNewRecordName(''); | ||
onCreateSuccess?.(); | ||
} | ||
}; |
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: Add error handling for failed card creation
...enty-front/src/modules/object-record/record-board/record-board-column/hooks/useAddNewCard.ts
Outdated
Show resolved
Hide resolved
...enty-front/src/modules/object-record/record-board/record-board-column/hooks/useAddNewCard.ts
Outdated
Show resolved
Hide resolved
...enty-front/src/modules/object-record/record-board/record-board-column/hooks/useAddNewCard.ts
Outdated
Show resolved
Hide resolved
...ules/object-record/record-board/states/recordBoardNewRecordByColumnIdComponentFamilyState.ts
Outdated
Show resolved
Hide resolved
...ules/object-record/record-board/states/recordBoardNewRecordByColumnIdComponentFamilyState.ts
Outdated
Show resolved
Hide resolved
...ules/object-record/record-board/states/recordBoardNewRecordByColumnIdComponentFamilyState.ts
Show resolved
Hide resolved
...y-front/src/modules/object-record/record-index/components/RecordIndexPageKanbanAddButton.tsx
Outdated
Show resolved
Hide resolved
Label identifier issue fixed! 2024-09-24.17-03-50.mp4 |
...y-front/src/modules/object-record/record-index/components/RecordIndexPageKanbanAddButton.tsx
Outdated
Show resolved
Hide resolved
There is not floating input yet @ehconitin right? |
@Bonapara there was a floating input already but styles like box shadow were missing, fixed it! |
const { visibleFieldDefinitionsState } = useRecordBoardStates(); | ||
|
||
const visibleFieldDefinitions = useRecoilValue( | ||
visibleFieldDefinitionsState(), | ||
); | ||
const labelIdentifierField = visibleFieldDefinitions.find( | ||
(field) => field.isLabelIdentifier, | ||
); | ||
|
||
const newRecord = useRecoilValue( | ||
recordBoardNewRecordByColumnIdSelector({ | ||
familyKey: columnId, | ||
scopeId: columnId, | ||
}), | ||
); | ||
|
||
const { handleAddNewCardClick, handleCreateSuccess } = useAddNewCard(); | ||
|
||
const handleNewButtonClick = () => { | ||
handleAddNewCardClick( | ||
labelIdentifierField?.label ?? '', | ||
'', | ||
'last', | ||
columnId, | ||
); | ||
}; | ||
|
||
if (newRecord.isCreating && newRecord.position === 'last') { | ||
return ( | ||
<RecordBoardCard | ||
isCreating={true} | ||
onCreateSuccess={() => handleCreateSuccess('last')} | ||
position="last" | ||
/> | ||
); | ||
} | ||
|
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.
Seems like duplicate code with packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeader.tsx
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.
I will refactor them!
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.
@bosiraphael Done! I had to create a new hook due to a scoping issue, as it couldn't be kept within useAddNewCard
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.
LGTM :)
Thanks @ehconitin for your contribution! |
fixes #6957