2023-08-22 09:33:19 -04:00
|
|
|
import { useState, useCallback } from 'react'
|
2022-10-24 16:33:13 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2023-08-22 09:33:19 -04:00
|
|
|
import * as eventTracking from '../../../infrastructure/event-tracking'
|
2022-10-24 16:33:13 -04:00
|
|
|
import { useProjectContext } from '../../../shared/context/project-context'
|
|
|
|
import HotkeysModal from '../../hotkeys-modal/components/hotkeys-modal'
|
|
|
|
import LeftMenuButton from './left-menu-button'
|
|
|
|
|
|
|
|
export default function HelpShowHotkeys() {
|
|
|
|
const [showModal, setShowModal] = useState(false)
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { features } = useProjectContext()
|
|
|
|
const isMac = /Mac/.test(window.navigator?.platform)
|
|
|
|
|
2023-08-22 09:33:19 -04:00
|
|
|
const showModalWithAnalytics = useCallback(() => {
|
|
|
|
eventTracking.sendMB('left-menu-hotkeys')
|
|
|
|
setShowModal(true)
|
|
|
|
}, [])
|
|
|
|
|
2022-10-24 16:33:13 -04:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<LeftMenuButton
|
2023-08-22 09:33:19 -04:00
|
|
|
onClick={showModalWithAnalytics}
|
2022-10-24 16:33:13 -04:00
|
|
|
icon={{
|
|
|
|
type: 'keyboard-o',
|
|
|
|
fw: true,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{t('show_hotkeys')}
|
|
|
|
</LeftMenuButton>
|
|
|
|
<HotkeysModal
|
|
|
|
show={showModal}
|
|
|
|
handleHide={() => setShowModal(false)}
|
|
|
|
isMac={isMac}
|
|
|
|
trackChangesVisible={features?.trackChangesVisible}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|