diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index c29b9d71..4da096c2 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -18,6 +18,8 @@ import { selectConversationId } from '../preferences/preferenceSlice'; import { ActiveState } from '../models/misc'; import { ShareConversationModal } from '../modals/ShareConversationModal'; import { useTranslation } from 'react-i18next'; +import ContextMenu from '../components/ContextMenu'; +import { MenuOption } from '../components/ContextMenu'; interface ConversationProps { name: string; @@ -128,6 +130,39 @@ export default function ConversationTile({ } }; + const menuOptions: MenuOption[] = [ + { + icon: Share, + label: t('convTile.share'), + onClick: (event: SyntheticEvent) => { + event.stopPropagation(); + setShareModalState(true); + setOpen(false); + }, + variant: 'primary', + iconWidth: 14, + iconHeight: 14, + }, + { + icon: Edit, + label: t('convTile.rename'), + onClick: handleEditConversation, + variant: 'primary', + }, + { + icon: Trash, + label: t('convTile.delete'), + onClick: (event: SyntheticEvent) => { + event.stopPropagation(); + setDeleteModalState('ACTIVE'); + setOpen(false); + }, + iconWidth: 18, + iconHeight: 18, + variant: 'danger', + }, + ]; + return ( <>
@@ -160,13 +195,13 @@ export default function ConversationTile({ onKeyDown={handleRenameKeyDown} /> ) : ( -

+

{conversationName}

)}
{(conversationId === conversation.id || isHovered || isOpen) && ( -
+
{isEdit ? (
)} - {isOpen && ( -
- - - -
- )} +
)}