@@ -29,6 +29,7 @@ import com.getcode.model.Verb
2929import com.getcode.theme.BrandDark
3030import com.getcode.theme.BrandLight
3131import com.getcode.theme.CodeTheme
32+ import com.getcode.ui.components.chat.utils.localizedText
3233import com.getcode.util.formatTimeRelatively
3334import com.getcode.view.main.home.components.PriceWithFlag
3435import kotlinx.datetime.Instant
@@ -145,22 +146,39 @@ private fun MessagePayment(
145146 verticalArrangement = Arrangement .spacedBy(CodeTheme .dimens.grid.x2),
146147 horizontalAlignment = Alignment .CenterHorizontally ,
147148 ) {
148- Text (
149- text = verb.localizedText,
150- style = CodeTheme .typography.body1.copy(fontWeight = FontWeight .W500 )
151- )
152-
153- PriceWithFlag (
154- currencyCode = amount.rate.currency,
155- amount = amount,
156- text = { price ->
157- Text (
158- text = price,
159- color = Color .White ,
160- style = CodeTheme .typography.h3
161- )
162- }
163- )
149+ if (verb == Verb .Returned ) {
150+ PriceWithFlag (
151+ currencyCode = amount.rate.currency,
152+ amount = amount,
153+ text = { price ->
154+ Text (
155+ text = price,
156+ color = Color .White ,
157+ style = CodeTheme .typography.h3
158+ )
159+ }
160+ )
161+ Text (
162+ text = verb.localizedText,
163+ style = CodeTheme .typography.body1.copy(fontWeight = FontWeight .W500 )
164+ )
165+ } else {
166+ Text (
167+ text = verb.localizedText,
168+ style = CodeTheme .typography.body1.copy(fontWeight = FontWeight .W500 )
169+ )
170+ PriceWithFlag (
171+ currencyCode = amount.rate.currency,
172+ amount = amount,
173+ text = { price ->
174+ Text (
175+ text = price,
176+ color = Color .White ,
177+ style = CodeTheme .typography.h3
178+ )
179+ }
180+ )
181+ }
164182 }
165183}
166184
@@ -182,17 +200,4 @@ private fun MessageText(modifier: Modifier = Modifier, text: String, date: Insta
182200 color = BrandLight ,
183201 )
184202 }
185- }
186-
187- private val Verb .localizedText: String
188- @SuppressLint(" DiscouragedApi" )
189- @Composable get() = with (LocalContext .current) context@{
190- if (this @localizedText == Verb .Unknown ) stringResource(id = R .string.title_unknown)
191- val resId = resources.getIdentifier(
192- " subtitle_verb_${this @localizedText.toString().lowercase()} " ,
193- " string" ,
194- BuildConfig .APPLICATION_ID
195- ).let { if (it == 0 ) null else it }
196-
197- resId?.let { getString(it) }.orEmpty()
198- }
203+ }
0 commit comments