fix: enforce dynamic MaterialTheme colors in ComponentRegistry and prevent ActionList dashboard clearing
This commit is contained in:
@@ -18,6 +18,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.Button
|
import androidx.compose.material.Button
|
||||||
import androidx.compose.material.ButtonDefaults
|
import androidx.compose.material.ButtonDefaults
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.OutlinedTextField
|
import androidx.compose.material.OutlinedTextField
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.material.TextFieldDefaults
|
import androidx.compose.material.TextFieldDefaults
|
||||||
@@ -137,13 +138,13 @@ object ComponentRegistry {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
.clip(RoundedCornerShape(16.dp))
|
.clip(RoundedCornerShape(16.dp))
|
||||||
.background(CardBg)
|
.background(MaterialTheme.colors.surface)
|
||||||
.border(
|
.border(
|
||||||
1.dp,
|
1.dp,
|
||||||
Brush.linearGradient(
|
Brush.linearGradient(
|
||||||
listOf(
|
listOf(
|
||||||
AccentTeal.copy(alpha = 0.3f),
|
MaterialTheme.colors.primary.copy(alpha = 0.3f),
|
||||||
AccentPurple.copy(alpha = 0.3f)
|
MaterialTheme.colors.secondary.copy(alpha = 0.3f)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
RoundedCornerShape(16.dp)
|
RoundedCornerShape(16.dp)
|
||||||
@@ -290,7 +291,7 @@ fun ApprovalRequestComponent(
|
|||||||
// Target underneath ("two words underneath can say what its for")
|
// Target underneath ("two words underneath can say what its for")
|
||||||
Text(
|
Text(
|
||||||
text = request.target.uppercase(),
|
text = request.target.uppercase(),
|
||||||
color = AccentTeal,
|
color = MaterialTheme.colors.primary,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
fontFamily = FontFamily.Monospace,
|
fontFamily = FontFamily.Monospace,
|
||||||
@@ -343,7 +344,7 @@ fun ActionListComponent(
|
|||||||
list.actions.forEach { actionItem ->
|
list.actions.forEach { actionItem ->
|
||||||
Button(
|
Button(
|
||||||
onClick = { onActionSelected(actionItem.id) },
|
onClick = { onActionSelected(actionItem.id) },
|
||||||
colors = ButtonDefaults.buttonColors(backgroundColor = DeepBg),
|
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.background),
|
||||||
shape = RoundedCornerShape(12.dp),
|
shape = RoundedCornerShape(12.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -352,8 +353,8 @@ fun ActionListComponent(
|
|||||||
1.dp,
|
1.dp,
|
||||||
Brush.linearGradient(
|
Brush.linearGradient(
|
||||||
listOf(
|
listOf(
|
||||||
AccentTeal.copy(alpha = 0.5f),
|
MaterialTheme.colors.primary.copy(alpha = 0.5f),
|
||||||
AccentPurple.copy(alpha = 0.5f)
|
MaterialTheme.colors.secondary.copy(alpha = 0.5f)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
RoundedCornerShape(12.dp)
|
RoundedCornerShape(12.dp)
|
||||||
@@ -372,7 +373,7 @@ fun ActionListComponent(
|
|||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = ">",
|
text = ">",
|
||||||
color = AccentTeal,
|
color = MaterialTheme.colors.primary,
|
||||||
fontSize = 18.sp,
|
fontSize = 18.sp,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
@@ -415,9 +416,9 @@ fun TextInputComponent(
|
|||||||
placeholder = { Text(input.placeholder, color = TextSecondary) },
|
placeholder = { Text(input.placeholder, color = TextSecondary) },
|
||||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||||
textColor = TextPrimary,
|
textColor = TextPrimary,
|
||||||
focusedBorderColor = AccentTeal,
|
focusedBorderColor = MaterialTheme.colors.primary,
|
||||||
unfocusedBorderColor = TextSecondary.copy(alpha = 0.5f),
|
unfocusedBorderColor = TextSecondary.copy(alpha = 0.5f),
|
||||||
cursorColor = AccentTeal
|
cursorColor = MaterialTheme.colors.primary
|
||||||
),
|
),
|
||||||
shape = RoundedCornerShape(12.dp),
|
shape = RoundedCornerShape(12.dp),
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
@@ -425,7 +426,7 @@ fun TextInputComponent(
|
|||||||
|
|
||||||
Button(
|
Button(
|
||||||
onClick = { onSubmit(textVal) },
|
onClick = { onSubmit(textVal) },
|
||||||
colors = ButtonDefaults.buttonColors(backgroundColor = AccentPurple),
|
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.secondary),
|
||||||
shape = RoundedCornerShape(12.dp),
|
shape = RoundedCornerShape(12.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -473,7 +474,7 @@ fun MessageComponent(
|
|||||||
|
|
||||||
Button(
|
Button(
|
||||||
onClick = { onAcknowledge(message.primaryAction?.id) },
|
onClick = { onAcknowledge(message.primaryAction?.id) },
|
||||||
colors = ButtonDefaults.buttonColors(backgroundColor = AccentTeal),
|
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.primary),
|
||||||
shape = RoundedCornerShape(12.dp),
|
shape = RoundedCornerShape(12.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -482,7 +483,7 @@ fun MessageComponent(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = message.primaryAction?.label ?: "Acknowledge",
|
text = message.primaryAction?.label ?: "Acknowledge",
|
||||||
color = DeepBg,
|
color = MaterialTheme.colors.background,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
fontSize = 15.sp
|
fontSize = 15.sp
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -173,9 +173,12 @@ class MeatbagClient(
|
|||||||
}
|
}
|
||||||
if (httpResponse.status.isSuccess()) {
|
if (httpResponse.status.isSuccess()) {
|
||||||
log("Response submitted successfully! Server returned 200 OK", LogType.SUCCESS)
|
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
|
_currentPayload.value = null
|
||||||
}
|
}
|
||||||
|
}
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
log("Server rejected response: ${httpResponse.status} - ${httpResponse.bodyAsText()}", LogType.ERROR)
|
log("Server rejected response: ${httpResponse.status} - ${httpResponse.bodyAsText()}", LogType.ERROR)
|
||||||
|
|||||||
Reference in New Issue
Block a user