feat: add reputation scores display (Closes #12) #68

Merged
shahondin1624 merged 1 commits from feature/issue-12-reputation-display into main 2026-03-13 14:02:51 +01:00
3 changed files with 73 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ object TestTags {
const val PANEL_RESOURCES = "panel_resources" const val PANEL_RESOURCES = "panel_resources"
const val PANEL_DERIVED_ATTRIBUTES = "panel_derived_attributes" const val PANEL_DERIVED_ATTRIBUTES = "panel_derived_attributes"
const val PANEL_DAMAGE_MONITOR = "panel_damage_monitor" const val PANEL_DAMAGE_MONITOR = "panel_damage_monitor"
const val PANEL_REPUTATION = "panel_reputation"
// --- Navigation items --- // --- Navigation items ---
const val NAV_CHARACTER_SHEET = "nav_character_sheet" const val NAV_CHARACTER_SHEET = "nav_character_sheet"

View File

@@ -180,6 +180,7 @@ private fun OverviewContent(
CharacterHeader(character.characterData, onEdit = onEditCharacterData) CharacterHeader(character.characterData, onEdit = onEditCharacterData)
ResourcePanel(character.characterData, character.attributes.edge) ResourcePanel(character.characterData, character.attributes.edge)
DerivedAttributesPanel(character.attributes) DerivedAttributesPanel(character.attributes)
ReputationPanel(character.characterData)
} }
} }
@@ -208,6 +209,7 @@ private fun ExpandedOverviewContent(
DerivedAttributesPanel(character.attributes) DerivedAttributesPanel(character.attributes)
} }
} }
ReputationPanel(character.characterData)
} }
} }

View File

@@ -0,0 +1,70 @@
package org.shahondin1624.lib.components.charactermodel
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import org.shahondin1624.lib.components.TestTags
import org.shahondin1624.lib.components.UiConstants
import org.shahondin1624.model.characterdata.CharacterData
import org.shahondin1624.theme.LocalWindowSizeClass
/**
* Compact reputation panel showing Street Cred, Notoriety, and Public Awareness.
*/
@Composable
fun ReputationPanel(characterData: CharacterData) {
val windowSizeClass = LocalWindowSizeClass.current
val padding = UiConstants.Spacing.medium(windowSizeClass)
val spacing = UiConstants.Spacing.small(windowSizeClass)
Card(
modifier = Modifier
.fillMaxWidth()
.testTag(TestTags.PANEL_REPUTATION)
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(padding)
) {
Text(
text = "Reputation",
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(bottom = spacing)
)
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
) {
ReputationItem("Street Cred", characterData.streetCred)
ReputationItem("Notoriety", characterData.notoriety)
ReputationItem("Public Awareness", characterData.publicAwareness)
}
}
}
}
@Composable
private fun ReputationItem(label: String, value: Int) {
Column(
horizontalAlignment = androidx.compose.ui.Alignment.CenterHorizontally
) {
Text(
text = value.toString(),
style = MaterialTheme.typography.headlineSmall,
fontWeight = FontWeight.Bold,
color = MaterialTheme.colorScheme.primary
)
Text(
text = label,
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}