|
@@ -1,4 +1,5 @@
|
|
|
package com.example.lectionsupabase.view.mainActivity.components
|
|
|
+import androidx.compose.foundation.BorderStroke
|
|
|
import androidx.compose.foundation.Image
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
import androidx.compose.foundation.layout.Box
|
|
@@ -35,11 +36,15 @@ import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
import androidx.compose.ui.layout.ContentScale
|
|
|
+import androidx.compose.ui.text.font.Font
|
|
|
+import androidx.compose.ui.text.font.FontFamily
|
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
|
+import androidx.compose.ui.text.style.TextAlign
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
import androidx.navigation.NavHostController
|
|
|
import coil.compose.rememberImagePainter
|
|
|
+import com.example.lectionsupabase.R
|
|
|
import com.example.lectionsupabase.domain.utils.Constants
|
|
|
import com.example.lectionsupabase.model.Admin
|
|
|
import com.example.lectionsupabase.model.Cars
|
|
@@ -53,8 +58,13 @@ fun Restaurants(navHost: NavHostController) {
|
|
|
var loadingRest by remember { mutableStateOf(true) }
|
|
|
var loadingUsers by remember { mutableStateOf(true) }
|
|
|
var users by remember { mutableStateOf<List<Admin>>(listOf()) }
|
|
|
+ val montserratSemiBold = FontFamily(Font(R.font.mon_semibold))
|
|
|
+ val montserratExtraBold = FontFamily(Font(R.font.mon_extrabold))
|
|
|
+ val montserratRegular = FontFamily(Font(R.font.mon_regular))
|
|
|
+ val montserratMedium = FontFamily(Font(R.font.mon_medium))
|
|
|
+ val montserratLigth = FontFamily(Font(R.font.mon_light))
|
|
|
|
|
|
- // Загружаем список автомобилей
|
|
|
+ // Загружаем список ресторанов
|
|
|
LaunchedEffect(Unit) {
|
|
|
try {
|
|
|
restaurants = Constants.supabase.from("Restaurants")
|
|
@@ -62,7 +72,7 @@ fun Restaurants(navHost: NavHostController) {
|
|
|
.decodeList<Restaurants>()
|
|
|
loadingRest = false
|
|
|
} catch (e: Exception) {
|
|
|
- println("Error loading cars: ${e.message}")
|
|
|
+ println("Error loading restaurants: ${e.message}")
|
|
|
loadingRest = false
|
|
|
}
|
|
|
}
|
|
@@ -91,17 +101,24 @@ fun Restaurants(navHost: NavHostController) {
|
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
|
.padding(vertical = 16.dp),
|
|
|
- verticalAlignment = Alignment.CenterVertically,
|
|
|
- horizontalArrangement = Arrangement.SpaceBetween
|
|
|
+ verticalAlignment = Alignment.CenterVertically
|
|
|
) {
|
|
|
+ // Spacer для создания пространства между текстом и иконкой
|
|
|
+ Spacer(modifier = Modifier.weight(1f))
|
|
|
+
|
|
|
Text(
|
|
|
text = "Рестораны",
|
|
|
style = MaterialTheme.typography.headlineMedium,
|
|
|
fontWeight = FontWeight.Bold,
|
|
|
- color = MaterialTheme.colorScheme.onBackground
|
|
|
+ color = MaterialTheme.colorScheme.onBackground,
|
|
|
+ textAlign = TextAlign.Center,
|
|
|
+ fontSize = 25.sp
|
|
|
)
|
|
|
+
|
|
|
+ // Стрелка с отступом
|
|
|
IconButton(
|
|
|
- onClick = { navHost.navigate("Cinema") }
|
|
|
+ onClick = { navHost.navigate("Cinema") },
|
|
|
+ modifier = Modifier.padding(start = 8.dp) // Отступ слева для стрелки
|
|
|
) {
|
|
|
Icon(
|
|
|
imageVector = Icons.Default.ArrowForward,
|
|
@@ -111,7 +128,8 @@ fun Restaurants(navHost: NavHostController) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Загрузка автомобилей
|
|
|
+
|
|
|
+ // Загрузка ресторанов
|
|
|
if (loadingRest) {
|
|
|
Box(
|
|
|
modifier = Modifier.fillMaxSize(),
|
|
@@ -120,7 +138,7 @@ fun Restaurants(navHost: NavHostController) {
|
|
|
CircularProgressIndicator(modifier = Modifier.size(72.dp))
|
|
|
}
|
|
|
} else {
|
|
|
- // Список автомобилей
|
|
|
+ // Список ресторанов
|
|
|
LazyColumn(
|
|
|
modifier = Modifier
|
|
|
.fillMaxHeight(0.9f) // Оставляем немного места для кнопки
|
|
@@ -133,31 +151,11 @@ fun Restaurants(navHost: NavHostController) {
|
|
|
.fillMaxWidth()
|
|
|
.padding(8.dp),
|
|
|
elevation = CardDefaults.cardElevation(0.dp),
|
|
|
- shape = RoundedCornerShape(8.dp),
|
|
|
- colors = CardDefaults.cardColors(containerColor = Color(0XFFcce6ff))
|
|
|
+ shape = RoundedCornerShape(20.dp),
|
|
|
+ colors = CardDefaults.cardColors(containerColor = Color.White),
|
|
|
+ border = BorderStroke(0.5.dp, Color.LightGray) // Светло-серая окантовка
|
|
|
) {
|
|
|
Column(modifier = Modifier.fillMaxWidth()) {
|
|
|
- Text(
|
|
|
- text = "${restaurant.name}",
|
|
|
- style = MaterialTheme.typography.titleMedium,
|
|
|
- fontWeight = FontWeight.SemiBold,
|
|
|
- fontSize = 18.sp,
|
|
|
- modifier = Modifier.padding(16.dp)
|
|
|
- )
|
|
|
- Text(
|
|
|
- text = "${restaurant.location}",
|
|
|
- style = MaterialTheme.typography.titleMedium,
|
|
|
- fontWeight = FontWeight.SemiBold,
|
|
|
- fontSize = 18.sp,
|
|
|
- modifier = Modifier.padding(16.dp)
|
|
|
- )
|
|
|
- Text(
|
|
|
- text = "${restaurant.cuisin}",
|
|
|
- style = MaterialTheme.typography.titleMedium,
|
|
|
- fontWeight = FontWeight.SemiBold,
|
|
|
- fontSize = 18.sp,
|
|
|
- modifier = Modifier.padding(16.dp)
|
|
|
- )
|
|
|
val painter = rememberImagePainter(
|
|
|
data = restaurant.picture,
|
|
|
builder = {
|
|
@@ -170,14 +168,54 @@ fun Restaurants(navHost: NavHostController) {
|
|
|
contentDescription = "Фото ресторана",
|
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
|
- .height(200.dp),
|
|
|
+ .height(190.dp),
|
|
|
contentScale = ContentScale.Crop
|
|
|
)
|
|
|
+ Spacer(modifier = Modifier.height(10.dp))
|
|
|
+ // Информация о ресторане
|
|
|
+ Text(
|
|
|
+ text = "Название: ${restaurant.name}",
|
|
|
+ style = MaterialTheme.typography.titleMedium,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ modifier = Modifier.padding(horizontal = 10.dp)
|
|
|
+ .padding(start = 3.dp),
|
|
|
+ fontFamily = montserratRegular
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Адрес: ${restaurant.location}",
|
|
|
+ style = MaterialTheme.typography.titleMedium,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ modifier = Modifier.padding(horizontal = 10.dp)
|
|
|
+ .padding(start = 3.dp),
|
|
|
+ fontFamily = montserratRegular
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Кухня: ${restaurant.cuisin}",
|
|
|
+ style = MaterialTheme.typography.titleMedium,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ modifier = Modifier.padding(horizontal = 10.dp)
|
|
|
+ .padding(start = 3.dp),
|
|
|
+ fontFamily = montserratRegular,
|
|
|
+
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ text = "Посмотреть на карте",
|
|
|
+ style = MaterialTheme.typography.titleMedium,
|
|
|
+ fontWeight = FontWeight.SemiBold,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ modifier = Modifier.padding(horizontal = 10.dp)
|
|
|
+ .padding(start = 3.dp),
|
|
|
+ fontFamily = montserratMedium,
|
|
|
+ color = Color(0xFF72C3F1)
|
|
|
+ )
|
|
|
+ Spacer(modifier = Modifier.height(10.dp))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
// val userId = Constants.supabase.auth.currentUserOrNull()?.id
|
|
@@ -203,8 +241,6 @@ fun Restaurants(navHost: NavHostController) {
|
|
|
// Text("Добавить новый автомобиль", fontSize = 18.sp)
|
|
|
// }
|
|
|
// }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
|
|
|
|