11import React from 'react'
2- import { Typography , Avatar , Checkbox , Icon } from 'antd'
2+ import { Typography , Avatar , Checkbox } from 'antd'
33import styled from 'styled-components/macro'
44import PropTypes from 'prop-types'
55import GTCRAddress from './gtcr-address'
@@ -9,6 +9,7 @@ import { ZERO_ADDRESS } from '../utils/string'
99import RichAddress from './rich-address'
1010import ETHAddress from './eth-address'
1111import LongText from './long-text'
12+ import FileDisplay from './file-display'
1213
1314const pohRichAddress = 'eip155:1:0xc5e9ddebb09cd64dfacab4011a0d5cedaf7c9bdb'
1415
@@ -37,32 +38,7 @@ const DisplaySelector = ({ type, value, linkImage, allowedFileTypes }) => {
3738 case ItemTypes . LONG_TEXT :
3839 return < LongText value = { value } />
3940 case ItemTypes . FILE : {
40- if ( ! value )
41- return (
42- < a target = "_blank" rel = "noopener noreferrer" href = "/#" >
43- View File < Icon type = "paper-clip" />
44- </ a >
45- )
46-
47- if ( ! allowedFileTypes ) return 'No allowed file types specified'
48-
49- const allowedFileTypesArr = allowedFileTypes . split ( ' ' )
50- if ( allowedFileTypesArr . length === 0 )
51- return 'No allowed file types specified'
52-
53- const fileExtension = value . slice ( value . lastIndexOf ( '.' ) + 1 )
54- if ( ! allowedFileTypesArr . includes ( fileExtension ) )
55- return 'Forbidden file type'
56-
57- return (
58- < a
59- href = { `${ process . env . REACT_APP_IPFS_GATEWAY } ${ value || '' } ` }
60- target = "_blank"
61- rel = "noopener noreferrer"
62- >
63- View File < Icon type = "paper-clip" />
64- </ a >
65- )
41+ return < FileDisplay value = { value } allowedFileTypes = { allowedFileTypes } />
6642 }
6743 case ItemTypes . IMAGE :
6844 return value ? (
0 commit comments