Skip to content

Commit 514e7b2

Browse files
authored
[ENGAGE-91] Changed image URL to open in new tab instead of copy link (bcgov#107)
1 parent 1f909d0 commit 514e7b2

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

met-web/src/components/ImageManagement/ImageListing/ImageListing.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ import { ImageContext } from './ImageContext';
44
import { HeaderTitle, MetPageGridContainer, MetParagraph, PrimaryButton } from 'components/common';
55
import ImageUpload from '../../ImageManagement/ImageUpload';
66
import { IconButton, Stack, TextField } from '@mui/material';
7-
import SearchIcon from '@mui/icons-material/Search';
7+
import { Search as SearchIcon, OpenInNew as OpenInNewIcon } from '@mui/icons-material';
88
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
99
import MetTable from 'components/common/Table';
1010
import { HeadCell, PaginationOptions } from 'components/common/Table/types';
1111
import { ImageInfo } from 'models/image';
12-
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
1312
import { Else, If, Then } from 'react-if';
14-
import { openNotification } from 'services/notificationService/notificationSlice';
15-
import { useAppDispatch } from 'hooks';
1613
import { formatDate } from 'utils/helpers/dateHelper';
1714

1815
const ImageListing = () => {
@@ -30,13 +27,6 @@ const ImageListing = () => {
3027
imageToUpload,
3128
} = useContext(ImageContext);
3229

33-
const dispatch = useAppDispatch();
34-
35-
const copyToClipBoard = (text: string) => {
36-
navigator.clipboard.writeText(text);
37-
dispatch(openNotification({ severity: 'success', text: 'URL copied to clipboard' }));
38-
};
39-
4030
const headCells: HeadCell<ImageInfo>[] = [
4131
{
4232
key: 'url',
@@ -89,8 +79,13 @@ const ImageListing = () => {
8979
<Grid container direction={'row'} gap={1} alignItems={'center'}>
9080
<Grid item>{row.url}</Grid>
9181
<Grid item>
92-
<IconButton onClick={() => copyToClipBoard(row.url)}>
93-
<ContentCopyIcon />
82+
<IconButton
83+
component="a"
84+
href={imageToDisplay?.url ?? ''}
85+
target="_blank"
86+
rel="noopener noreferrer"
87+
>
88+
<OpenInNewIcon />
9489
</IconButton>
9590
</Grid>
9691
</Grid>
@@ -161,8 +156,13 @@ const ImageListing = () => {
161156
sx={{ height: 100 }}
162157
>
163158
<MetParagraph>{imageToDisplay?.url}</MetParagraph>
164-
<IconButton onClick={() => copyToClipBoard(imageToDisplay?.url ?? '')}>
165-
<ContentCopyIcon />
159+
<IconButton
160+
component="a"
161+
href={imageToDisplay?.url ?? ''}
162+
target="_blank"
163+
rel="noopener noreferrer"
164+
>
165+
<OpenInNewIcon />
166166
</IconButton>
167167
</Stack>
168168
</Grid>

0 commit comments

Comments
 (0)