X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/55c77cf6945551bbb2500c213be48db84315b445..fb10daa75864def53d1f0ffa7da3cece8cebe9d0:/src/components/file-tree/file-thumbnail.tsx diff --git a/src/components/file-tree/file-thumbnail.tsx b/src/components/file-tree/file-thumbnail.tsx index 8ab554a1..aeb8d68f 100644 --- a/src/components/file-tree/file-thumbnail.tsx +++ b/src/components/file-tree/file-thumbnail.tsx @@ -2,14 +2,16 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from "react"; +import React from "react"; import isImage from 'is-image'; import { withStyles, WithStyles } from '@material-ui/core'; -import { FileTreeData } from '~/components/file-tree/file-tree-data'; -import { CollectionFileType } from '~/models/collection-file'; -import { sanitizeToken } from "~/views-components/context-menu/actions/helpers"; +import { FileTreeData } from 'components/file-tree/file-tree-data'; +import { CollectionFileType } from 'models/collection-file'; +import { getInlineFileUrl, sanitizeToken } from "views-components/context-menu/actions/helpers"; +import { connect } from "react-redux"; +import { RootState } from "store/store"; -export interface FileThumbnailProps { +interface FileThumbnailProps { file: FileTreeData; } @@ -28,10 +30,20 @@ const imageFileThumbnailStyle = withStyles(theme => } })); -const ImageFileThumbnail = imageFileThumbnailStyle( - ({ classes, file }: WithStyles & FileThumbnailProps) => +interface ImageFileThumbnailProps { + keepWebServiceUrl: string; + keepWebInlineServiceUrl: string; +} + +const mapStateToProps = ({ auth }: RootState): ImageFileThumbnailProps => ({ + keepWebServiceUrl: auth.config.keepWebServiceUrl, + keepWebInlineServiceUrl: auth.config.keepWebInlineServiceUrl, +}); + +const ImageFileThumbnail = connect(mapStateToProps)(imageFileThumbnailStyle( + ({ classes, file, keepWebServiceUrl, keepWebInlineServiceUrl }: WithStyles & FileThumbnailProps & ImageFileThumbnailProps) => {file.name} -); + src={sanitizeToken(getInlineFileUrl(file.url, keepWebServiceUrl, keepWebInlineServiceUrl))} /> +));