fix: enforce dynamic MaterialTheme colors in ComponentRegistry and prevent ActionList dashboard clearing

This commit is contained in:
2026-07-04 15:09:18 -06:00
parent d8c9bbbb43
commit 181e9b53bd
2 changed files with 19 additions and 15 deletions

View File

@@ -18,6 +18,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.MaterialTheme
import androidx.compose.material.OutlinedTextField
import androidx.compose.material.Text
import androidx.compose.material.TextFieldDefaults
@@ -137,13 +138,13 @@ object ComponentRegistry {
.fillMaxWidth()
.padding(8.dp)
.clip(RoundedCornerShape(16.dp))
.background(CardBg)
.background(MaterialTheme.colors.surface)
.border(
1.dp,
Brush.linearGradient(
listOf(
AccentTeal.copy(alpha = 0.3f),
AccentPurple.copy(alpha = 0.3f)
MaterialTheme.colors.primary.copy(alpha = 0.3f),
MaterialTheme.colors.secondary.copy(alpha = 0.3f)
)
),
RoundedCornerShape(16.dp)
@@ -290,7 +291,7 @@ fun ApprovalRequestComponent(
// Target underneath ("two words underneath can say what its for")
Text(
text = request.target.uppercase(),
color = AccentTeal,
color = MaterialTheme.colors.primary,
fontSize = 14.sp,
fontWeight = FontWeight.Bold,
fontFamily = FontFamily.Monospace,
@@ -343,7 +344,7 @@ fun ActionListComponent(
list.actions.forEach { actionItem ->
Button(
onClick = { onActionSelected(actionItem.id) },
colors = ButtonDefaults.buttonColors(backgroundColor = DeepBg),
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.background),
shape = RoundedCornerShape(12.dp),
modifier = Modifier
.fillMaxWidth()
@@ -352,8 +353,8 @@ fun ActionListComponent(
1.dp,
Brush.linearGradient(
listOf(
AccentTeal.copy(alpha = 0.5f),
AccentPurple.copy(alpha = 0.5f)
MaterialTheme.colors.primary.copy(alpha = 0.5f),
MaterialTheme.colors.secondary.copy(alpha = 0.5f)
)
),
RoundedCornerShape(12.dp)
@@ -372,7 +373,7 @@ fun ActionListComponent(
)
Text(
text = ">",
color = AccentTeal,
color = MaterialTheme.colors.primary,
fontSize = 18.sp,
fontWeight = FontWeight.Bold
)
@@ -415,9 +416,9 @@ fun TextInputComponent(
placeholder = { Text(input.placeholder, color = TextSecondary) },
colors = TextFieldDefaults.outlinedTextFieldColors(
textColor = TextPrimary,
focusedBorderColor = AccentTeal,
focusedBorderColor = MaterialTheme.colors.primary,
unfocusedBorderColor = TextSecondary.copy(alpha = 0.5f),
cursorColor = AccentTeal
cursorColor = MaterialTheme.colors.primary
),
shape = RoundedCornerShape(12.dp),
modifier = Modifier.fillMaxWidth()
@@ -425,7 +426,7 @@ fun TextInputComponent(
Button(
onClick = { onSubmit(textVal) },
colors = ButtonDefaults.buttonColors(backgroundColor = AccentPurple),
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.secondary),
shape = RoundedCornerShape(12.dp),
modifier = Modifier
.fillMaxWidth()
@@ -473,7 +474,7 @@ fun MessageComponent(
Button(
onClick = { onAcknowledge(message.primaryAction?.id) },
colors = ButtonDefaults.buttonColors(backgroundColor = AccentTeal),
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.primary),
shape = RoundedCornerShape(12.dp),
modifier = Modifier
.fillMaxWidth()
@@ -482,7 +483,7 @@ fun MessageComponent(
) {
Text(
text = message.primaryAction?.label ?: "Acknowledge",
color = DeepBg,
color = MaterialTheme.colors.background,
fontWeight = FontWeight.Bold,
fontSize = 15.sp
)

View File

@@ -173,9 +173,12 @@ class MeatbagClient(
}
if (httpResponse.status.isSuccess()) {
log("Response submitted successfully! Server returned 200 OK", LogType.SUCCESS)
if (_currentPayload.value?.uiPrimitive?.id == response.requestId) {
val currentPrimitive = _currentPayload.value?.uiPrimitive
if (currentPrimitive?.id == response.requestId) {
if (currentPrimitive !is meatbag.common.ActionList) {
_currentPayload.value = null
}
}
true
} else {
log("Server rejected response: ${httpResponse.status} - ${httpResponse.bodyAsText()}", LogType.ERROR)