You've already forked focalboard
							
							
				mirror of
				https://github.com/mattermost/focalboard.git
				synced 2025-10-31 00:17:42 +02:00 
			
		
		
		
	* Updated go version * Generated mocks * lint fix * lint fix * lint fix * backported fileinfo limits * backported fileinfo limits * added tests * synced with main * Server lint fix * used a better name
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
 | |
| // See LICENSE.txt for license information.
 | |
| import React, {useCallback} from 'react'
 | |
| 
 | |
| import {FileInfo} from '../../../blocks/block'
 | |
| import BrokenFile from '../../../widgets/icons/brokenFile'
 | |
| import {Utils} from '../../../utils'
 | |
| 
 | |
| import './archivedFile.scss'
 | |
| 
 | |
| type Props = {
 | |
|     fileInfo: FileInfo
 | |
| }
 | |
| 
 | |
| const ArchivedFile = (props: Props): JSX.Element => {
 | |
|     const fileName = useCallback(() => props.fileInfo.name || 'untitled file', [props.fileInfo.name])
 | |
| 
 | |
|     const fileExtension = useCallback(() => {
 | |
|         let extension = props.fileInfo.extension
 | |
|         extension = extension?.startsWith('.') ? extension?.substring(1) : extension
 | |
|         return extension?.toUpperCase()
 | |
|     }, [props.fileInfo.extension])
 | |
| 
 | |
|     const fileSize = useCallback(() => Utils.humanFileSize(props.fileInfo.size || 0), [props.fileInfo.size])
 | |
| 
 | |
|     return (
 | |
|         <div className='ArchivedFile'>
 | |
|             <BrokenFile/>
 | |
|             <div className='fileMetadata'>
 | |
|                 <p className='filename'>{fileName()}</p>
 | |
|                 <p>{fileExtension()} {fileSize()}</p>
 | |
|             </div>
 | |
|         </div>
 | |
|     )
 | |
| }
 | |
| 
 | |
| export default ArchivedFile
 |