1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { connect } from "react-redux";
6 import { RootState } from "../../../store/store";
7 import { FileViewerAction } from '~/views-components/context-menu/actions/file-viewer-action';
8 import { getNodeValue } from "~/models/tree";
9 import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
11 const mapStateToProps = (state: RootState) => {
12 const { resource } = state.contextMenu;
13 const currentCollectionUuid = state.collectionPanel.item ? state.collectionPanel.item.uuid : '';
15 resource.menuKind === ContextMenuKind.COLLECTION_FILES_ITEM ||
16 resource.menuKind === ContextMenuKind.READONLY_COLLECTION_FILES_ITEM)) {
17 const file = getNodeValue(resource.uuid)(state.collectionPanelFiles);
20 href: file.url.replace(state.auth.config.keepWebServiceUrl, state.auth.config.keepWebInlineServiceUrl),
29 export const CollectionFileViewerAction = connect(mapStateToProps)(FileViewerAction);