Skip to content

Commit 2b72a8b

Browse files
committed
style(fc): tweak tip pill coloring for self and untipped
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 77e4d18 commit 2b72a8b

File tree

2 files changed

+53
-26
lines changed

2 files changed

+53
-26
lines changed

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/chat/conversation/ConversationMessages.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,18 @@ internal fun ConversationMessages(
148148
}
149149

150150
is MessageListEvent.TipMessage -> {
151-
dispatchEvent(ConversationViewModel.Event.OnTipUser(
152-
event.message.chatMessageId,
153-
event.message.sender.id.orEmpty())
154-
)
151+
composeScope.launch {
152+
if (keyboardVisible) {
153+
ime?.hide()
154+
delay(500)
155+
}
156+
dispatchEvent(
157+
ConversationViewModel.Event.OnTipUser(
158+
event.message.chatMessageId,
159+
event.message.sender.id.orEmpty()
160+
)
161+
)
162+
}
155163
}
156164

157165
is MessageListEvent.ShowTipsForMessage -> {

ui/components/src/main/kotlin/com/getcode/ui/components/chat/messagecontents/MessageTextContent.kt

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import com.getcode.libs.opengraph.LocalOpenGraphParser
4747
import com.getcode.libs.opengraph.callback.OpenGraphCallback
4848
import com.getcode.libs.opengraph.model.OpenGraphResult
4949
import com.getcode.model.chat.MessageStatus
50+
import com.getcode.model.chat.Sender
5051
import com.getcode.model.sum
5152
import com.getcode.theme.CodeTheme
5253
import 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

Comments
 (0)