Skip to content

Commit af18b0c

Browse files
committed
feat: enhance AddDescriptorScreen layout and item display to include webconnectivity urls
1 parent e0a783b commit af18b0c

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

composeApp/src/commonMain/kotlin/org/ooni/probe/ui/descriptor/add/AddDescriptorScreen.kt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Box
66
import androidx.compose.foundation.layout.Column
77
import androidx.compose.foundation.layout.Row
8+
import androidx.compose.foundation.layout.WindowInsets
9+
import androidx.compose.foundation.layout.asPaddingValues
10+
import androidx.compose.foundation.layout.fillMaxSize
811
import androidx.compose.foundation.layout.fillMaxWidth
12+
import androidx.compose.foundation.layout.navigationBars
913
import androidx.compose.foundation.layout.padding
1014
import androidx.compose.foundation.lazy.LazyColumn
1115
import androidx.compose.foundation.lazy.items
@@ -37,6 +41,7 @@ import ooniprobe.composeapp.generated.resources.LoadingScreen_Runv2_Message
3741
import ooniprobe.composeapp.generated.resources.Modal_Cancel
3842
import ooniprobe.composeapp.generated.resources.Res
3943
import org.jetbrains.compose.resources.stringResource
44+
import org.ooni.engine.models.TestType
4045
import org.ooni.probe.data.models.toDescriptor
4146
import org.ooni.probe.ui.dashboard.TestDescriptorLabel
4247
import org.ooni.probe.ui.run.TestItem
@@ -131,18 +136,37 @@ fun AddDescriptorScreen(
131136
modifier = Modifier.weight(1f),
132137
)
133138
}
134-
LazyColumn {
139+
}
140+
141+
Box(
142+
modifier = Modifier
143+
.padding(WindowInsets.navigationBars.asPaddingValues())
144+
.padding(horizontal = 16.dp).fillMaxSize(),
145+
) {
146+
LazyColumn(modifier = Modifier.padding(horizontal = 16.dp).padding(bottom = 48.dp)) {
135147
items(state.selectableItems) { selectableItem ->
136148
TestItem(selectableItem, onChecked = { _ ->
137149
onEvent(
138150
AddDescriptorViewModel.Event.SelectableItemClicked(selectableItem),
139151
)
140152
})
153+
154+
if (state.selectableItems.size == 1 && selectableItem.item.test == TestType.WebConnectivity) {
155+
selectableItem.item.inputs.orEmpty().forEach { website ->
156+
Text(
157+
text = website,
158+
modifier = Modifier.padding(start = 64.dp, top = 4.dp),
159+
maxLines = 1,
160+
)
161+
}
162+
}
141163
}
142164
}
165+
143166
Row(
144167
modifier = Modifier
145168
.padding(top = 32.dp)
169+
.align(Alignment.BottomCenter)
146170
.fillMaxWidth(),
147171
horizontalArrangement = Arrangement.SpaceBetween,
148172
) {

0 commit comments

Comments
 (0)