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'
|
2024-10-11 05:22:38 -04:00
|
|
|
import { bsVersionIcon } from '@/features/utils/bootstrap-5'
|
2022-10-24 16:33:13 -04:00
|
|
|
|
|
|
|
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}
|
2024-10-11 05:22:38 -04:00
|
|
|
icon={bsVersionIcon({
|
|
|
|
bs5: { type: 'keyboard' },
|
|
|
|
bs3: { type: 'keyboard-o', fw: true },
|
|
|
|
})}
|
2022-10-24 16:33:13 -04:00
|
|
|
>
|
|
|
|
{t('show_hotkeys')}
|
|
|
|
</LeftMenuButton>
|
|
|
|
<HotkeysModal
|
|
|
|
show={showModal}
|
|
|
|
handleHide={() => setShowModal(false)}
|
|
|
|
isMac={isMac}
|
|
|
|
trackChangesVisible={features?.trackChangesVisible}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|