Skip to content

Commit

Permalink
Merge pull request #692 from codeforpdx/issue-690/add-copywebid-deskt…
Browse files Browse the repository at this point in the history
…op-contacts

Issue 690/add copywebid desktop contacts
  • Loading branch information
andycwilliams authored Nov 19, 2024
2 parents a5263d5 + ef5ac78 commit 7c38bda
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
17 changes: 16 additions & 1 deletion src/components/Contacts/ContactListTableDesktop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from 'react';
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
import EditOutlined from '@mui/icons-material/EditOutlined';
import SendIcon from '@mui/icons-material/Send';
import Typography from '@mui/material/Typography';
import { useTheme } from '@mui/material/styles';
import {
DataGrid,
Expand All @@ -12,6 +13,10 @@ import {
GridToolbarFilterButton,
GridToolbarDensitySelector
} from '@mui/x-data-grid';
// Custom Hooks Imports
import useNotification from '@hooks/useNotification';
// Util Imports
import { saveToClipboard } from '@utils';
// Component Imports
import ContactProfileIcon from './ContactProfileIcon';

Expand Down Expand Up @@ -49,6 +54,7 @@ const ContactListTableDesktop = ({
handleSendMessage,
'data-testid': dataTestId
}) => {
const { addNotification } = useNotification();
const theme = useTheme();

const columnTitlesArray = [
Expand All @@ -68,6 +74,15 @@ const ContactListTableDesktop = ({
},
{
field: 'webId',
renderCell: (contact) => (
<Typography
noWrap
sx={{ cursor: 'pointer', fontSize: '0.875rem' }}
onClick={() => saveToClipboard(contact.id, 'webId copied to clipboard', addNotification)}
>
{contact.id}
</Typography>
),
headerName: 'Web ID',
minWidth: 150,
flex: 1,
Expand Down Expand Up @@ -101,7 +116,7 @@ const ContactListTableDesktop = ({
field: 'Edit',
renderCell: (contact) => (
<EditOutlined
sx={{ color: 'gray', cursor: 'pointer' }}
sx={{ color: '#808080', cursor: 'pointer' }}
onClick={() => editContact(contact.row.Profile)}
/>
),
Expand Down
27 changes: 12 additions & 15 deletions src/components/Contacts/ContactListTableMobile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ const ContactListTableMobile = ({
'aria-labelledby': 'actions-icon-button'
}}
>
<MenuItem
component={Button}
onClick={handleMenuItemClick(
() =>
saveToClipboard(contact.webId, 'webId copied to clipboard', addNotification),
contact
)}
startIcon={<ContentCopyIcon sx={iconSize} />}
sx={iconStyling}
>
Copy WebId
</MenuItem>
<MenuItem
component={Button}
onClick={handleMenuItemClick(handleProfileClick, contact)}
Expand All @@ -209,21 +221,6 @@ const ContactListTableMobile = ({
>
Message
</MenuItem>
{/* TODO: Keep copy function? */}
{/* If so, also add to Desktop table? */}
{/* Maybe without any icon. Simply click on the web ID and it will copy? */}
<MenuItem
component={Button}
onClick={handleMenuItemClick(
() =>
saveToClipboard(contact.webId, 'webId copied to clipboard', addNotification),
contact
)}
startIcon={<ContentCopyIcon sx={iconSize} />}
sx={iconStyling}
>
Copy WebId
</MenuItem>
<MenuItem
component={Button}
onClick={handleMenuItemClick(editContact, contact)}
Expand Down
1 change: 0 additions & 1 deletion src/pages/Contacts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ const Contacts = () => {
}}
IconComponent={KeyboardArrowDownIcon}
>
{' '}
<MenuItem value="Sort by:" disabled>
Sort by:
</MenuItem>
Expand Down

0 comments on commit 7c38bda

Please sign in to comment.