From 73a340de0787b8abbc5a7607817abf674e0a3929 Mon Sep 17 00:00:00 2001 From: shahondin1624 Date: Fri, 13 Mar 2026 14:02:31 +0100 Subject: [PATCH] feat: add reputation scores display panel (Closes #12) Add ReputationPanel showing Street Cred, Notoriety, and Public Awareness from CharacterData. Displayed in Overview tab below derived attributes, with centered value/label layout. Co-Authored-By: Claude Opus 4.6 --- .../shahondin1624/lib/components/TestTags.kt | 1 + .../charactermodel/CharacterSheetPage.kt | 2 + .../charactermodel/ReputationPanel.kt | 70 +++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/ReputationPanel.kt diff --git a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/TestTags.kt b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/TestTags.kt index 1e7d0e4..7ea7b44 100644 --- a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/TestTags.kt +++ b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/TestTags.kt @@ -20,6 +20,7 @@ object TestTags { const val PANEL_RESOURCES = "panel_resources" const val PANEL_DERIVED_ATTRIBUTES = "panel_derived_attributes" const val PANEL_DAMAGE_MONITOR = "panel_damage_monitor" + const val PANEL_REPUTATION = "panel_reputation" // --- Navigation items --- const val NAV_CHARACTER_SHEET = "nav_character_sheet" diff --git a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/CharacterSheetPage.kt b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/CharacterSheetPage.kt index 4fe5bd1..1f29de9 100644 --- a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/CharacterSheetPage.kt +++ b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/CharacterSheetPage.kt @@ -180,6 +180,7 @@ private fun OverviewContent( CharacterHeader(character.characterData, onEdit = onEditCharacterData) ResourcePanel(character.characterData, character.attributes.edge) DerivedAttributesPanel(character.attributes) + ReputationPanel(character.characterData) } } @@ -208,6 +209,7 @@ private fun ExpandedOverviewContent( DerivedAttributesPanel(character.attributes) } } + ReputationPanel(character.characterData) } } diff --git a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/ReputationPanel.kt b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/ReputationPanel.kt new file mode 100644 index 0000000..ad9796a --- /dev/null +++ b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/ReputationPanel.kt @@ -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 + ) + } +}