Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 690/add copywebid desktop contacts #692

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading