/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ // @flow import React, { Component } from "react"; import { connect } from "../utils/connect"; import actions from "../actions"; import { getPaneCollapse } from "../selectors"; import { formatKeyShortcut } from "../utils/text"; import type { ActiveSearchType } from "../reducers/ui"; import "./WelcomeBox.css"; type Props = { horizontal: boolean, endPanelCollapsed: boolean, togglePaneCollapse: Function, setActiveSearch: (?ActiveSearchType) => any, openQuickOpen: typeof actions.openQuickOpen, toggleShortcutsModal: () => void }; export class WelcomeBox extends Component { render() { const searchSourcesShortcut = formatKeyShortcut( L10N.getStr("sources.search.key2") ); const searchProjectShortcut = formatKeyShortcut( L10N.getStr("projectTextSearch.key") ); const allShortcutsShortcut = formatKeyShortcut( L10N.getStr("allShortcut.key") ); const allShortcutsLabel = L10N.getStr("welcome.allShortcuts"); const searchSourcesLabel = L10N.getStr("welcome.search2").substring(2); const searchProjectLabel = L10N.getStr("welcome.findInFiles2").substring(2); const { setActiveSearch, openQuickOpen, toggleShortcutsModal } = this.props; return (

openQuickOpen()} > {searchSourcesShortcut} {searchSourcesLabel}

{searchProjectShortcut} {searchProjectLabel}

toggleShortcutsModal()} > {allShortcutsShortcut} {allShortcutsLabel}

); } } const mapStateToProps = state => ({ endPanelCollapsed: getPaneCollapse(state, "end") }); export default connect( mapStateToProps, { togglePaneCollapse: actions.togglePaneCollapse, setActiveSearch: actions.setActiveSearch, openQuickOpen: actions.openQuickOpen } )(WelcomeBox);