Skip to content

Commit 5ce63b0

Browse files
Add subtitle to single and multi select options
1 parent be8ac21 commit 5ce63b0

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

app/feature/feature-claim-chat/src/commonMain/graphql/FragmentClaimIntent.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ fragment FormFragment on ClaimIntentStepContentForm {
3535
isRequired
3636
options {
3737
title
38+
subtitle
3839
value
3940
}
4041
defaultValues

app/feature/feature-claim-chat/src/commonMain/kotlin/com/hedvig/feature/claim/chat/ClaimChatViewModel.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,15 @@ internal class ClaimChatPresenter(
259259
currentStep = currentStep,
260260
claimIntentId = { claimIntentId },
261261
onFailure = { failedStepId, errorMessage ->
262-
onTaskSubmissionFailed(failedStepId, errorMessage, steps, { errorSubmittingStep = it })
262+
onTaskSubmissionFailed(failedStepId, errorMessage, steps) { errorSubmittingStep = it }
263263
},
264264
steps = steps,
265265
)
266266
SubmitCompleteTaskEffect(
267267
submitTaskUseCase = submitTaskUseCase,
268268
currentStep = currentStep,
269269
onFailure = { failedStepId, errorMessage ->
270-
onTaskSubmissionFailed(failedStepId, errorMessage, steps, { errorSubmittingStep = it })
270+
onTaskSubmissionFailed(failedStepId, errorMessage, steps) { errorSubmittingStep = it }
271271
},
272272
onSuccess = { claimIntent ->
273273
handleNext(
@@ -476,6 +476,7 @@ internal class ClaimChatPresenter(
476476
FieldOption(
477477
selectedDateString,
478478
selectedDateString,
479+
null,
479480
),
480481
),
481482
)

app/feature/feature-claim-chat/src/commonMain/kotlin/com/hedvig/feature/claim/chat/data/ClaimIntent.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ internal sealed interface StepContent {
9999
data class FieldOption(
100100
val value: String,
101101
val text: String,
102+
val subtitle: String?,
102103
)
103104

104105
enum class FieldType {

app/feature/feature-claim-chat/src/commonMain/kotlin/com/hedvig/feature/claim/chat/data/ClaimIntentExt.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ private fun List<FormFragment.Field>.toFields(locale: CommonLocale): List<StepCo
202202
StepContent.Form.FieldOption(
203203
text = it.title,
204204
value = it.value,
205+
subtitle = it.subtitle,
205206
)
206207
} ?: emptyList(),
207208
selectedOptions = field.defaultValues.toFieldOptions(field.options),
@@ -232,10 +233,11 @@ private fun List<String>.toFieldOptions(
232233
StepContent.Form.FieldOption(
233234
value = it.value,
234235
text = it.title, // if we have a list to choose from
236+
subtitle = it.subtitle,
235237
)
236238
}
237239
?: // if it is just a value
238-
StepContent.Form.FieldOption(defaultStringValue, defaultStringValue)
240+
StepContent.Form.FieldOption(defaultStringValue, defaultStringValue, null)
239241
}
240242
}
241243

app/feature/feature-claim-chat/src/commonMain/kotlin/com/hedvig/feature/claim/chat/ui/step/FormStep.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private fun FormContent(
138138
onInput = { answer ->
139139
onSelectFieldAnswer(
140140
field.id,
141-
answer?.let { StepContent.Form.FieldOption(it, it) },
141+
answer?.let { StepContent.Form.FieldOption(it, it, null) },
142142
)
143143
},
144144
errorText = errorText,
@@ -150,7 +150,7 @@ private fun FormContent(
150150
onSelectFieldAnswer(
151151
field.id,
152152
field.datePickerUiState?.datePickerState?.selectedDateMillis?.let {
153-
StepContent.Form.FieldOption(it.toString(), it.toString())
153+
StepContent.Form.FieldOption(it.toString(), it.toString(), null)
154154
},
155155
)
156156
}
@@ -170,7 +170,7 @@ private fun FormContent(
170170
onInput = { answer ->
171171
onSelectFieldAnswer(
172172
field.id,
173-
answer?.let { StepContent.Form.FieldOption(it, it) },
173+
answer?.let { StepContent.Form.FieldOption(it, it, null) },
174174
)
175175
},
176176
keyboardType = KeyboardType.Number,
@@ -185,6 +185,7 @@ private fun FormContent(
185185
RadioOption(
186186
id = RadioOptionId(it.value),
187187
text = it.text,
188+
label = it.subtitle,
188189
iconResource = null,
189190
)
190191
},
@@ -216,6 +217,7 @@ private fun FormContent(
216217
RadioOption(
217218
id = RadioOptionId(it.value),
218219
text = it.text,
220+
label = it.subtitle,
219221
iconResource = null,
220222
)
221223
},
@@ -242,7 +244,7 @@ private fun FormContent(
242244
onSelect = {
243245
onSelectFieldAnswer(
244246
field.id,
245-
StepContent.Form.FieldOption(it, it),
247+
StepContent.Form.FieldOption(it, it, null),
246248
)
247249
},
248250
questionText = field.title,

0 commit comments

Comments
 (0)