Skip to content

Commit bfc8900

Browse files
committed
feat(web): open-images-and-files-in-info-tabs-in-file-viewer
1 parent 49eb981 commit bfc8900

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

web/src/components/InformationCards/RegistryInformationCard/TopInfo.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { isUndefined } from "src/utils";
1111
import { DEFAULT_LIST_LOGO } from "src/consts";
1212
import { getIpfsUrl } from "utils/getIpfsUrl";
1313
import { shortenAddress } from "utils/shortenAddress";
14+
import { Link } from "react-router-dom";
1415

1516
const TopInfoContainer = styled.div`
1617
display: flex;
@@ -122,12 +123,14 @@ const TopInfo: React.FC<ITopInfo> = ({
122123
{isUndefined(logoURI) ? (
123124
<SkeletonLogo />
124125
) : (
125-
<StyledLogo
126-
src={imageSrc}
127-
onError={() => setImageSrc(getIpfsUrl(DEFAULT_LIST_LOGO))}
128-
alt="List Img"
129-
isListView={false}
130-
/>
126+
<Link to={`/attachment/?url=${imageSrc}`}>
127+
<StyledLogo
128+
src={imageSrc}
129+
onError={() => setImageSrc(getIpfsUrl(DEFAULT_LIST_LOGO))}
130+
alt="List Img"
131+
isListView={false}
132+
/>
133+
</Link>
131134
)}
132135
{isUndefined(title) ? <SkeletonTitle /> : <StyledTitle>{title}</StyledTitle>}
133136
</LogoAndTitle>

web/src/components/ItemCard/ItemField/FileField.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from "react";
2+
import { Link } from "react-router-dom";
23
import styled from "styled-components";
34
import PDFIcon from "svgs/icons/pdf.svg";
45
import { getIpfsUrl } from "utils/getIpfsUrl";
56

6-
const Container = styled.a`
7+
const Container = styled(Link)`
78
display: flex;
89
gap: 8px;
910
`;
@@ -17,7 +18,7 @@ export interface IFileField {
1718
const FileField: React.FC<IFileField> = ({ value, label }) => {
1819
const fileUrl = getIpfsUrl(value);
1920
return (
20-
<Container href={fileUrl} onClick={(event) => event.stopPropagation()} target="blank" rel="noreferrer">
21+
<Container to={`/attachment/?url=${fileUrl}`} onClick={(event) => event.stopPropagation()}>
2122
<PDFIcon />
2223
{label}
2324
</Container>

web/src/components/ItemCard/ItemField/ImageField.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react";
2+
import { Link } from "react-router-dom";
23
import styled from "styled-components";
34
import { getIpfsUrl } from "utils/getIpfsUrl";
45

@@ -15,7 +16,11 @@ export interface IImageField {
1516

1617
const ImageField: React.FC<IImageField> = ({ value, detailed }) => {
1718
const imgUrl = getIpfsUrl(value);
18-
return <StyledImg src={imgUrl} {...{ detailed }} />;
19+
return (
20+
<Link to={`/attachment/?url=${imgUrl}`}>
21+
<StyledImg src={imgUrl} {...{ detailed }} />
22+
</Link>
23+
);
1924
};
2025

2126
export default ImageField;

0 commit comments

Comments
 (0)