@@ -47,6 +47,7 @@ import com.getcode.libs.opengraph.LocalOpenGraphParser
4747import com.getcode.libs.opengraph.callback.OpenGraphCallback
4848import com.getcode.libs.opengraph.model.OpenGraphResult
4949import com.getcode.model.chat.MessageStatus
50+ import com.getcode.model.chat.Sender
5051import com.getcode.model.sum
5152import com.getcode.theme.CodeTheme
5253import com.getcode.ui.components.R
@@ -425,17 +426,24 @@ private fun Tips(
425426 val didUserTip = tips.any { it.tipper.isSelf }
426427 val backgroundColor by animateColorAsState(
427428 when {
428- isMessageFromSelf -> CodeTheme .colors.tertiary
429+ isMessageFromSelf -> CodeTheme .colors.surface
429430 didUserTip -> CodeTheme .colors.tertiary
430- else -> Color .White
431+ else -> Color .Transparent
432+ }
433+ )
434+
435+ val borderColor by animateColorAsState(
436+ when {
437+ ! didUserTip && ! isMessageFromSelf -> CodeTheme .colors.tertiary
438+ else -> Color .Transparent
431439 }
432440 )
433441
434442 val contentColor by animateColorAsState(
435443 when {
436444 isMessageFromSelf -> CodeTheme .colors.onBackground
437445 didUserTip -> CodeTheme .colors.onBackground
438- else -> CodeTheme .colors.secondary
446+ else -> CodeTheme .colors.onBackground
439447 }
440448 )
441449
@@ -446,6 +454,7 @@ private fun Tips(
446454 .clip(CircleShape )
447455 .clickable { onClick() }
448456 .background(backgroundColor, CircleShape )
457+ .border(CodeTheme .dimens.border, borderColor, CircleShape )
449458 .padding(
450459 horizontal = CodeTheme .dimens.grid.x2,
451460 vertical = CodeTheme .dimens.grid.x1,
@@ -459,25 +468,35 @@ private fun Tips(
459468 style = CodeTheme .typography.caption.copy(fontWeight = FontWeight .W700 ),
460469 )
461470
462- // Row(
463- // verticalAlignment = Alignment.CenterVertically,
464- // horizontalArrangement = Arrangement.spacedBy((-8).dp)
465- // ) {
466- // val imageModifier = Modifier
467- // .size(CodeTheme.dimens.staticGrid.x4)
468- // .clip(CircleShape)
469- // .border(CodeTheme.dimens.border, contentColor, CircleShape)
470- //
471- // val tippers = remember(tips) { tips.map { it.tipper }.distinct() }
472- //
473- // tippers.take(3).fastForEachIndexed { index, tipper ->
474- // UserAvatar(
475- // modifier = imageModifier
476- // .zIndex((tips.size - index).toFloat()),
477- // data = tipper.profileImage.nullIfEmpty() ?: tipper.id
478- // )
479- // }
480- // }
471+ // TipperDisplay(tips, contentColor, modifier)
472+ }
473+ }
474+ }
475+
476+ @Composable
477+ private fun TipperDisplay (
478+ tips : List <MessageTip >,
479+ contentColor : Color ,
480+ modifier : Modifier = Modifier ,
481+ ) {
482+ Row (
483+ modifier = modifier,
484+ verticalAlignment = Alignment .CenterVertically ,
485+ horizontalArrangement = Arrangement .spacedBy((- 8 ).dp)
486+ ) {
487+ val imageModifier = Modifier
488+ .size(CodeTheme .dimens.staticGrid.x4)
489+ .clip(CircleShape )
490+ .border(CodeTheme .dimens.border, contentColor, CircleShape )
491+
492+ val tippers = remember(tips) { tips.map { it.tipper }.distinct() }
493+
494+ tippers.take(3 ).fastForEachIndexed { index, tipper ->
495+ UserAvatar (
496+ modifier = imageModifier
497+ .zIndex((tips.size - index).toFloat()),
498+ data = tipper.profileImage.nullIfEmpty() ? : tipper.id
499+ )
481500 }
482501 }
483502}
0 commit comments