Hide unimplemented context menus (#299)

This commit is contained in:
Felicio Mununga 2022-07-19 12:51:52 +02:00 committed by GitHub
parent b57edc9921
commit e68ea9de5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 59 deletions

View File

@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import { ChatMenu } from '../../../../components/chat-menu' // import { ChatMenu } from '../../../../components/chat-menu'
import { ContextMenuTrigger } from '../../../../system' // import { ContextMenuTrigger } from '../../../../system'
import { SidebarItem } from '../sidebar-item' import { SidebarItem } from '../sidebar-item'
import type { SidebarItemProps } from '../sidebar-item' import type { SidebarItemProps } from '../sidebar-item'
@ -14,9 +14,9 @@ export const ChannelItem = (props: Props) => {
const { children, ...sidebarItemProps } = props const { children, ...sidebarItemProps } = props
return ( return (
<ContextMenuTrigger> // <ContextMenuTrigger>
<SidebarItem {...sidebarItemProps}>#{children}</SidebarItem> <SidebarItem {...sidebarItemProps}>#{children}</SidebarItem>
<ChatMenu type="context" /> // <ChatMenu type="context" />
</ContextMenuTrigger> // </ContextMenuTrigger>
) )
} }

View File

@ -12,8 +12,8 @@ import {
Avatar, Avatar,
Box, Box,
Button, Button,
ContextMenu, // ContextMenu,
ContextMenuTrigger, // ContextMenuTrigger,
// DropdownMenu, // DropdownMenu,
// DropdownMenuTrigger, // DropdownMenuTrigger,
// EmojiHash, // EmojiHash,
@ -171,20 +171,20 @@ export const ChatMessage = (props: Props) => {
return ( return (
<> <>
<ContextMenuTrigger> {/* <ContextMenuTrigger> */}
<Wrapper mention={mention} pinned={pinned} data-active={reacting}> <Wrapper mention={mention} pinned={pinned} data-active={reacting}>
{responseTo && <MessageReply messageId={responseTo} />} {responseTo && <MessageReply messageId={responseTo} />}
<Flex gap={2}> <Flex gap={2}>
<Box> <Box>
{/* <DropdownMenuTrigger> {/* <DropdownMenuTrigger>
<button type="button"> */} <button type="button"> */}
<Avatar <Avatar
size={44} size={44}
name={member!.username} name={member!.username}
colorHash={member!.colorHash} colorHash={member!.colorHash}
/> />
{/* </button> */} {/* </button> */}
{/* <DropdownMenu> {/* <DropdownMenu>
<Flex direction="column" align="center" gap="1"> <Flex direction="column" align="center" gap="1">
<Avatar size="36" /> <Avatar size="36" />
<Text>{member!.username}</Text> <Text>{member!.username}</Text>
@ -212,55 +212,52 @@ export const ChatMessage = (props: Props) => {
</DropdownMenu.Item> </DropdownMenu.Item>
</DropdownMenu> </DropdownMenu>
</DropdownMenuTrigger> */} </DropdownMenuTrigger> */}
</Box> </Box>
<Box css={{ flex: 1 }}> <Box css={{ flex: 1 }}>
{/* {pinned && ( {/* {pinned && (
<Flex gap={1}> <Flex gap={1}>
<PinIcon width={8} /> <PinIcon width={8} />
<Text size="13">Pinned by {contact.name}</Text> <Text size="13">Pinned by {contact.name}</Text>
</Flex> </Flex>
)} */} )} */}
<Flex gap="1" align="center"> <Flex gap="1" align="center">
<Text color="primary" weight="500" size="15"> <Text color="primary" weight="500" size="15">
{member!.username} {member!.username}
</Text> </Text>
<Text size="10" color="gray"> <Text size="10" color="gray">
{new Date(Number(clock)).toLocaleTimeString([], { {new Date(Number(clock)).toLocaleTimeString([], {
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit',
})} })}
</Text> </Text>
</Flex> </Flex>
{renderMessage()} {renderMessage()}
<MessageReactions <MessageReactions reactions={reactions} onClick={handleReaction} />
reactions={reactions} </Box>
onClick={handleReaction} </Flex>
/>
</Box>
</Flex>
<Actions <Actions
owner={owner} owner={owner}
pinned={pinned} pinned={pinned}
onEditClick={() => setEditing(true)} onEditClick={() => setEditing(true)}
onReplyClick={handleReplyClick} onReplyClick={handleReplyClick}
onPinClick={handlePinClick} onPinClick={handlePinClick}
onDeleteClick={handleMessageDelete} onDeleteClick={handleMessageDelete}
onReactionClick={handleReaction} onReactionClick={handleReaction}
reacting={reacting} reacting={reacting}
onReactingChange={setReacting} onReactingChange={setReacting}
reactions={reactions} reactions={reactions}
/> />
</Wrapper> </Wrapper>
<ContextMenu> {/* <ContextMenu>
<ContextMenu.Item onSelect={handleReplyClick}>Reply</ContextMenu.Item> <ContextMenu.Item onSelect={handleReplyClick}>Reply</ContextMenu.Item>
{/* <ContextMenu.Item onSelect={handlePinClick}>Pin</ContextMenu.Item> */} <ContextMenu.Item onSelect={handlePinClick}>Pin</ContextMenu.Item>
</ContextMenu> </ContextMenu> */}
</ContextMenuTrigger> {/* </ContextMenuTrigger> */}
</> </>
) )
} }