X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/cdad04a31b572aa401e3f5d1fdc2c0f69d6e2d08..c952afae1af2fb31b68be04f70bd7ae6f9d52aba:/src/views-components/details-panel/file-details.tsx

diff --git a/src/views-components/details-panel/file-details.tsx b/src/views-components/details-panel/file-details.tsx
index 86c63eb3..7b128c2c 100644
--- a/src/views-components/details-panel/file-details.tsx
+++ b/src/views-components/details-panel/file-details.tsx
@@ -2,10 +2,14 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import { DetailsData } from "./details-data";
-import { CollectionFile, CollectionDirectory } from '~/models/collection-file';
-import { getIcon } from '~/components/file-tree/file-tree-item';
+import { CollectionFile, CollectionDirectory, CollectionFileType } from 'models/collection-file';
+import { getIcon } from 'components/file-tree/file-tree-item';
+import { DetailsAttribute } from 'components/details-attribute/details-attribute';
+import { formatFileSize } from 'common/formatters';
+import { FileThumbnail } from 'components/file-tree/file-thumbnail';
+import isImage from 'is-image';
 
 export class FileDetails extends DetailsData<CollectionFile | CollectionDirectory> {
 
@@ -14,7 +18,18 @@ export class FileDetails extends DetailsData<CollectionFile | CollectionDirector
         return <Icon className={className} />;
     }
 
-    getDetails() {
-        return <div>File details</div>;
+    getDetails({showPreview}) {
+        const { item } = this;
+        return item.type === CollectionFileType.FILE
+            ? <>
+                <DetailsAttribute label='Size' value={formatFileSize(item.size)} />
+                {
+                    isImage(item.url) && showPreview && <>
+                        <DetailsAttribute label='Preview' />
+                        <FileThumbnail file={item} />
+                    </>
+                }
+            </>
+            : <div />;
     }
 }
