Сценарии адаптированы под новую схему API
Этот коммит содержится в:
родитель
829d41a70a
Коммит
6f1ac6f912
@ -102,7 +102,7 @@ fun ScenarioDialog(
|
||||
mutableStateOf(scenarioDialogState.value?.name)
|
||||
}
|
||||
val timeState = remember {
|
||||
mutableStateOf(scenarioDialogState.value?.time)
|
||||
mutableStateOf(scenarioDialogState.value?.startTime)
|
||||
}
|
||||
|
||||
Dialog(
|
||||
@ -393,6 +393,15 @@ fun ScenarioDialog(
|
||||
modifier = Modifier
|
||||
.height(16.dp),
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun MessageCard() {
|
||||
Card(
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainer,
|
||||
@ -740,7 +749,4 @@ fun ScenarioDialog(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -43,12 +43,31 @@ import org.jetbrains.compose.resources.painterResource
|
||||
import ru.csasq.cit_is_bot.ui.components.SwitchButton
|
||||
import ru.csasq.cit_is_bot.ui.dialogs.ScenarioDialog
|
||||
|
||||
@Serializable
|
||||
enum class UserRole(
|
||||
val displayName: String,
|
||||
) {
|
||||
User("Пользователь"),
|
||||
Moderator("Модератор"),
|
||||
Admin("Администратор"),
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class User(
|
||||
val id: Int,
|
||||
val firstName: String,
|
||||
val lastName: String?,
|
||||
val username: String?,
|
||||
val role: UserRole,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Scenario(
|
||||
val id: Int? = null,
|
||||
val owner: User,
|
||||
var name: String,
|
||||
var time: String,
|
||||
var messageNumber: String,
|
||||
var startTime: String,
|
||||
var messages: List<String>,
|
||||
var isEnabled: Boolean,
|
||||
)
|
||||
|
||||
@ -160,8 +179,15 @@ fun ScenariosScreen(
|
||||
onClick = {
|
||||
scenarioDialogState.value = Scenario(
|
||||
name = "",
|
||||
time = "",
|
||||
messageNumber = "",
|
||||
owner = User(
|
||||
id = 1,
|
||||
firstName = "Глеб",
|
||||
lastName = "Иваницкий",
|
||||
username = "csasq",
|
||||
role = UserRole.Admin,
|
||||
),
|
||||
startTime = "",
|
||||
messages = listOf(),
|
||||
isEnabled = true,
|
||||
)
|
||||
},
|
||||
@ -174,9 +200,9 @@ fun ScenariosScreen(
|
||||
mutableStateOf(it.isEnabled)
|
||||
}
|
||||
val captionAnnotatedString = buildAnnotatedString {
|
||||
append(it.time)
|
||||
append(it.startTime)
|
||||
append(" \u2022 ")
|
||||
append(it.messageNumber)
|
||||
append(it.messages.size.toString())
|
||||
}
|
||||
SwitchButton(
|
||||
title = it.name,
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user