settings-dictionary.tsx 884 B

12345678910111213141516171819202122232425262728293031
  1. import { useState } from 'react'
  2. import { Button } from 'react-bootstrap'
  3. import { useTranslation } from 'react-i18next'
  4. import getMeta from '../../../../utils/meta'
  5. import DictionaryModal from '../../../dictionary/components/dictionary-modal'
  6. export default function SettingsDictionary() {
  7. const { t } = useTranslation()
  8. const [showModal, setShowModal] = useState(false)
  9. const dictionaryEditorEnabled = getMeta(
  10. 'ol-dictionaryEditorEnabled'
  11. ) as boolean
  12. if (!dictionaryEditorEnabled) {
  13. return null
  14. }
  15. return (
  16. <div className="form-group left-menu-setting">
  17. <label htmlFor="dictionary">{t('dictionary')}</label>
  18. <Button bsSize="xs" bsStyle="default" onClick={() => setShowModal(true)}>
  19. {t('edit')}
  20. </Button>
  21. <DictionaryModal
  22. show={showModal}
  23. handleHide={() => setShowModal(false)}
  24. />
  25. </div>
  26. )
  27. }