import { observer } from "mobx-react" ; import * as React from "react" ; import { DataStore } from "../../core/stores/DataStore" ; import { CoreHelper } from "../../core/utils/CoreHelper" ; import { Text } from "../components/text/Text" ; import { LocaleKey , LocaleParams } from "../locales" ; export abstract class UIHelper { static formatMessage < TLocaleKey extends LocaleKey > ( messageId , variables = undefined , defaultMessage = undefined , parseLineBreaks = false ) { const { currentLocale } = DataStore . getInstance ( ) ; return CoreHelper . formatMessage ( messageId as any , variables , defaultMessage , parseLineBreaks ) ; } static renderMarkdown ( value ) { return value . split ( "**" ) . map ( ( t , i ) => i % 2 === 0 ? ( t ) : ( < Text key = { i } style = { { fontFamily : "SourceSansPro-Bold" } } > { t } < /Text>)); } static renderObserverComponent < T > ( Component ) { const ObserverComponent = observer ( Component ) ; return ( props ) => < ObserverComponent { ... props } / > ; } static get isStorybook ( ) : boolean { return process . env . IS_STORYBOOK === "true" ; } }