diff --git a/composeApp/src/commonMain/composeResources/drawable/baseline_attach_file_24.xml b/composeApp/src/commonMain/composeResources/drawable/baseline_attach_file_24.xml
new file mode 100644
index 0000000..f1240df
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/baseline_attach_file_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composeApp/src/commonMain/composeResources/drawable/baseline_ballot_24.xml b/composeApp/src/commonMain/composeResources/drawable/baseline_ballot_24.xml
new file mode 100644
index 0000000..2ccd5d5
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/baseline_ballot_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composeApp/src/commonMain/composeResources/drawable/baseline_casino_24.xml b/composeApp/src/commonMain/composeResources/drawable/baseline_casino_24.xml
new file mode 100644
index 0000000..d7a39e4
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/baseline_casino_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composeApp/src/commonMain/composeResources/drawable/baseline_contacts_24.xml b/composeApp/src/commonMain/composeResources/drawable/baseline_contacts_24.xml
new file mode 100644
index 0000000..aa55b69
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/baseline_contacts_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt b/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt
index 2c8b05a..a4a30c2 100644
--- a/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt
+++ b/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/dialogs/ScenarioDialog.kt
@@ -10,10 +10,12 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.Card
+import androidx.compose.material3.CardDefaults
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExposedDropdownMenuBox
+import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
@@ -26,18 +28,37 @@ import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
+import androidx.compose.ui.input.pointer.PointerIcon
+import androidx.compose.ui.input.pointer.pointerHoverIcon
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import cit_is_bot.composeapp.generated.resources.Res
+import cit_is_bot.composeapp.generated.resources.baseline_attach_file_24
+import cit_is_bot.composeapp.generated.resources.baseline_ballot_24
+import cit_is_bot.composeapp.generated.resources.baseline_casino_24
import cit_is_bot.composeapp.generated.resources.baseline_close_24
+import cit_is_bot.composeapp.generated.resources.baseline_contacts_24
import cit_is_bot.composeapp.generated.resources.baseline_date_range_24
import cit_is_bot.composeapp.generated.resources.baseline_more_vert_24
import cit_is_bot.composeapp.generated.resources.baseline_title_24
+import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.painterResource
import ru.csasq.cit_is_bot.ui.screens.Scenario
+enum class MessageType(
+ val id: Int,
+ val displayName: String,
+ val icon: DrawableResource,
+) {
+ TEXT(1, "Текст", Res.drawable.baseline_title_24),
+ POLL(2, "Опрос", Res.drawable.baseline_ballot_24),
+ MEDIA(3, "Медиа", Res.drawable.baseline_attach_file_24),
+ CONTACT(4, "Контакт", Res.drawable.baseline_contacts_24),
+ DICE(5, "Игральная кость", Res.drawable.baseline_casino_24),
+}
+
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ScenarioDialog(
@@ -193,12 +214,22 @@ fun ScenarioDialog(
text = "Время запуска",
)
},
+ placeholder = {
+ Text(
+ text = "0 12 * * 1-5",
+ )
+ },
leadingIcon = {
Icon(
painter = painterResource(Res.drawable.baseline_date_range_24),
contentDescription = null,
)
},
+ supportingText = {
+ Text(
+ text = "В формате cron",
+ )
+ },
isError = false,
singleLine = true,
)
@@ -214,7 +245,17 @@ fun ScenarioDialog(
modifier = Modifier
.height(16.dp),
)
- Card {
+ Card(
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainer,
+ ),
+ ) {
+ val dropdownMenuState = remember {
+ mutableStateOf(false)
+ }
+ val messageTypeState = remember {
+ mutableStateOf(MessageType.TEXT)
+ }
Column(
modifier = Modifier
.padding(16.dp),
@@ -228,11 +269,18 @@ fun ScenarioDialog(
.height(16.dp),
)
ExposedDropdownMenuBox(
- expanded = false,
- onExpandedChange = {},
+ expanded = dropdownMenuState.value,
+ onExpandedChange = { value ->
+ dropdownMenuState.value = value
+ },
+ modifier = Modifier
+ .pointerHoverIcon(
+ icon = PointerIcon.Default,
+ overrideDescendants = true,
+ ),
) {
OutlinedTextField(
- value = "Опрос",
+ value = messageTypeState.value.displayName,
onValueChange = {},
modifier = Modifier
.fillMaxWidth()
@@ -243,25 +291,46 @@ fun ScenarioDialog(
)
},
readOnly = true,
- leadingIcon = {},
+ leadingIcon = {
+ Icon(
+ painter = painterResource(messageTypeState.value.icon),
+ contentDescription = null,
+ )
+ },
+ trailingIcon = {
+ ExposedDropdownMenuDefaults.TrailingIcon(
+ expanded = dropdownMenuState.value,
+ )
+ },
supportingText = {},
isError = false,
singleLine = true,
)
ExposedDropdownMenu(
- expanded = false,
- onDismissRequest = {},
+ expanded = dropdownMenuState.value,
+ onDismissRequest = {
+ dropdownMenuState.value = false
+ },
) {
-// items.forEach {
-// DropdownMenuItem(
-// text = {
-// Text(
-// text = it.displayName,
-// )
-// },
-// onClick = {},
-// )
-// }
+ MessageType.entries.forEach {
+ DropdownMenuItem(
+ text = {
+ Text(
+ text = it.displayName,
+ )
+ },
+ onClick = {
+ messageTypeState.value = it
+ dropdownMenuState.value = false
+ },
+ leadingIcon = {
+ Icon(
+ painter = painterResource(it.icon),
+ contentDescription = null,
+ )
+ },
+ )
+ }
}
}
}