diff --git a/composeApp/src/commonMain/composeResources/drawable/baseline_date_range_24.xml b/composeApp/src/commonMain/composeResources/drawable/baseline_date_range_24.xml
new file mode 100644
index 0000000..97d6265
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/baseline_date_range_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composeApp/src/commonMain/composeResources/drawable/baseline_title_24.xml b/composeApp/src/commonMain/composeResources/drawable/baseline_title_24.xml
new file mode 100644
index 0000000..598a864
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/baseline_title_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/App.kt b/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/App.kt
index e58d410..d418c91 100644
--- a/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/App.kt
+++ b/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/App.kt
@@ -1,12 +1,6 @@
package ru.csasq.cit_is_bot
-import androidx.compose.animation.AnimatedVisibility
-import androidx.compose.animation.expandHorizontally
-import androidx.compose.animation.fadeIn
-import androidx.compose.animation.fadeOut
-import androidx.compose.animation.shrinkHorizontally
import androidx.compose.material3.ExperimentalMaterial3Api
-import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBar
@@ -25,7 +19,6 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import cit_is_bot.composeapp.generated.resources.Res
-import cit_is_bot.composeapp.generated.resources.baseline_add_24
import cit_is_bot.composeapp.generated.resources.baseline_chat_24
import cit_is_bot.composeapp.generated.resources.baseline_dashboard_24
import cit_is_bot.composeapp.generated.resources.baseline_edit_calendar_24
@@ -75,18 +68,10 @@ fun App() {
val snackbarHostState = remember {
SnackbarHostState()
}
- val floatingActionButtonVisibleState = remember {
- mutableStateOf(false)
- }
- val floatingActionButtonOnClickState = remember {
- mutableStateOf<(() -> Unit)?>(null)
- }
- val createRuleDialogOpeningState = remember {
- mutableStateOf(false)
- }
- val floatingActionButtonExpandedState = remember {
- mutableStateOf(true)
+ val floatingActionButtonState = remember {
+ mutableStateOf<(@Composable () -> Unit)?>(null)
}
+
Scaffold(
topBar = {
TopAppBar(
@@ -124,6 +109,7 @@ fun App() {
it.route == screen.route
} == true,
onClick = {
+ floatingActionButtonState.value = null
navController.navigate(screen.route)
},
)
@@ -143,26 +129,8 @@ fun App() {
}
},
floatingActionButton = {
- AnimatedVisibility(
- visible = floatingActionButtonVisibleState.value,
- enter = fadeIn() + expandHorizontally(),
- exit = fadeOut() + shrinkHorizontally()
- ) {
- ExtendedFloatingActionButton(
- text = {
- Text(
- text = "Добавить сценарий",
- )
- },
- icon = {
- Icon(
- painter = painterResource(Res.drawable.baseline_add_24),
- contentDescription = null,
- )
- },
- onClick = floatingActionButtonOnClickState.value ?: {},
- expanded = floatingActionButtonExpandedState.value,
- )
+ floatingActionButtonState.value?.let {
+ it()
}
},
) {
@@ -171,24 +139,19 @@ fun App() {
startDestination = Screen.Dashboard.route,
) {
composable(Screen.Dashboard.route) {
- floatingActionButtonVisibleState.value = false
DashboardScreen(navController, paddingValues)
}
composable(Screen.Scenarios.route) {
- floatingActionButtonVisibleState.value = true
ScenariosScreen(
navController,
paddingValues,
- floatingActionButtonOnClickState,
- floatingActionButtonExpandedState,
+ floatingActionButtonState,
)
}
composable(Screen.Chats.route) {
- floatingActionButtonVisibleState.value = false
ChatsScreen(navController, paddingValues)
}
composable(Screen.Users.route) {
- floatingActionButtonVisibleState.value = false
UsersScreen(navController, paddingValues)
}
}
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 f050180..2c8b05a 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
@@ -1,16 +1,23 @@
package ru.csasq.cit_is_bot.ui.dialogs
import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
+import androidx.compose.material3.Card
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
@@ -24,9 +31,10 @@ 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_chat_24
import cit_is_bot.composeapp.generated.resources.baseline_close_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.painterResource
import ru.csasq.cit_is_bot.ui.screens.Scenario
@@ -147,7 +155,117 @@ fun ScenarioDialog(
horizontal = 16.dp,
),
) {
-
+ OutlinedTextField(
+ value = "",
+ onValueChange = {},
+ modifier = Modifier
+ .fillMaxWidth(),
+ label = {
+ Text(
+ text = "Название",
+ )
+ },
+ leadingIcon = {
+ Icon(
+ painter = painterResource(Res.drawable.baseline_title_24),
+ contentDescription = null,
+ )
+ },
+ supportingText = {
+ Text(
+ text = "Отображается в списке опросов",
+ )
+ },
+ isError = false,
+ singleLine = true,
+ )
+ Spacer(
+ modifier = Modifier
+ .height(8.dp),
+ )
+ OutlinedTextField(
+ value = "",
+ onValueChange = {},
+ modifier = Modifier
+ .fillMaxWidth(),
+ label = {
+ Text(
+ text = "Время запуска",
+ )
+ },
+ leadingIcon = {
+ Icon(
+ painter = painterResource(Res.drawable.baseline_date_range_24),
+ contentDescription = null,
+ )
+ },
+ isError = false,
+ singleLine = true,
+ )
+ Spacer(
+ modifier = Modifier
+ .height(32.dp),
+ )
+ Text(
+ text = "Сообщения",
+ style = MaterialTheme.typography.titleLarge,
+ )
+ Spacer(
+ modifier = Modifier
+ .height(16.dp),
+ )
+ Card {
+ Column(
+ modifier = Modifier
+ .padding(16.dp),
+ ) {
+ Text(
+ text = "Общее",
+ style = MaterialTheme.typography.titleMedium,
+ )
+ Spacer(
+ modifier = Modifier
+ .height(16.dp),
+ )
+ ExposedDropdownMenuBox(
+ expanded = false,
+ onExpandedChange = {},
+ ) {
+ OutlinedTextField(
+ value = "Опрос",
+ onValueChange = {},
+ modifier = Modifier
+ .fillMaxWidth()
+ .menuAnchor(),
+ label = {
+ Text(
+ text = "Тип",
+ )
+ },
+ readOnly = true,
+ leadingIcon = {},
+ supportingText = {},
+ isError = false,
+ singleLine = true,
+ )
+ ExposedDropdownMenu(
+ expanded = false,
+ onDismissRequest = {},
+ ) {
+// items.forEach {
+// DropdownMenuItem(
+// text = {
+// Text(
+// text = it.displayName,
+// )
+// },
+// onClick = {},
+// )
+// }
+ }
+ }
+ }
+ }
}
}
}
diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/screens/ScenariosScreen.kt b/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/screens/ScenariosScreen.kt
index 482196c..f30f396 100644
--- a/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/screens/ScenariosScreen.kt
+++ b/composeApp/src/commonMain/kotlin/ru/csasq/cit_is_bot/ui/screens/ScenariosScreen.kt
@@ -7,6 +7,9 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
+import androidx.compose.material3.ExtendedFloatingActionButton
+import androidx.compose.material3.Icon
+import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
@@ -18,6 +21,9 @@ import androidx.compose.ui.input.nestedscroll.NestedScrollSource
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.text.buildAnnotatedString
import androidx.navigation.NavController
+import cit_is_bot.composeapp.generated.resources.Res
+import cit_is_bot.composeapp.generated.resources.baseline_add_24
+import org.jetbrains.compose.resources.painterResource
import ru.csasq.cit_is_bot.ui.components.SwitchButton
import ru.csasq.cit_is_bot.ui.dialogs.ScenarioDialog
@@ -39,8 +45,7 @@ val scenarioList = listOf(
fun ScenariosScreen(
navController: NavController,
paddingValues: PaddingValues,
- floatingActionButtonOnClickState: MutableState<(() -> Unit)?>,
- floatingActionButtonExpandedState: MutableState,
+ floatingActionButtonState: MutableState<(@Composable () -> Unit)?>,
) {
Column(
modifier = Modifier
@@ -55,13 +60,32 @@ fun ScenariosScreen(
val scenarioDialogState = remember {
mutableStateOf(null)
}
- floatingActionButtonOnClickState.value = {
- scenarioDialogState.value = Scenario(
- name = "",
- daysOfWeek = "",
- time = "",
- messageNumber = "",
- isEnabled = true,
+ val floatingActionButtonExpandedState = remember {
+ mutableStateOf(true)
+ }
+ floatingActionButtonState.value = @Composable {
+ ExtendedFloatingActionButton(
+ text = {
+ Text(
+ text = "Добавить сценарий",
+ )
+ },
+ icon = {
+ Icon(
+ painter = painterResource(Res.drawable.baseline_add_24),
+ contentDescription = null,
+ )
+ },
+ onClick = {
+ scenarioDialogState.value = Scenario(
+ name = "",
+ daysOfWeek = "",
+ time = "",
+ messageNumber = "",
+ isEnabled = true,
+ )
+ },
+ expanded = floatingActionButtonExpandedState.value,
)
}
scenarioList.forEach {