Преглед на файлове

frontend: Реализованы карточки книг

ZryachevTA преди 1 седмица
родител
ревизия
28ccaa8d50

+ 1 - 1
Frontend/.idea/other.xml

@@ -262,7 +262,7 @@
           <option name="codename" value="q6q" />
           <option name="id" value="q6q" />
           <option name="manufacturer" value="Samsung" />
-          <option name="name" value="SM-F956B" />
+          <option name="name" value="Galaxy Z Fold6" />
           <option name="screenDensity" value="420" />
           <option name="screenX" value="1856" />
           <option name="screenY" value="2160" />

+ 137 - 0
Frontend/app/src/main/java/com/example/neurea/views/screens/HomeScreen.kt

@@ -0,0 +1,137 @@
+package com.example.neurea.views.screens
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+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.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.material3.TextField
+import androidx.compose.material3.TextFieldDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+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.res.painterResource
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.input.PasswordVisualTransformation
+import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.example.neurea.R
+import com.example.neurea.views.ui.theme.NeureaTheme
+
+@Preview()
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun HomeScreen() { // navController: NavController
+    var email = remember { mutableStateOf("") }
+    var password = remember { mutableStateOf("") }
+    val maxLength = 20
+    val emailPattern = Regex("[^@ \\t\\r\\n]+@[^@ \\t\\r\\n]+\\.[^@ \\t\\r\\n]+")
+    var passwordVisibility: Boolean by remember { mutableStateOf(false) }
+
+    NeureaTheme {
+        Column(
+            modifier = Modifier
+                .fillMaxSize()
+                .background(color = MaterialTheme.colorScheme.secondary)
+        ) {
+            TextField(
+                modifier = Modifier
+                    .fillMaxWidth()
+                    .padding(start = 20.dp, end = 20.dp, top = 45.dp, bottom = 25.dp)
+                    .clip(shape = RoundedCornerShape(54.dp))
+                    ,
+                value = password.value,
+                colors = TextFieldDefaults.textFieldColors(
+                    containerColor = MaterialTheme.colorScheme.surface,
+                    focusedIndicatorColor = MaterialTheme.colorScheme.secondary,
+                    focusedTextColor = MaterialTheme.colorScheme.onPrimary,
+                    unfocusedTextColor = MaterialTheme.colorScheme.secondary,
+                    disabledIndicatorColor = Color.Transparent,
+                    unfocusedIndicatorColor = Color.Transparent,
+                    cursorColor = MaterialTheme.colorScheme.primary,
+                    disabledPlaceholderColor = MaterialTheme.colorScheme.onSecondary,
+                    focusedPlaceholderColor = MaterialTheme.colorScheme.onSecondary,
+                    unfocusedPlaceholderColor = MaterialTheme.colorScheme.onSecondary
+                ),
+                visualTransformation = if (passwordVisibility) VisualTransformation.None else PasswordVisualTransformation(),
+                trailingIcon = {
+                    Icon(
+                        painter = painterResource(id = R.drawable.baseline_search_24),
+                        contentDescription = "",
+                        tint = MaterialTheme.colorScheme.primary
+                    )
+                },
+                onValueChange = {
+                    if (it.length <= maxLength) password.value = it
+                },
+                placeholder = { Text("Поиск") },
+                singleLine = true
+            )
+            Text("Ваши рекомендации", fontWeight = FontWeight.Bold, fontSize = 18.sp, modifier = Modifier.padding(start = 25.dp) )
+            // Тут скорее всего будет LazyRow
+            Row(modifier = Modifier.padding(top = 22.dp, bottom = 22.dp, start = 24.dp))
+            {
+                Column(modifier = Modifier
+
+                    .height(216.dp)
+                    .width(150.dp)
+
+                    .clip(RoundedCornerShape(15.dp))
+
+                    .background(MaterialTheme.colorScheme.surface)
+                ) {
+                    Column(modifier = Modifier.padding(horizontal = 10.dp)) {
+                        Column(modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.End) {
+                            Box(modifier = Modifier
+                                .padding(top=5.dp)
+                                .size(7.dp)
+                                .clip(RoundedCornerShape(8.dp))
+                                .background(Color(0xFFD9D9D9),))
+                        }
+
+                        Column(modifier = Modifier
+                            .height(130.dp)
+                            .fillMaxWidth(),
+                            horizontalAlignment = Alignment.CenterHorizontally){
+                            Box(modifier = Modifier.background(Color.Gray).height(130.dp).width(80.dp), )
+
+                        }
+                        Text("Человек в высоком замке", fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
+                        Text("Филип Дик", fontSize = 15.sp)
+                    }
+                }
+            }
+        }
+
+    }
+}

+ 61 - 1
Frontend/app/src/main/java/com/example/neurea/views/screens/UserScreen.kt

@@ -14,6 +14,8 @@ import androidx.compose.foundation.layout.size
 import androidx.compose.foundation.layout.width
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
 import androidx.compose.material3.ExperimentalMaterial3Api
 import androidx.compose.material3.HorizontalDivider
 import androidx.compose.material3.Icon
@@ -87,7 +89,7 @@ fun UserScreen() { // navController: NavController
                     .clip(RoundedCornerShape(45.dp, 45.dp))
                     .background(color = MaterialTheme.colorScheme.secondary)
             ){
-                Text("Имя", fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.onPrimary, fontSize = 12.sp, modifier = Modifier.padding(start = 20.dp))
+                Text("Имя", fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.onPrimary, fontSize = 12.sp, modifier = Modifier.padding(start = 20.dp, top = 20.dp))
                 TextField(
                     modifier = Modifier
                         .fillMaxWidth()
@@ -125,6 +127,64 @@ fun UserScreen() { // navController: NavController
                     placeholder = { Text("Ваше имя", fontSize = 14.sp) },
                     singleLine = true
                 )
+                Text("Email", fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.onPrimary, fontSize = 12.sp, modifier = Modifier.padding(start = 20.dp))
+                TextField(
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .padding(horizontal = 20.dp, vertical = 8.dp)
+                        .clip(shape = RoundedCornerShape(8.dp))
+                        .border(
+                            width = 1.dp,
+                            color = MaterialTheme.colorScheme.onSecondary,
+                            shape = RoundedCornerShape(12.dp)
+                        ),
+                    textStyle = TextStyle(fontSize = 14.sp),
+                    value = newName,
+                    keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text),
+                    colors = TextFieldDefaults.textFieldColors(
+                        containerColor = MaterialTheme.colorScheme.secondary,
+                        focusedIndicatorColor = MaterialTheme.colorScheme.secondary,
+                        focusedTextColor = MaterialTheme.colorScheme.onPrimary,
+                        unfocusedTextColor = MaterialTheme.colorScheme.secondary,
+                        disabledIndicatorColor = Color.Transparent,
+                        unfocusedIndicatorColor = Color.Transparent,
+                        cursorColor = MaterialTheme.colorScheme.primary,
+                        disabledPlaceholderColor = MaterialTheme.colorScheme.onSecondary,
+                        focusedPlaceholderColor = MaterialTheme.colorScheme.onSecondary,
+                        unfocusedPlaceholderColor = MaterialTheme.colorScheme.onSecondary
+                    ),
+
+                    onValueChange = {
+                        if (it.length <= maxLength) newName = it
+                        /*if (email.value.isNotEmpty() and emailPattern.matches(email.value)) {
+                        colorOfButton = lavender.value
+                    } else {
+                        colorOfButton = gainsboro.value
+                    }*/
+                    },
+                    placeholder = { Text("Ваш email", fontSize = 14.sp) },
+                    singleLine = true
+                )
+                Button(
+                    onClick = {
+                    },
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .height(55.dp)
+                        .padding(top = 10.dp, start = 20.dp, end = 30.dp)
+                        .height(50.dp)
+
+                    ,
+                    shape = RoundedCornerShape(8.dp),
+                    colors = ButtonDefaults.buttonColors(
+                        containerColor = MaterialTheme.colorScheme.primary
+                    ),
+
+                    ) {
+
+                    Text("Изменить профиль", fontSize = 15.sp, color = MaterialTheme.colorScheme.secondary)
+
+                }
 
 
 

+ 5 - 0
Frontend/app/src/main/res/drawable/baseline_search_24.xml

@@ -0,0 +1,5 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#8F9098" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
+      
+    <path android:fillColor="@android:color/white" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
+    
+</vector>