Merge branch '17595-Selecting-multiple-collections-as-inputs-to-a-workflow'
[arvados.git] / src / views-components / context-menu / actions / file-viewer-actions.tsx
index b2ce556f891989b3f2c48fb9795bde089d699615..961e182860c77d9db5542bec33f31ee28e0d6bbc 100644 (file)
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { ListItemText, ListItem, ListItemIcon } from "@material-ui/core";
+import { ListItemText, ListItem, ListItemIcon, Icon } from "@material-ui/core";
 import { RootState } from '~/store/store';
 import { getNodeValue } from '~/models/tree';
 import { CollectionDirectory, CollectionFile, CollectionFileType } from '~/models/collection-file';
@@ -56,20 +56,26 @@ export const FileViewerActions = connect(mapStateToProps)(
     ({ fileUrl, viewers, onClick }: FileViewerActionProps & { onClick: () => void }) =>
         <>
             {viewers.map(viewer =>
-                <a
+                <ListItem
+                    button
+                    component='a'
                     key={viewer.name}
                     style={{ textDecoration: 'none' }}
                     href={fillViewerUrl(fileUrl, viewer)}
                     onClick={onClick}
                     target='_blank'>
-                    <ListItem button>
-                        <ListItemIcon>
-                            <OpenIcon />
-                        </ListItemIcon>
-                        <ListItemText>
-                            {viewer.name}
-                        </ListItemText>
-                    </ListItem>
-                </a>
+                    <ListItemIcon>
+                        {
+                            viewer.iconUrl
+                                ? <Icon>
+                                    <img src={viewer.iconUrl} />
+                                </Icon>
+                                : <OpenIcon />
+                        }
+                    </ListItemIcon>
+                    <ListItemText>
+                        {viewer.name}
+                    </ListItemText>
+                </ListItem>
             )}
         </>);