X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftechniques%2FDetail.js;h=376a391698d108addcae83a51bed98b7aac77488;hb=04af60ad0cd937639cf5e1a0a8d023d9c1eea152;hp=d586a9a159375e544d8b4f4bb0b04d8b3eb2299b;hpb=7e8555cfc96dcd364ca4fe9895e51af1bb04b546;p=alttp.git diff --git a/resources/js/components/techniques/Detail.js b/resources/js/components/techniques/Detail.js index d586a9a..376a391 100644 --- a/resources/js/components/techniques/Detail.js +++ b/resources/js/components/techniques/Detail.js @@ -1,28 +1,94 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { Container } from 'react-bootstrap'; +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 nl2br from '../../helpers/nl2br'; +import { + getRelations, + getTranslation, + hasRelations, + sorted, +} from '../../helpers/Technique'; +import i18n from '../../i18n'; -const Detail = ({ technique }) => -

{technique.title}

- -
- {technique.chapters ? technique.chapters.map(chapter => -
- {chapter.pivot.level ? - React.createElement(`h${chapter.pivot.level}`, {}, chapter.title) +const Detail = ({ actions, technique }) => { + const { t } = useTranslation(); + + return +
+

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

+ {technique && technique.rulesets ? + : null} -
-
- ) : 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) ? + + {nl2br(getTranslation(technique, 'attribution', i18n.language))} + + : null} +
; +}; Detail.propTypes = { + actions: PropTypes.shape({ + editContent: PropTypes.func, + }), technique: PropTypes.shape({ chapters: PropTypes.arrayOf(PropTypes.shape({ })), description: PropTypes.string, + rulesets: PropTypes.shape({ + }), title: PropTypes.string, }), };