Skip to content

Commit a387576

Browse files
committed
refactor: simplify ChatListItem props
1 parent 167ebd9 commit a387576

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

packages/frontend/src/components/chat/ChatListItem.tsx

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -405,40 +405,21 @@ type ChatListItemProps = {
405405
}
406406

407407
const ChatListItem = React.memo<ChatListItemProps>(props => {
408-
const { chatListItem, onClick, roleTab, onFocus } = props
408+
const { chatListItem } = props
409409

410410
// if not loaded by virtual list yet
411411
if (typeof chatListItem === 'undefined') return <PlaceholderChatListItem />
412412

413413
if (chatListItem.kind == 'ChatListItem') {
414-
return (
415-
<ChatListItemNormal
416-
chatListItem={chatListItem}
417-
onClick={onClick}
418-
roleTab={roleTab}
419-
onFocus={onFocus}
420-
isSelected={props.isSelected}
421-
onContextMenu={props.onContextMenu}
422-
isContextMenuActive={props.isContextMenuActive}
423-
/>
424-
)
414+
return <ChatListItemNormal {...props} chatListItem={chatListItem} />
425415
} else if (chatListItem.kind == 'Error') {
426-
return (
427-
<ChatListItemError
428-
chatListItem={chatListItem}
429-
onClick={onClick}
430-
roleTab={roleTab}
431-
onFocus={onFocus}
432-
isSelected={props.isSelected}
433-
onContextMenu={props.onContextMenu}
434-
/>
435-
)
416+
return <ChatListItemError {...props} chatListItem={chatListItem} />
436417
} else if (chatListItem.kind == 'ArchiveLink') {
437418
return (
438419
<ChatListItemArchiveLink
439420
chatListItem={chatListItem}
440-
onClick={onClick}
441-
onFocus={onFocus}
421+
onClick={props.onClick}
422+
onFocus={props.onFocus}
442423
/>
443424
)
444425
} else {

0 commit comments

Comments
 (0)