// @flow import React from 'react'; import LoadingScreen from 'component/common/loading-screen'; import PdfViewer from 'component/viewers/pdfViewer'; import ThreeViewer from 'component/viewers/threeViewer'; import DocumentViewer from 'component/viewers/documentViewer'; type Props = { mediaType: string, source: { filePath: string, fileType: string, downloadPath: string, }, currentTheme: string, }; class FileRender extends React.PureComponent { renderViewer() { const { source, mediaType, currentTheme } = this.props; const viewerProps = { source, theme: currentTheme }; // Supported mediaTypes const mediaTypes = { '3D-file': , document: , // Add routes to viewer... }; // Supported fileType const fileTypes = { pdf: , // Add routes to viewer... }; const { fileType } = source; const viewer = mediaType && source && (mediaTypes[mediaType] || fileTypes[fileType]); const unsupportedMessage = __("Sorry, looks like we can't preview this file."); const unsupported = ; // Return viewer return viewer || unsupported; } render() { return
{this.renderViewer()}
; } } export default FileRender;