You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/components/menu/items/CopyCommunityUrl/CopyCommunityUrlMenuItem.tsx

25 lines
810 B
TypeScript

import { showCopyCommunityUrlMenuItem } from '.';
import { useIsPublic } from '../../../../hooks/useParamSelector';
import { copyPublicKeyByConvoId } from '../../../../interactions/conversationInteractions';
import { Localizer } from '../../../basic/Localizer';
import { ItemWithDataTestId } from '../MenuItemWithDataTestId';
export const CopyCommunityUrlMenuItem = ({ convoId }: { convoId: string }): JSX.Element | null => {
const isPublic = useIsPublic(convoId);
// we want to show the copyId for communities only
if (showCopyCommunityUrlMenuItem({ isPublic })) {
return (
<ItemWithDataTestId
onClick={() => {
void copyPublicKeyByConvoId(convoId);
}}
>
<Localizer token="communityUrlCopy" />
</ItemWithDataTestId>
);
}
return null;
};