diff --git a/composeApp/src/commonMain/composeResources/drawable/round_check_24.xml b/composeApp/src/commonMain/composeResources/drawable/round_check_24.xml
new file mode 100644
index 0000000..989f628
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/round_check_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composeApp/src/commonMain/composeResources/drawable/round_close_24.xml b/composeApp/src/commonMain/composeResources/drawable/round_close_24.xml
new file mode 100644
index 0000000..c0285c8
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/drawable/round_close_24.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/AuthorRequestButton.kt b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/AuthorRequestButton.kt
deleted file mode 100644
index 0f04ac8..0000000
--- a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/AuthorRequestButton.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-package ru.csasq.beeapp.ui.components
-
-import androidx.compose.animation.AnimatedVisibility
-import androidx.compose.animation.animateColorAsState
-import androidx.compose.animation.core.animateDpAsState
-import androidx.compose.foundation.clickable
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.IntrinsicSize
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.padding
-import androidx.compose.material3.CardDefaults
-import androidx.compose.material3.HorizontalDivider
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.MutableState
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.clip
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.unit.dp
-
-@Composable
-fun AuthorRequestButton(
- title: String,
- spoilerState: MutableState,
-) {
- val backgroundColor = animateColorAsState(
- targetValue = if (spoilerState.value) MaterialTheme.colorScheme.primary.copy(alpha = 0.12f) else Color.Transparent,
- )
- val horizontalPadding = animateDpAsState(
- targetValue = if (spoilerState.value) 16.dp else 0.dp,
- )
- val cardColors = CardDefaults.cardColors()
- Box(
- modifier = Modifier
- .clip(MaterialTheme.shapes.extraLarge)
- .padding(
- horizontal = horizontalPadding.value,
- )
- .fillMaxWidth()
- .clickable {
- spoilerState.value = !spoilerState.value
- },
-// colors = CardColors(
-// containerColor = backgroundColor.value,
-// contentColor = cardColors.contentColor,
-// disabledContainerColor = cardColors.disabledContainerColor,
-// disabledContentColor = cardColors.disabledContentColor,
-// ),
- ) {
- Column {
- Row(
- modifier = Modifier
- .padding(16.dp)
- .fillMaxWidth(),
- verticalAlignment = Alignment.CenterVertically,
- ) {
- Text(
- text = title,
- )
- }
- AnimatedVisibility(
- visible = spoilerState.value,
- ) {
- HorizontalDivider()
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .height(IntrinsicSize.Min),
- horizontalArrangement = Arrangement.SpaceBetween,
- ) {
- Text(
- text = "Кнопки",
- )
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/AuthorRequestCard.kt b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/AuthorRequestCard.kt
new file mode 100644
index 0000000..ac14a8b
--- /dev/null
+++ b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/AuthorRequestCard.kt
@@ -0,0 +1,172 @@
+package ru.csasq.beeapp.ui.components
+
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.animation.core.animateDpAsState
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.IntrinsicSize
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxHeight
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.Card
+import androidx.compose.material3.CardColors
+import androidx.compose.material3.CardDefaults
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.MutableState
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.RectangleShape
+import androidx.compose.ui.graphics.painter.Painter
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.dp
+import bee_app_frontend.composeapp.generated.resources.Res
+import bee_app_frontend.composeapp.generated.resources.round_check_24
+import bee_app_frontend.composeapp.generated.resources.round_close_24
+import org.jetbrains.compose.resources.painterResource
+import ru.csasq.beeapp.ui.screens.AuthorRequest
+
+@Composable
+fun AuthorRequestButton(
+ authorRequest: AuthorRequest,
+ spoilerState: MutableState,
+ onAccept: () -> Unit,
+ onDecline: () -> Unit,
+) {
+ val backgroundColor = animateColorAsState(
+ targetValue = if (spoilerState.value == authorRequest) MaterialTheme.colorScheme.primary.copy(alpha = 0.12f) else Color.Transparent,
+ )
+ val horizontalPadding = animateDpAsState(
+ targetValue = if (spoilerState.value == authorRequest) 16.dp else 0.dp,
+ )
+ val shapeState = animateDpAsState(
+ targetValue = if (spoilerState.value == authorRequest) 28.0.dp else 0.0.dp,
+ )
+ val cardColors = CardDefaults.cardColors()
+ Card(
+ modifier = Modifier
+ .padding(
+ horizontal = horizontalPadding.value,
+ )
+ .fillMaxWidth(),
+ onClick = {
+ spoilerState.value = when (spoilerState.value) {
+ authorRequest -> null
+ else -> authorRequest
+ }
+ },
+ shape = RoundedCornerShape(shapeState.value),
+ colors = CardColors(
+ containerColor = backgroundColor.value,
+ contentColor = cardColors.contentColor,
+ disabledContainerColor = cardColors.disabledContainerColor,
+ disabledContentColor = cardColors.disabledContentColor,
+ ),
+ ) {
+ Column {
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(16.dp),
+ ) {
+ Text(
+ text = authorRequest.title,
+ overflow = TextOverflow.Ellipsis,
+ maxLines = 1,
+ style = MaterialTheme.typography.titleLarge,
+ )
+ Spacer(
+ modifier = Modifier.height(4.dp),
+ )
+ Text(
+ text = authorRequest.description,
+ overflow = TextOverflow.Ellipsis,
+ maxLines = 3,
+ style = MaterialTheme.typography.bodyMedium,
+ )
+ }
+ AnimatedVisibility(
+ visible = spoilerState.value == authorRequest,
+ ) {
+ HorizontalDivider()
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(IntrinsicSize.Min),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ ) {
+ AuthorRequestButton(
+ modifier = Modifier
+ .weight(
+ weight = 1f,
+ fill = true,
+ ),
+ title = "Принять",
+ painter = painterResource(Res.drawable.round_check_24),
+ onClick = onAccept,
+ )
+ AuthorRequestButton(
+ modifier = Modifier
+ .weight(
+ weight = 1f,
+ fill = true,
+ ),
+ title = "Отклонить",
+ painter = painterResource(Res.drawable.round_close_24),
+ onClick = onDecline,
+ )
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun AuthorRequestButton(
+ modifier: Modifier = Modifier,
+ title: String,
+ painter: Painter,
+ onClick: () -> Unit,
+) {
+ Button(
+ onClick = onClick,
+ modifier = modifier
+ .fillMaxHeight(),
+ shape = RectangleShape,
+ colors = ButtonDefaults.textButtonColors(),
+ contentPadding = PaddingValues(),
+ ) {
+ Column(
+ modifier = Modifier
+ .padding(12.dp)
+ .fillMaxHeight(),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ ) {
+ Icon(
+ painter = painter,
+ contentDescription = null,
+ )
+ Spacer(
+ modifier = Modifier
+ .height(4.dp),
+ )
+ Text(
+ text = title,
+ textAlign = TextAlign.Center,
+ )
+ }
+ }
+}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/UserButton.kt b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/UserButton.kt
index 2f5beb6..30cd8fd 100644
--- a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/UserButton.kt
+++ b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/components/UserButton.kt
@@ -24,10 +24,7 @@ fun UserButton(
.clickable(
onClick = onClick,
)
- .padding(
- horizontal = 16.dp,
- vertical = 16.dp,
- ),
+ .padding(16.dp),
) {
Text(
text = title,
diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/screens/AuthorRequestsScreen.kt b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/screens/AuthorRequestsScreen.kt
index c30ba8e..29246da 100644
--- a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/screens/AuthorRequestsScreen.kt
+++ b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/screens/AuthorRequestsScreen.kt
@@ -6,11 +6,18 @@ 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.Text
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
-import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
+import ru.csasq.beeapp.ui.components.AuthorRequestButton
+
+data class AuthorRequest(
+ val id: Int,
+ val title: String,
+ val description: String,
+)
@Composable
fun AuthorRequestsScreen(
@@ -27,12 +34,26 @@ fun AuthorRequestsScreen(
state = rememberScrollState(),
),
) {
- Text (
- text = "Здесь будет список обращений авторов",
- modifier = Modifier
- .padding(
- horizontal = 16.dp,
+ val authorRequestList = mutableListOf()
+ val spoilerState = remember {
+ mutableStateOf(null)
+ }
+ for (id in 1..25) {
+ authorRequestList.add(
+ AuthorRequest(
+ id = id,
+ title = "Заявляю о пропаже пчел",
+ description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
)
- )
+ )
+ }
+ authorRequestList.forEach {
+ AuthorRequestButton(
+ authorRequest = it,
+ spoilerState = spoilerState,
+ onAccept = {},
+ onDecline = {},
+ )
+ }
}
}
\ No newline at end of file
diff --git a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/screens/UsersScreen.kt b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/screens/UsersScreen.kt
index c7749bf..c9d57b7 100644
--- a/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/screens/UsersScreen.kt
+++ b/composeApp/src/commonMain/kotlin/ru/csasq/beeapp/ui/screens/UsersScreen.kt
@@ -7,11 +7,8 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.navigation.NavController
-import ru.csasq.beeapp.ui.components.AuthorRequestButton
import ru.csasq.beeapp.ui.components.UserButton
@Composable
@@ -35,13 +32,6 @@ fun UsersScreen(
caption = "Гавносос последней степени критенизма",
onClick = {},
)
- val tempState = remember {
- mutableStateOf(false)
- }
- AuthorRequestButton(
- title = "Заявляю о пропаже пчел",
- spoilerState = tempState,
- )
}
}
}
\ No newline at end of file