From c0ece818cbd20667deb8a2f4b44184835e21b8e9 Mon Sep 17 00:00:00 2001 From: Alexandre G Pereira Date: Sun, 18 Aug 2024 12:26:28 -0300 Subject: [PATCH] Change monster form image order (#326) --- .../registration/ui/MonsterRegistrationForm.kt | 4 ++-- .../registration/ui/form/MonsterHeaderForm.kt | 2 +- .../monster/registration/MonsterRegistrationState.kt | 2 +- .../registration/MonsterRegistrationStrings.kt | 6 +++--- .../monster/registration/mapper/MonsterMapper.kt | 2 +- .../monster/registration/mapper/StateMapper.kt | 12 ++++++------ 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/feature/monster-registration/compose/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/ui/MonsterRegistrationForm.kt b/feature/monster-registration/compose/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/ui/MonsterRegistrationForm.kt index c21fb0e7..e9a3ab2a 100644 --- a/feature/monster-registration/compose/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/ui/MonsterRegistrationForm.kt +++ b/feature/monster-registration/compose/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/ui/MonsterRegistrationForm.kt @@ -115,12 +115,12 @@ private fun MonsterRegistrationForm( bottom = contentPadding.calculateBottomPadding() + 16.dp, ), ) { - MonsterHeaderForm( + MonsterImageForm( keys = monster.keys, infoState = monster.info, onMonsterChanged = { intent.onMonsterChanged(monster.copy(info = it)) }, ) - MonsterImageForm( + MonsterHeaderForm( keys = monster.keys, infoState = monster.info, onMonsterChanged = { intent.onMonsterChanged(monster.copy(info = it)) }, diff --git a/feature/monster-registration/compose/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/ui/form/MonsterHeaderForm.kt b/feature/monster-registration/compose/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/ui/form/MonsterHeaderForm.kt index 93935193..f7c57a8e 100644 --- a/feature/monster-registration/compose/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/ui/form/MonsterHeaderForm.kt +++ b/feature/monster-registration/compose/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/ui/form/MonsterHeaderForm.kt @@ -15,7 +15,7 @@ internal fun LazyListScope.MonsterHeaderForm( ) { FormLazy( titleKey = keys.next(), - title = { strings.edit } + title = { strings.header } ) { formItem(key = keys.next()) { AppTextField( diff --git a/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/MonsterRegistrationState.kt b/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/MonsterRegistrationState.kt index 23d7fe70..4d8ee877 100644 --- a/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/MonsterRegistrationState.kt +++ b/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/MonsterRegistrationState.kt @@ -192,8 +192,8 @@ data class SpellPreviewState( ) internal enum class SectionTitle { - Header, Image, + Header, Stats, Speed, AbilityScores, diff --git a/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/MonsterRegistrationStrings.kt b/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/MonsterRegistrationStrings.kt index 22f3afeb..09a38103 100644 --- a/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/MonsterRegistrationStrings.kt +++ b/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/MonsterRegistrationStrings.kt @@ -60,7 +60,7 @@ interface MonsterRegistrationStrings { val damageType: String val damageDice: String val conditionType: String - val edit: String + val header: String val group: String val imageUrl: String val type: String @@ -174,7 +174,7 @@ internal data class MonsterRegistrationEnStrings( override val damageType: String = "Damage Type", override val damageDice: String = "Damage Dice", override val conditionType: String = "Condition Type", - override val edit: String = "Edit", + override val header: String = "Header", override val group: String = "Group", override val imageUrl: String = "Image Url", override val type: String = "Type", @@ -288,7 +288,7 @@ internal data class MonsterRegistrationPtStrings( override val damageType: String = "Tipo de Dano", override val damageDice: String = "Dados de Dano", override val conditionType: String = "Tipo de Condição", - override val edit: String = "Editar", + override val header: String = "Cabeçalho", override val group: String = "Grupo", override val imageUrl: String = "Url da Imagem", override val type: String = "Tipo", diff --git a/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/mapper/MonsterMapper.kt b/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/mapper/MonsterMapper.kt index a43d507a..8f16bf6e 100644 --- a/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/mapper/MonsterMapper.kt +++ b/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/mapper/MonsterMapper.kt @@ -52,7 +52,7 @@ internal fun Monster.editBy( return monster.copy( name = state.info.name, subtitle = state.info.subtitle, - group = state.info.group, + group = state.info.group.takeUnless { it.isBlank() }, challengeRatingData = monster.challengeRatingData.copy( valueInString = state.info.challengeRating, ), diff --git a/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/mapper/StateMapper.kt b/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/mapper/StateMapper.kt index a63f2202..bbf3cc82 100644 --- a/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/mapper/StateMapper.kt +++ b/feature/monster-registration/state-holder/src/commonMain/kotlin/br/alexandregpereira/hunter/monster/registration/mapper/StateMapper.kt @@ -320,7 +320,7 @@ private fun SpellcastingType.name(strings: MonsterRegistrationStrings): String { internal fun SectionTitle.name(strings: MonsterRegistrationStrings): String { return when (this) { - SectionTitle.Header -> strings.edit + SectionTitle.Header -> strings.header SectionTitle.Image -> strings.imageFormTitle SectionTitle.Stats -> strings.stats SectionTitle.Speed -> strings.speed @@ -344,17 +344,17 @@ internal fun SectionTitle.name(strings: MonsterRegistrationStrings): String { private fun MonsterState.createKeys(): List { val monster = this return buildList { + add(SectionTitle.Image.name) + add("monsterHeader-image") + add("monsterHeader-image-url") + add("monsterHeader-image-color-light") + add("monsterHeader-image-color-dark") add(SectionTitle.Header.name) add("monsterHeader-name") add("monsterHeader-subtitle") add("monsterHeader-group") add("monsterHeader-challengeRating") add("monsterHeader-type") - add(SectionTitle.Image.name) - add("monsterHeader-image") - add("monsterHeader-image-url") - add("monsterHeader-image-color-light") - add("monsterHeader-image-color-dark") add(SectionTitle.Stats.name) add("stats-armorClass") add("stats-hitPoints")