From ec9630bfd4eb9fc1c207ff20dad7b36029b56190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Ma=C5=A1a?= Date: Wed, 2 Nov 2022 14:34:12 +0100 Subject: [PATCH] Process Markdown from all compendium items in Character UI --- .../character/religion/blessings/BlessingDetail.kt | 6 +++++- .../common/character/religion/miracles/MiracleDetail.kt | 6 +++++- .../common/character/skills/dialog/SkillDetail.kt | 9 +++++---- .../common/character/spells/dialog/SpellDetail.kt | 9 +++++---- .../common/character/talents/dialog/TalentDetail.kt | 6 ++++-- .../wfrp_master/common/character/traits/TraitDetail.kt | 7 ++++++- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/religion/blessings/BlessingDetail.kt b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/religion/blessings/BlessingDetail.kt index bdd68bf2f..5dfa2b2b0 100644 --- a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/religion/blessings/BlessingDetail.kt +++ b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/religion/blessings/BlessingDetail.kt @@ -10,6 +10,8 @@ import androidx.compose.material.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import com.halilibo.richtext.markdown.Markdown +import com.halilibo.richtext.ui.RichText import cz.frantisekmasa.wfrp_master.common.core.domain.religion.Blessing import cz.frantisekmasa.wfrp_master.common.core.ui.buttons.CloseButton import cz.frantisekmasa.wfrp_master.common.core.ui.primitives.Spacing @@ -39,7 +41,9 @@ fun BlessingDetail( SingleLineTextValue(strings.labelTarget, blessing.target) SingleLineTextValue(strings.labelDuration, blessing.duration) - Text(blessing.effect, Modifier.padding(top = 8.dp)) + RichText(Modifier.padding(top = 8.dp)) { + Markdown(blessing.effect) + } } } } diff --git a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/religion/miracles/MiracleDetail.kt b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/religion/miracles/MiracleDetail.kt index 8b00bdc42..b59f6a189 100644 --- a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/religion/miracles/MiracleDetail.kt +++ b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/religion/miracles/MiracleDetail.kt @@ -14,6 +14,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import com.halilibo.richtext.markdown.Markdown +import com.halilibo.richtext.ui.RichText import cz.frantisekmasa.wfrp_master.common.core.domain.religion.Miracle import cz.frantisekmasa.wfrp_master.common.core.ui.buttons.CloseButton import cz.frantisekmasa.wfrp_master.common.core.ui.primitives.Spacing @@ -54,7 +56,9 @@ fun MiracleDetail( SingleLineTextValue(strings.labelTarget, miracle.target) SingleLineTextValue(strings.labelDuration, miracle.duration) - Text(miracle.effect, Modifier.padding(top = 8.dp)) + RichText(Modifier.padding(top = 8.dp)) { + Markdown(miracle.effect) + } } } } diff --git a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/skills/dialog/SkillDetail.kt b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/skills/dialog/SkillDetail.kt index 60a0a6bf5..07d48399d 100644 --- a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/skills/dialog/SkillDetail.kt +++ b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/skills/dialog/SkillDetail.kt @@ -10,6 +10,8 @@ import androidx.compose.material.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import com.halilibo.richtext.markdown.Markdown +import com.halilibo.richtext.ui.RichText import cz.frantisekmasa.wfrp_master.common.core.domain.localizedName import cz.frantisekmasa.wfrp_master.common.core.domain.skills.Skill import cz.frantisekmasa.wfrp_master.common.core.ui.buttons.CloseButton @@ -47,10 +49,9 @@ fun SkillDetail( value = strings.commonUi.boolean(skill.advanced), ) - Text( - text = skill.description, - modifier = Modifier.padding(top = 8.dp), - ) + RichText(Modifier.padding(top = 8.dp)) { + Markdown(skill.description) + } } } } diff --git a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/spells/dialog/SpellDetail.kt b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/spells/dialog/SpellDetail.kt index a39efd6e6..13fbbb659 100644 --- a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/spells/dialog/SpellDetail.kt +++ b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/spells/dialog/SpellDetail.kt @@ -14,6 +14,8 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp +import com.halilibo.richtext.markdown.Markdown +import com.halilibo.richtext.ui.RichText import cz.frantisekmasa.wfrp_master.common.core.domain.spells.Spell import cz.frantisekmasa.wfrp_master.common.core.ui.buttons.CloseButton import cz.frantisekmasa.wfrp_master.common.core.ui.primitives.Spacing @@ -63,10 +65,9 @@ fun SpellDetail( SingleLineTextValue(strings.labelDuration, spell.duration) - Text( - text = spell.effect, - modifier = Modifier.padding(top = 8.dp), - ) + RichText(Modifier.padding(top = 8.dp)) { + Markdown(spell.effect) + } } } } diff --git a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/talents/dialog/TalentDetail.kt b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/talents/dialog/TalentDetail.kt index 8393b3dbf..6632f753d 100644 --- a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/talents/dialog/TalentDetail.kt +++ b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/talents/dialog/TalentDetail.kt @@ -9,6 +9,8 @@ import androidx.compose.material.Text import androidx.compose.material.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import com.halilibo.richtext.markdown.Markdown +import com.halilibo.richtext.ui.RichText import cz.frantisekmasa.wfrp_master.common.core.domain.talents.Talent import cz.frantisekmasa.wfrp_master.common.core.ui.buttons.CloseButton import cz.frantisekmasa.wfrp_master.common.core.ui.primitives.Spacing @@ -30,8 +32,8 @@ fun TalentDetail( Column(Modifier.verticalScroll(rememberScrollState())) { subheadBar() - Column(Modifier.padding(Spacing.bodyPadding)) { - Text(talent.description) + RichText(Modifier.padding(Spacing.bodyPadding)) { + Markdown(talent.description) } } } diff --git a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/traits/TraitDetail.kt b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/traits/TraitDetail.kt index 89b17dd13..f94a71d1d 100644 --- a/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/traits/TraitDetail.kt +++ b/common/src/commonMain/kotlin/cz/frantisekmasa/wfrp_master/common/character/traits/TraitDetail.kt @@ -11,6 +11,9 @@ import androidx.compose.material.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.halilibo.richtext.markdown.Markdown +import com.halilibo.richtext.ui.RichText import cz.frantisekmasa.wfrp_master.common.core.domain.traits.Trait import cz.frantisekmasa.wfrp_master.common.core.ui.buttons.CloseButton import cz.frantisekmasa.wfrp_master.common.core.ui.primitives.Spacing @@ -32,7 +35,9 @@ fun TraitDetail( ) { Column(Modifier.verticalScroll(rememberScrollState())) { Column(Modifier.padding(Spacing.bodyPadding)) { - Text(trait.description) + RichText(Modifier.padding(top = 8.dp)) { + Markdown(trait.description) + } } } }