Address review

This commit is contained in:
bxdxnn
2026-08-07 13:38:20 +00:00
parent 64ba29f91a
commit a04078aa9d
2 changed files with 3 additions and 11 deletions
@@ -259,7 +259,7 @@ private fun MaxSelectionsStepper(
) {
Icon(
imageVector = CompoundIcons.Minus(),
contentDescription = null,
contentDescription = stringResource(id = CommonStrings.a11y_create_poll_votes_allowed_decrease),
modifier = Modifier
.clickable(enabled = current > 1) { onDecrement() }
.size(32.dp)
@@ -277,7 +277,7 @@ private fun MaxSelectionsStepper(
)
Icon(
imageVector = CompoundIcons.Plus(),
contentDescription = null,
contentDescription = stringResource(id = CommonStrings.a11y_create_poll_votes_allowed_increase),
modifier = Modifier
.clickable(enabled = current < max) { onIncrement() }
.size(32.dp)
@@ -46,8 +46,6 @@ data class PollFormState(
* Create a copy of the [PollFormState] with a new blank answer added.
*
* If the maximum number of answers has already been reached an answer is not added.
*
* Also clamps [maxSelections] to the new answer count to keep state consistent.
*/
fun withNewAnswer(): PollFormState {
if (!canAddAnswer) {
@@ -55,8 +53,7 @@ data class PollFormState(
}
val newAnswers = (answers + "").toImmutableList()
val clampedMaxSelections = maxSelections.coerceIn(1, newAnswers.size)
return copy(answers = newAnswers, maxSelections = clampedMaxSelections)
return copy(answers = newAnswers)
}
/**
@@ -103,11 +100,6 @@ data class PollFormState(
*/
val canDeleteAnswer get() = answers.size > MIN_ANSWERS
/**
* The effective max selections, clamped to the number of answers.
*/
val effectiveMaxSelections get() = maxSelections.coerceIn(1, answers.size)
/**
* Whether the form is currently valid.
*/