X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/ec729054acd0b6208fbb4a290b32dffe6df7a0e3..798064c6616d98f8b6b3dfe562458bffe662f4ad:/src/views-components/main-app-bar/help-menu.tsx diff --git a/src/views-components/main-app-bar/help-menu.tsx b/src/views-components/main-app-bar/help-menu.tsx index 3980e569..af76e4f1 100644 --- a/src/views-components/main-app-bar/help-menu.tsx +++ b/src/views-components/main-app-bar/help-menu.tsx @@ -2,82 +2,82 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from "react"; +import React from "react"; import { MenuItem, Typography } from "@material-ui/core"; -import { DropdownMenu } from "~/components/dropdown-menu/dropdown-menu"; -import { HelpIcon } from "~/components/icon/icon"; -import { ArvadosTheme } from '~/common/custom-theme'; +import { DropdownMenu } from "components/dropdown-menu/dropdown-menu"; +import { ImportContactsIcon, HelpIcon } from "components/icon/icon"; +import { ArvadosTheme } from 'common/custom-theme'; import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'; +import { RootState } from "store/store"; +import { compose } from "redux"; +import { connect } from "react-redux"; type CssRules = 'link' | 'icon' | 'title' | 'linkTitle'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ link: { textDecoration: 'none', - color: 'inherit' + color: 'inherit', + width: '100%', + display: 'flex' }, icon: { width: '16px', height: '16px' }, title: { - marginLeft: theme.spacing.unit * 2, - marginBottom: theme.spacing.unit * 0.5, + paddingBottom: theme.spacing.unit * 0.5, + paddingLeft: theme.spacing.unit * 2, + paddingTop: theme.spacing.unit * 0.5, outline: 'none', }, linkTitle: { marginLeft: theme.spacing.unit - } + }, }); -enum helpMenuLinks { - PIPELINES_DATASETS = "https://dev.arvados.org/projects/arvados/wiki/Public_Pipelines_and_Datasets", - TUTORIALS = "http://doc.arvados.org/user/", - API_REFERENCE = "http://doc.arvados.org/api/", - SDK_REFERENCE = "http://doc.arvados.org/sdk/" -} - -enum helpMenuTitles { - PIPELINES_DATASETS = "Public Pipelines and Data sets", - TUTORIALS = "Tutorials and User guide", - API_REFERENCE = "API Reference", - SDK_REFERENCE = "SDK Reference" -} - const links = [ { - title: helpMenuTitles.PIPELINES_DATASETS, - link: helpMenuLinks.PIPELINES_DATASETS + title: "Tutorials and User guide", + link: "http://doc.arvados.org/user/", }, { - title: helpMenuTitles.TUTORIALS, - link: helpMenuLinks.TUTORIALS + title: "API Reference", + link: "http://doc.arvados.org/api/", }, { - title: helpMenuTitles.API_REFERENCE, - link: helpMenuLinks.API_REFERENCE - }, - { - title: helpMenuTitles.SDK_REFERENCE, - link: helpMenuLinks.SDK_REFERENCE + title: "SDK Reference", + link: "http://doc.arvados.org/sdk/" }, ]; -export const HelpMenu = withStyles(styles)( - ({ classes }: WithStyles) => - } - id="help-menu" - title="Help"> - Help - { - links.map(link => - - - - {link.title} - - ) - } - -); +interface HelpMenuProps { + currentRoute: string; +} + +const mapStateToProps = ({ router }: RootState) => ({ + currentRoute: router.location ? router.location.pathname : '', +}); + +export const HelpMenu = compose( + connect(mapStateToProps), + withStyles(styles))( + ({ classes, currentRoute }: HelpMenuProps & WithStyles) => + } + id="help-menu" + title="Help" + key={currentRoute}> + Help + { + links.map(link => + + + + {link.title} + + + ) + } + + );