X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftechniques%2FDetail.js;h=8d5136dfc523c09e05efacfb99114b0912df2b07;hb=7c6716036321ba09846785720e81459aad55a323;hp=9d9534ed31f2d6831f883fa2ce043975e90958e7;hpb=9aca4f1a99af65dc988d2f66e122e25456a4efd9;p=alttp.git diff --git a/resources/js/components/techniques/Detail.js b/resources/js/components/techniques/Detail.js index 9d9534e..8d5136d 100644 --- a/resources/js/components/techniques/Detail.js +++ b/resources/js/components/techniques/Detail.js @@ -1,12 +1,13 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { Alert, Container } from 'react-bootstrap'; -import { withTranslation } from 'react-i18next'; +import { Alert, Button, Container } from 'react-bootstrap'; +import { useTranslation } from 'react-i18next'; import List from './List'; import Outline from './Outline'; import Requirements from './Requirements'; import Rulesets from './Rulesets'; +import Icon from '../common/Icon'; import RawHTML from '../common/RawHTML'; import { getRelations, @@ -16,40 +17,71 @@ import { } from '../../helpers/Technique'; import i18n from '../../i18n'; -const Detail = ({ technique }) => -
-

{getTranslation(technique, 'title', i18n.language)}

- {technique && technique.rulesets ? - - : null} -
- - - - {technique.chapters ? technique.chapters.map(chapter => -
- {chapter.pivot.level ? - React.createElement( - `h${chapter.pivot.level}`, - {}, - getTranslation(chapter, 'title', i18n.language), - ) +const Detail = ({ actions, technique }) => { + const { t } = useTranslation(); + + return +
+

+ {getTranslation(technique, 'title', i18n.language)} + {actions.editContent ? + + : null} +

+ {technique && technique.rulesets ? + : null} - -
- ) : null} - {hasRelations(technique, 'related') ? <> -

{i18n.t('techniques.seeAlso')}

- - : null} - {getTranslation(technique, 'attribution', i18n.language) ? - - - - : null} -
; + + + + + {technique.chapters ? technique.chapters.map(chapter => +
+ {chapter.pivot.level ? + React.createElement( + `h${chapter.pivot.level}`, + {}, + getTranslation(chapter, 'title', i18n.language), + actions.editContent ? + + : null, + ) + : null} + +
+ ) : null} + {hasRelations(technique, 'related') ? <> +

{i18n.t('techniques.seeAlso')}

+ + : null} + {getTranslation(technique, 'attribution', i18n.language) ? + + + + : null} + ; +}; Detail.propTypes = { + actions: PropTypes.shape({ + editContent: PropTypes.func, + }), technique: PropTypes.shape({ chapters: PropTypes.arrayOf(PropTypes.shape({ })), @@ -60,4 +92,4 @@ Detail.propTypes = { }), }; -export default withTranslation()(Detail); +export default Detail;