Skip to content

Commit 0412f60

Browse files
committed
Feedback | click top copy id
1 parent e2b6390 commit 0412f60

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

src/components/common/Breadcrumbs.jsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React from 'react';
2+
import { useTranslation } from 'react-i18next'
3+
import Tooltip from '@mui/material/Tooltip'
24
import RepoIcon from '../repos/RepoIcon';
35
import ConceptIcon from '../concepts/ConceptIcon';
46
import MappingIcon from '../mappings/MappingIcon';
@@ -7,8 +9,10 @@ import RepoVersionButton from '../repos/RepoVersionButton'
79
import RepoTooltip from '../repos/RepoTooltip'
810
import Box from '@mui/material/Box';
911
import OwnerButton from './OwnerButton'
12+
import { copyToClipboard } from '../../common/utils'
1013

1114
const Breadcrumbs = ({owner, ownerType, repo, repoVersion, repoURL, concept, mapping, noIcons, color, fontSize, size, ownerURL, nested}) => {
15+
const { t } = useTranslation()
1216
const iconProps = {color: 'secondary', style: {marginRight: '8px', width: '0.8em'}}
1317
const hideParents = Boolean((concept?.id || mapping?.id) && nested)
1418
return (
@@ -91,15 +95,18 @@ const Breadcrumbs = ({owner, ownerType, repo, repoVersion, repoURL, concept, map
9195
color={concept.retired? 'error': 'primary'}
9296
/>
9397
}
94-
<span className='searchable' style={{
95-
maxWidth: hideParents ? 'calc(100% - 125px)' : '125px',
96-
overflow: 'hidden',
97-
textOverflow: 'ellipsis',
98-
fontSize: '14px',
99-
whiteSpace: 'nowrap',
100-
}}>
101-
{concept.id}
102-
</span>
98+
<Tooltip title={t('common.click_to_copy')}>
99+
<span className='searchable' style={{
100+
maxWidth: hideParents ? 'calc(100% - 125px)' : '125px',
101+
overflow: 'hidden',
102+
textOverflow: 'ellipsis',
103+
fontSize: '14px',
104+
whiteSpace: 'nowrap',
105+
cursor: 'copy'
106+
}} onClick={() => copyToClipboard(concept.id)}>
107+
{concept.id}
108+
</span>
109+
</Tooltip>
103110
</React.Fragment>
104111
}
105112
{
@@ -114,15 +121,18 @@ const Breadcrumbs = ({owner, ownerType, repo, repoVersion, repoURL, concept, map
114121
color={mapping.retired? 'error': 'primary'}
115122
/>
116123
}
124+
<Tooltip title={t('common.click_to_copy')}>
117125
<span className='searchable' style={{
118126
maxWidth: hideParents ? 'calc(100% - 125px)' : '125px',
119127
overflow: 'hidden',
120128
textOverflow: 'ellipsis',
121129
fontSize: '14px',
122130
whiteSpace: 'nowrap',
123-
}}>
131+
cursor: 'copy'
132+
}} onClick={() => copyToClipboard(mapping.id)}>
124133
{mapping.id}
125134
</span>
135+
</Tooltip>
126136
</React.Fragment>
127137
}
128138
</Box>

0 commit comments

Comments
 (0)