فهرست منبع

App: разбиение кода на модули и вывод данных

Blueris 5 روز پیش
والد
کامیت
260de993e5

+ 1 - 1
OscellaMobile/.idea/deploymentTargetSelector.xml

@@ -2,7 +2,7 @@
 <project version="4">
   <component name="deploymentTargetSelector">
     <selectionStates>
-      <SelectionState runConfigName="app">
+      <SelectionState runConfigName="Unnamed">
         <option name="selectionMode" value="DROPDOWN" />
       </SelectionState>
     </selectionStates>

+ 24 - 9
OscellaMobile/app/build.gradle.kts

@@ -1,7 +1,7 @@
 plugins {
     alias(libs.plugins.android.application)
-    alias(libs.plugins.kotlin.android)
-    kotlin("plugin.serialization") version "1.5.30"
+    alias(libs.plugins.jetbrains.kotlin.android)
+    kotlin("plugin.serialization") version "1.9.22"
 }
 
 android {
@@ -10,7 +10,7 @@ android {
 
     defaultConfig {
         applicationId = "com.example.oscellamobile"
-        minSdk = 33
+        minSdk = 26
         targetSdk = 34
         versionCode = 1
         versionName = "1.0"
@@ -51,7 +51,6 @@ android {
 }
 
 dependencies {
-
     implementation(libs.androidx.core.ktx)
     implementation(libs.androidx.lifecycle.runtime.ktx)
     implementation(libs.androidx.activity.compose)
@@ -62,6 +61,10 @@ dependencies {
     implementation(libs.androidx.material3)
     implementation(libs.androidx.navigation.runtime.ktx)
     implementation(libs.androidx.navigation.compose)
+    implementation(libs.androidx.runtime.android)
+    implementation(libs.androidx.ui.android)
+    implementation(libs.volley)
+    implementation(libs.androidx.espresso.core)
     testImplementation(libs.junit)
     androidTestImplementation(libs.androidx.junit)
     androidTestImplementation(libs.androidx.espresso.core)
@@ -69,13 +72,25 @@ dependencies {
     androidTestImplementation(libs.androidx.ui.test.junit4)
     debugImplementation(libs.androidx.ui.tooling)
     debugImplementation(libs.androidx.ui.test.manifest)
+    implementation(libs.androidx.material)
+
 
-    implementation(platform(libs.bom))
-    implementation(libs.postgrest.kt)
-    implementation(libs.auth.kt)
+    implementation(platform(libs.bom.v261))
+    implementation(libs.io.github.jan.tennert.supabase.postgrest.kt2)
+    implementation(libs.io.github.jan.tennert.supabase.postgrest.kt)
+    implementation(libs.io.github.jan.tennert.supabase.gotrue.kt)
+    implementation(libs.io.github.jan.tennert.supabase.gotrue.kt2)
+    implementation(libs.github.realtime.kt)
+    implementation(libs.storage.kt.v190)
     implementation(libs.ktor.client.android)
-    implementation(libs.storage.kt)
+    implementation ("androidx.compose.ui:ui:1.3.0") // или ваша версия Compose
+    implementation ("androidx.compose.material:material:1.3.0") // для Material Design компонентов
+    implementation ("androidx.compose.ui:ui-tooling-preview:1.3.0") // для предварительного просмотра
+    implementation ("androidx.activity:activity-compose:1.6.0")
 
+    implementation(libs.coil.compose)
 
     implementation (libs.accompanist.systemuicontroller)
-}
+}
+
+

+ 3 - 3
OscellaMobile/app/src/main/java/com/example/oscellamobile/Auth.kt

@@ -4,9 +4,9 @@ import androidx.lifecycle.ViewModel
 import androidx.lifecycle.viewModelScope
 import androidx.navigation.NavController
 import com.example.oscellamobile.domain.utlis.Constant
-import io.github.jan.supabase.auth.auth
-import io.github.jan.supabase.auth.providers.builtin.Email
-import io.github.jan.supabase.auth.providers.builtin.OTP
+import io.github.jan.supabase.gotrue.auth
+import io.github.jan.supabase.gotrue.providers.builtin.Email
+import io.github.jan.supabase.gotrue.providers.builtin.OTP
 import kotlinx.coroutines.launch
 
 

+ 9 - 8
OscellaMobile/app/src/main/java/com/example/oscellamobile/MainActivity.kt

@@ -7,6 +7,8 @@ import androidx.activity.enableEdgeToEdge
 import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Column
 import androidx.compose.ui.Alignment
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.tooling.preview.Preview
 import com.example.oscellamobile.Navigation.Navigation
 
 class MainActivity : ComponentActivity() {
@@ -14,13 +16,12 @@ class MainActivity : ComponentActivity() {
         super.onCreate(savedInstanceState)
         enableEdgeToEdge()
         setContent {
-                Column(
-                    verticalArrangement = Arrangement.Center,
-                    horizontalAlignment = Alignment.CenterHorizontally
-                ) {
-
-                    Navigation()
-                }
+            Column(
+                verticalArrangement = Arrangement.Center,
+                horizontalAlignment = Alignment.CenterHorizontally
+            ) {
+                Navigation()
             }
         }
-    }
+    }
+}

+ 1 - 1
OscellaMobile/app/src/main/java/com/example/oscellamobile/domain/utlis/Constant.kt

@@ -1,7 +1,7 @@
 package com.example.oscellamobile.domain.utlis
 
-import io.github.jan.supabase.auth.Auth
 import io.github.jan.supabase.createSupabaseClient
+import io.github.jan.supabase.gotrue.Auth
 import io.github.jan.supabase.postgrest.Postgrest
 import io.github.jan.supabase.storage.Storage
 

+ 10 - 0
OscellaMobile/app/src/main/java/com/example/oscellamobile/models/Company.kt

@@ -0,0 +1,10 @@
+package com.example.oscellamobile.models
+
+import kotlinx.serialization.Serializable
+
+@Serializable
+data class Company(var id: Int,
+var name_company: String?,
+var picture: String,
+var description: String?
+)

+ 2 - 2
OscellaMobile/app/src/main/java/com/example/oscellamobile/models/Game.kt

@@ -7,12 +7,12 @@ data class Game(
     val id: Int,
     val name_game: String,
     val description: String?,
-    val company: Int?,
+    val company: Int,
     val picture: String?,
     val views: Int?,
     val favourites: Int?,
     val age_rating: Int?,
     val link_torrent: String?,
     val link_oficial: String?,
-    val short_description: String?
+    val short_description: String
 )

+ 11 - 11
OscellaMobile/app/src/main/java/com/example/oscellamobile/screens/Auth.kt

@@ -1,5 +1,6 @@
 package com.example.oscellamobile.screens
 
+import android.R
 import android.icu.text.ListFormatter.Width
 import androidx.compose.foundation.Canvas
 import androidx.compose.foundation.background
@@ -34,14 +35,13 @@ import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import androidx.navigation.NavHostController
 import com.example.oscellamobile.Auth
-import com.example.oscellamobile.R
 import org.w3c.dom.Text
 
 @OptIn(ExperimentalMaterial3Api::class)
 @Composable
 fun Auth(navController: NavHostController) {
     val viewModel = Auth()
-    val kdamFontFamily = FontFamily(Font(R.font.kdam))
+    //val kdamFontFamily = FontFamily(Font(R.font.kdam))
     val email = remember { mutableStateOf("") }
     val password = remember { mutableStateOf("") }
 
@@ -90,13 +90,13 @@ fun Auth(navController: NavHostController) {
         Spacer(modifier = Modifier.height(180.dp))
         Text(
             text = "Oscella", fontSize = 40.sp,
-            fontFamily = kdamFontFamily
+            //fontFamily = kdamFontFamily
         )
         Spacer(modifier = Modifier.height(29.dp))
         TextField(
             value = email.value,
             onValueChange = { newText -> email.value = newText },
-            placeholder = { Text("Email", fontSize = 24.sp, fontFamily = kdamFontFamily) },
+            //placeholder = { Text("Email", fontSize = 24.sp, fontFamily = kdamFontFamily) },
             shape = RoundedCornerShape(20.dp),
             colors = TextFieldDefaults.textFieldColors(
                 focusedIndicatorColor = Color.Transparent,
@@ -104,7 +104,7 @@ fun Auth(navController: NavHostController) {
             ),
             textStyle = TextStyle(
                 fontSize = 20.sp,
-                fontFamily = kdamFontFamily
+                //fontFamily = kdamFontFamily
             ),
             modifier = Modifier
                 .width(330.dp)
@@ -114,7 +114,7 @@ fun Auth(navController: NavHostController) {
         TextField(
             value = password.value,
             onValueChange = {newText -> password.value = newText},
-            placeholder = { Text("Password", fontSize = 24.sp, fontFamily = kdamFontFamily) },
+            //placeholder = { Text("Password", fontSize = 24.sp, fontFamily = kdamFontFamily) },
             shape = RoundedCornerShape(20.dp),
             colors = TextFieldDefaults.textFieldColors(
                 focusedIndicatorColor = Color.Transparent,
@@ -122,7 +122,7 @@ fun Auth(navController: NavHostController) {
             ),
             textStyle = TextStyle(
                 fontSize = 20.sp,
-                fontFamily = kdamFontFamily
+                //fontFamily = kdamFontFamily
             ),
             modifier = Modifier
                 .width(330.dp)
@@ -143,12 +143,12 @@ fun Auth(navController: NavHostController) {
             )
 
         ) {
-            Text("Login", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
+           // Text("Login", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
         }
         Text(
             text = "Don’t have account?",
             color = Color.White,
-            fontFamily = kdamFontFamily,
+            //fontFamily = kdamFontFamily,
             fontSize = 14.sp
         )
         Spacer(modifier = Modifier.height(10.dp))
@@ -166,7 +166,7 @@ fun Auth(navController: NavHostController) {
                 )
 
             ) {
-                Text("SignUp", color = Color.White, fontFamily = kdamFontFamily, fontSize = 14.sp)
+             //   Text("SignUp", color = Color.White, fontFamily = kdamFontFamily, fontSize = 14.sp)
             }
             Spacer(modifier = Modifier.width(16.dp))
             Button(
@@ -180,7 +180,7 @@ fun Auth(navController: NavHostController) {
                 )
 
             ) {
-                Text("Guest", color = Color.White, fontFamily = kdamFontFamily, fontSize = 14.sp)
+               // Text("Guest", color = Color.White, fontFamily = kdamFontFamily, fontSize = 14.sp)
             }
         }
     }

+ 4 - 5
OscellaMobile/app/src/main/java/com/example/oscellamobile/screens/AuthWithEmail.kt

@@ -32,13 +32,12 @@ import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import androidx.navigation.NavHostController
-import com.example.oscellamobile.R
 import org.w3c.dom.Text
 
 @OptIn(ExperimentalMaterial3Api::class)
 @Composable
 fun AuthWithEmail(navController: NavHostController) {
-    val kdamFontFamily = FontFamily(Font(R.font.kdam))
+   // val kdamFontFamily = FontFamily(Font(R.font.kdam))
     var text = ""
 
     val gradientButton = Brush.linearGradient(
@@ -86,13 +85,13 @@ fun AuthWithEmail(navController: NavHostController) {
         Spacer(modifier = Modifier.height(180.dp))
         Text(
             text = "Oscella", fontSize = 40.sp,
-            fontFamily = kdamFontFamily
+           // fontFamily = kdamFontFamily
         )
         Spacer(modifier = Modifier.height(60.dp))
         TextField(
             value = text,
             onValueChange = { text = it },
-            placeholder = { Text("Enter Code", fontSize = 24.sp, fontFamily = kdamFontFamily) },
+          //  placeholder = { Text("Enter Code", fontSize = 24.sp, fontFamily = kdamFontFamily) },
             shape = RoundedCornerShape(20.dp),
             colors = TextFieldDefaults.textFieldColors(
                 focusedIndicatorColor = Color.Transparent,
@@ -115,7 +114,7 @@ fun AuthWithEmail(navController: NavHostController) {
             )
 
         ) {
-            Text("Login", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
+       //     Text("Login", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
         }
     }
 }

+ 254 - 214
OscellaMobile/app/src/main/java/com/example/oscellamobile/screens/MainWindow.kt

@@ -55,7 +55,7 @@ import androidx.compose.ui.text.style.TextAlign
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import androidx.navigation.NavHostController
-import com.example.oscellamobile.R
+import coil.compose.rememberAsyncImagePainter
 import com.example.oscellamobile.domain.utlis.Constant
 import com.example.oscellamobile.models.Game
 import com.google.accompanist.systemuicontroller.rememberSystemUiController
@@ -63,21 +63,50 @@ import io.github.jan.supabase.postgrest.from
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.withContext
-import org.intellij.lang.annotations.JdkConstants.HorizontalAlignment
 import kotlin.math.cos
 import kotlin.math.sin
+import com.example.oscellamobile.R
+import com.example.oscellamobile.models.Company
+import coil.compose.AsyncImagePainter
+import coil.compose.rememberAsyncImagePainter
+import coil.request.ImageRequest
+import coil.size.Size
+import org.intellij.lang.annotations.JdkConstants
+
+
+val kdamFontFamily = FontFamily(Font(R.font.kdam))
+val playfairdisplay = FontFamily(Font(R.font.playfair))
+val caveat = FontFamily(Font(R.font.caveat))
+val ibmplexmono = FontFamily(Font(R.font.ibm))
 
+val gradientButton = Brush.linearGradient(
+    colors = listOf(
+        Color(0xFFE71D36),
+        Color(0xFFFF9F1C)
+    ),
+    start = Offset(30f, 30f),
+    end = Offset(200f, 200f)
+)
+
+val gradientBox = Brush.linearGradient(
+    colors = listOf(
+        Color(0xFFFDFFFC),
+        Color(0xFF2EC4B6)
+    ),
+    start = Offset(0f, 0f)
+)
 
 @Composable
 fun MainWindow(navController: NavHostController) {
 
     var games by remember { mutableStateOf<List<Game>>(listOf()) }
+    var сompany by remember { mutableStateOf<List<Company>>(listOf()) }
 
     LaunchedEffect(Unit) {
         withContext(Dispatchers.IO) {
             try {
-                games = Constant.supabase.from("Game")
-                    .select().decodeList<Game>()
+                сompany = Constant.supabase.from("Company").select().decodeList<Company>()
+                games = Constant.supabase.from("Game").select().decodeList<Game>()
                 games.forEach { Game ->
                     Log.d("C", Game.name_game)
                 }
@@ -89,34 +118,12 @@ fun MainWindow(navController: NavHostController) {
 
     val systemUiController = rememberSystemUiController()
 
-    // Automatically hide the status bar when the composable is first displayed
     LaunchedEffect(Unit) {
-        systemUiController.isStatusBarVisible = false // Hide the status bar by default
-        delay(5000) // Keep it visible for 5 seconds (if needed, you can adjust this)
-        systemUiController.isStatusBarVisible = false // Ensure it stays hidden
+        systemUiController.isStatusBarVisible = false
+        delay(5000)
+        systemUiController.isStatusBarVisible = false
     }
 
-    val gradientButton = Brush.linearGradient(
-        colors = listOf(
-            Color(0xFFE71D36),
-            Color(0xFFFF9F1C)
-        ),
-        start = Offset(30f, 30f),
-        end = Offset(200f, 200f)
-    )
-
-    val gradientBox = Brush.linearGradient(
-        colors = listOf(
-            Color(0xFFFDFFFC),
-            Color(0xFF2EC4B6)
-        ),
-        start = Offset(0f, 0f)
-    )
-
-    val kdamFontFamily = FontFamily(Font(R.font.kdam))
-    val playfairdisplay = FontFamily(Font(R.font.playfair))
-    val caveat = FontFamily(Font(R.font.caveat))
-    val ibmplexmono = FontFamily(Font(R.font.ibm))
     Canvas(
         modifier = Modifier
             .fillMaxWidth()
@@ -146,7 +153,7 @@ fun MainWindow(navController: NavHostController) {
             Spacer(modifier = Modifier.width(145.dp))
             Image(
                 painter = painterResource(id = R.drawable.personall),
-                contentDescription = "Описание изображения",
+              contentDescription = "Описание изображения",
                 modifier = Modifier.size(90.dp)
             )
         }
@@ -234,235 +241,268 @@ fun MainWindow(navController: NavHostController) {
             Spacer(Modifier.width(10.dp))
         }
         Spacer(Modifier.height(100.dp))
-
         LazyColumn {
             items(
                 games,
                 key = { Game -> Game.id },
-            ) { Game->
-                Card(
-                    modifier = Modifier
-                        .padding(20.dp, 0.dp, 20.dp, 0.dp)
-                        .background(color = Color(0xFFFDFFFC), shape = RoundedCornerShape(15.dp)),
-                ) {
-                    Row {
-                        Spacer(Modifier.width(10.dp))
+            ) { film ->
+                GameItem(
+                    game = film,
+                    company = сompany
+                )
+            }
+        }
+    }
+}
+
+@Composable
+    fun GameItem(
+        game: Game,
+        company: List<Company>,
+    ) {
+    val imageState = rememberAsyncImagePainter(
+        model = ImageRequest.Builder(LocalContext.current).data(game.picture)
+            .size(Size.ORIGINAL).build()
+    ).state
+
+        Card(
+            modifier = Modifier
+                .padding(20.dp, 10.dp)
+                .background(color = Color(0xFFFDFFFC), shape = RoundedCornerShape(15.dp)),
+        ) {
+            Row {
+                Spacer(Modifier.width(10.dp))
+                Column {
+                    val companyId = game.company
+                    val companyy = company.find { it.id == companyId }
+                    if (company != null) {
+                        Text(
+                            "${companyy?.name_company}",
+                            fontSize = 20.sp,
+                            fontFamily = kdamFontFamily,
+                            color = Color(0xFF2EC4B6)
+                        )
+                        Text(
+                            text = "Фэнтези",
+                            fontSize = 12.sp,
+                            fontFamily = kdamFontFamily,
+                            color = Color(0xFFE71D36)
+                        )
+                        Spacer(Modifier.width(20.dp))
                         Column {
                             Text(
-                                text = "Hoyoverse",
-                                fontSize = 20.sp,
-                                fontFamily = kdamFontFamily,
-                                color = Color(0xFF2EC4B6)
-                            )
-                            Text(
-                                text = "Фэнтези",
-                                fontSize = 12.sp,
+                                text = "Основные метки:",
+                                fontSize = 14.sp,
                                 fontFamily = kdamFontFamily,
-                                color = Color(0xFFE71D36)
+                                color = Color(0xFF7F807E)
                             )
-                            Spacer(Modifier.width(20.dp))
-                            Column {
-                                Text(
-                                    text = "Основные метки:",
-                                    fontSize = 14.sp,
-                                    fontFamily = kdamFontFamily,
-                                    color = Color(0xFF7F807E)
+                            Column(
+                                Modifier.padding(10.dp)
+                            ) {
+                                Box(
+                                    modifier = Modifier
+                                        .width(107.dp)
+                                        .height(22.dp)
+                                        .background(
+                                            color = Color(0xFF2EC4B6),
+                                            shape = RoundedCornerShape(20.dp)
+                                        ),
+                                    contentAlignment = Alignment.Center
                                 )
-                                Column(
-                                    Modifier.padding(10.dp)
-                                ) {
-                                    Box(
-                                        modifier = Modifier
-                                            .width(107.dp)
-                                            .height(22.dp)
-                                            .background(
-                                                color = Color(0xFF2EC4B6),
-                                                shape = RoundedCornerShape(20.dp)
-                                            ),
-                                        contentAlignment = Alignment.Center
-                                    )
-                                    {
-                                        Text(
-                                            text = "Пошаговая",
-                                            color = Color(0xFFFDFFFC),
-                                            fontFamily = caveat,
-                                            fontSize = 20.sp
-                                        )
-                                    }
-                                    Spacer(Modifier.height(7.dp))
-                                    Box(
-                                        modifier = Modifier
-                                            .width(107.dp)
-                                            .height(22.dp)
-                                            .background(
-                                                color = Color(0xFF2EC4B6),
-                                                shape = RoundedCornerShape(20.dp)
-                                            ),
-                                        contentAlignment = Alignment.Center
-                                    )
-                                    {
-                                        Text(
-                                            text = "Ролевая",
-                                            color = Color(0xFFFDFFFC),
-                                            fontFamily = caveat,
-                                            fontSize = 20.sp
-                                        )
-                                    }
-                                    Spacer(Modifier.height(7.dp))
-                                    Box(
-                                        modifier = Modifier
-                                            .width(107.dp)
-                                            .height(22.dp)
-                                            .background(
-                                                color = Color(0xFF2EC4B6),
-                                                shape = RoundedCornerShape(20.dp)
-                                            ),
-                                        contentAlignment = Alignment.Center
+                                {
+                                    Text(
+                                        text = "Пошаговая",
+                                        color = Color(0xFFFDFFFC),
+                                        fontFamily = caveat,
+                                        fontSize = 20.sp
                                     )
-                                    {
-                                        Text(
-                                            text = "Стратегия",
-                                            color = Color(0xFFFDFFFC),
-                                            fontFamily = caveat,
-                                            fontSize = 20.sp
-                                        )
-                                    }
                                 }
-                            }
-                        }
-                        Column {
-                            Row {
-                                Spacer(Modifier.width(45.dp))
+                                Spacer(Modifier.height(7.dp))
                                 Box(
                                     modifier = Modifier
-                                        .width(130.dp)
-                                        .height(30.dp)
-                                        .border(
-                                            BorderStroke(2.dp, Color(0x80B0B0B0)),
-                                            shape = RoundedCornerShape(15.dp)
-                                        )
+                                        .width(107.dp)
+                                        .height(22.dp)
+                                        .background(
+                                            color = Color(0xFF2EC4B6),
+                                            shape = RoundedCornerShape(20.dp)
+                                        ),
+                                    contentAlignment = Alignment.Center
                                 )
                                 {
                                     Text(
-                                        text = "Избранное: 23",
-                                        fontSize = 16.sp,
-                                        fontFamily = playfairdisplay,
-                                        color = Color(0xFFFF9F1C),
-                                        modifier = Modifier.align(Alignment.Center)
+                                        text = "Ролевая",
+                                        color = Color(0xFFFDFFFC),
+                                        fontFamily = caveat,
+                                        fontSize = 20.sp
                                     )
                                 }
-                                val size = 31.dp
-
-                                var isOrange by remember { mutableStateOf(false) }
-
-                                val buttonColor = if (isOrange) Color(0xFFFF9F1C) else Color.Gray
-
-                                Canvas(
+                                Spacer(Modifier.height(7.dp))
+                                Box(
                                     modifier = Modifier
-                                        .size(30.dp)
-                                        .clickable(onClick = { isOrange = !isOrange })
-                                ) {
-                                    drawStar(
-                                        center = center,
-                                        radius = size.toPx() / 2,
-                                        color = buttonColor
+                                        .width(107.dp)
+                                        .height(22.dp)
+                                        .background(
+                                            color = Color(0xFF2EC4B6),
+                                            shape = RoundedCornerShape(20.dp)
+                                        ),
+                                    contentAlignment = Alignment.Center
+                                )
+                                {
+                                    Text(
+                                        text = "Стратегия",
+                                        color = Color(0xFFFDFFFC),
+                                        fontFamily = caveat,
+                                        fontSize = 20.sp
                                     )
                                 }
                             }
-                            Row {
-                                Spacer(Modifier.width(10.dp))
-                                Text(
-                                    Game.name_game,
-                                    fontSize = 20.sp,
-                                    fontFamily = kdamFontFamily,
-                                    color = Color(0xFF7F807E),
-                                )
-                                Spacer(Modifier.width(10.dp))
-                                Text(
-                                    text = "16+",
-                                    fontSize = 20.sp,
-                                    fontFamily = kdamFontFamily,
-                                    color = Color(0xFFE71D36),
-                                )
-                            }
-                            Image(
-                                painter = painterResource(id = R.drawable.test),
-                                contentDescription = "Описание изображения",
-                                modifier = Modifier
-                                    .width(300.dp)
-                                    .height(138.dp)
-                            )
                         }
-
                     }
-                    Column {
-                        Box(
-                            modifier = Modifier
-                                .fillMaxWidth()
-                                .padding(5.dp)
-                                .background(brush = gradientBox, shape = RoundedCornerShape(10.dp))
-                        ) {
-                            Text(
-                                text = "История начинается с того, что два члена экипажа «Звёздного экспресса», Март 7 и Дань Хэн, доставляют редкие реликвии Герте, хозяйке космической станции. Внезапно рейнджеры пустоты из " +
-                                        "Легиона Антиматерии атакуют Космическую станцию и нападают на людей. К счастью, " +
-                                        "Март 7 и Дань Хэн, а также ведущий исследователь Аста " +
-                                        "и начальник службы безопасности Арлан смогли отбиться от них.",
-                                textAlign = TextAlign.Center,
-                                fontSize = 9.sp,
-                                fontFamily = ibmplexmono
-                            )
-                        }
-                        Spacer(modifier = Modifier.height(5.dp))
-                    }
-                    Row(
-                        modifier = Modifier
-                            .height(60.dp),
-
-                        ) {
+                }
+                Column {
+                    Row {
+                        Spacer(Modifier.width(45.dp))
                         Box(
                             modifier = Modifier
                                 .width(130.dp)
-                                .height(40.dp)
-                                .padding(5.dp, 5.dp, 0.dp, 0.dp)
+                                .height(30.dp)
                                 .border(
                                     BorderStroke(2.dp, Color(0x80B0B0B0)),
                                     shape = RoundedCornerShape(15.dp)
-                                ),
+                                )
                         )
                         {
                             Text(
-                                text = "Просмотры: 199",
-                                fontSize = 15.sp,
+                                text = if (game.favourites == null) {
+                                    "Избранное: 0"
+                                } else {
+                                    "Избранное: ${game.favourites}"
+                                },
+                                fontSize = 16.sp,
                                 fontFamily = playfairdisplay,
-                                color = Color(0xFFE71D36),
+                                color = Color(0xFFFF9F1C),
                                 modifier = Modifier.align(Alignment.Center)
                             )
                         }
-                        Spacer(modifier = Modifier.width(70.dp))
-                        Button(
-                            onClick = { /*TODO*/ }, modifier = Modifier
-                                .background(
-                                    color = Color(0xFFE71D36),
-                                    shape = RoundedCornerShape(20.dp)
-                                ),
-                            colors = ButtonDefaults.buttonColors(
-                                containerColor = Color.Transparent
-                            )
+                        val size = 31.dp
+
+                        var isOrange by remember { mutableStateOf(false) }
+
+                        val buttonColor = if (isOrange) Color(0xFFFF9F1C) else Color.Gray
+
+                        Canvas(
+                            modifier = Modifier
+                                .size(30.dp)
+                                .clickable(onClick = { isOrange = !isOrange })
                         ) {
-                            Text(
-                                text = "Подробности",
-                                textAlign = TextAlign.Center,
-                                fontFamily = playfairdisplay,
-                                fontSize = 16.sp,
-                                color = Color(0xFFFDFFFC)
+                            drawStar(
+                                center = center,
+                                radius = size.toPx() / 2,
+                                color = buttonColor
                             )
                         }
                     }
+                    Row(
+                        modifier = Modifier.fillMaxWidth(),
+                        horizontalArrangement = Arrangement.Center,
+                        verticalAlignment = Alignment.CenterVertically
+                    ) {
+                        Text(
+                            game.name_game,
+                            fontSize = 20.sp,
+                            fontFamily = kdamFontFamily,
+                            color = Color(0xFF7F807E),
+                        )
+                        Spacer(Modifier.width(10.dp))
+                        Text(
+                            text = "16+",
+                            fontSize = 20.sp,
+                            fontFamily = kdamFontFamily,
+                            color = Color(0xFFE71D36),
+                        )
+                    }
+                    if (imageState is AsyncImagePainter.State.Success) {
+                        {
+                        }
+                        Image(
+                            painter = imageState.painter,
+                            contentDescription = "Описание изображения",
+                            modifier = Modifier
+                                .width(300.dp)
+                                .height(138.dp)
+                        )
+                    }
+                }
+
+            }
+
+            Column {
+                Box(
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .padding(5.dp)
+                        .background(brush = gradientBox, shape = RoundedCornerShape(10.dp))
+                ) {
+                    Text(
+                        game.short_description,
+                        fontSize = 9.sp,
+                        textAlign = TextAlign.Center,
+                        fontFamily = ibmplexmono
+                    )
+                }
+                Spacer(modifier = Modifier.height(5.dp))
+            }
+            Row(
+                modifier = Modifier
+                    .height(60.dp),
+
+                ) {
+                Box(
+                    modifier = Modifier
+                        .width(130.dp)
+                        .height(40.dp)
+                        .padding(5.dp, 5.dp, 0.dp, 0.dp)
+                        .border(
+                            BorderStroke(2.dp, Color(0x80B0B0B0)),
+                            shape = RoundedCornerShape(15.dp)
+                        ),
+                )
+                {
+                    Text(
+                        text = if (game.views == null) {
+                            "Просмотры: 0"
+                        } else {
+                            "Просмотры: ${game.views}"
+                        },
+                        fontSize = 15.sp,
+                        fontFamily = playfairdisplay,
+                        color = Color(0xFFE71D36),
+                        modifier = Modifier.align(Alignment.Center)
+                    )
+                }
+                Spacer(modifier = Modifier.width(70.dp))
+                Button(
+                    onClick = { /*TODO*/ }, modifier = Modifier
+                        .background(
+                            color = Color(0xFFE71D36),
+                            shape = RoundedCornerShape(20.dp)
+                        ),
+                    colors = ButtonDefaults.buttonColors(
+                        containerColor = Color.Transparent
+                    )
+                ) {
+                    Text(
+                        text = "Подробности",
+                        textAlign = TextAlign.Center,
+                        fontFamily = playfairdisplay,
+                        fontSize = 16.sp,
+                        color = Color(0xFFFDFFFC)
+                    )
                 }
             }
         }
     }
-}
+
 
 fun DrawScope.drawStar(center: Offset, radius: Float, color: Color) {
     val path = androidx.compose.ui.graphics.Path()

+ 3 - 3
OscellaMobile/app/src/main/java/com/example/oscellamobile/screens/Registration.kt

@@ -32,8 +32,8 @@ import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import androidx.navigation.NavHostController
-import com.example.oscellamobile.R
 import org.w3c.dom.Text
+import com.example.oscellamobile.R
 
 @OptIn(ExperimentalMaterial3Api::class)
 @Composable
@@ -87,7 +87,7 @@ fun Registration(navController: NavHostController) {
         Spacer(modifier = Modifier.height(180.dp))
         Text(
             text = "Oscella", fontSize = 40.sp,
-            fontFamily = kdamFontFamily
+          fontFamily = kdamFontFamily
         )
         Spacer(modifier = Modifier.height(29.dp))
         TextField(
@@ -162,7 +162,7 @@ fun Registration(navController: NavHostController) {
             )
 
         ) {
-            Text("Send code", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
+             Text("Send code", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
         }
     }
 }

+ 3 - 3
OscellaMobile/app/src/main/java/com/example/oscellamobile/screens/RegistrationWithEmail.kt

@@ -32,8 +32,8 @@ import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import androidx.navigation.NavHostController
-import com.example.oscellamobile.R
 import org.w3c.dom.Text
+import com.example.oscellamobile.R
 
 @OptIn(ExperimentalMaterial3Api::class)
 @Composable
@@ -86,7 +86,7 @@ fun RegistrationWithEmail(navController: NavHostController) {
         Spacer(modifier = Modifier.height(180.dp))
         Text(
             text = "Oscella", fontSize = 40.sp,
-            fontFamily = kdamFontFamily
+           fontFamily = kdamFontFamily
         )
         Spacer(modifier = Modifier.height(60.dp))
         TextField(
@@ -115,7 +115,7 @@ fun RegistrationWithEmail(navController: NavHostController) {
             )
 
         ) {
-            Text("SignUp", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
+           Text("SignUp", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
         }
     }
 }

+ 6 - 6
OscellaMobile/app/src/main/java/com/example/oscellamobile/screens/SplashScreen.kt

@@ -15,12 +15,13 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.geometry.Offset
 import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.platform.LocalConfiguration
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.unit.dp
-import androidx.navigation.NavHostController
 import com.example.oscellamobile.R
+import androidx.navigation.NavHostController
 import kotlinx.coroutines.delay
 import org.intellij.lang.annotations.JdkConstants.HorizontalAlignment
 
@@ -59,10 +60,9 @@ fun SplashScreen(navController: NavHostController) {
         verticalArrangement = Arrangement.Center
     )
     {
-        Icon(
-            painter = painterResource(id = R.drawable.logo),
-            contentDescription = "",
-            modifier = Modifier.size(300.dp)
-        )
+       Icon(
+          painter = painterResource(id = R.drawable.logo),
+           contentDescription = "",
+          modifier = Modifier.size(300.dp))
     }
 }

+ 1 - 1
OscellaMobile/build.gradle.kts

@@ -1,5 +1,5 @@
 // Top-level build file where you can add configuration options common to all sub-projects/modules.
 plugins {
     alias(libs.plugins.android.application) apply false
-    alias(libs.plugins.kotlin.android) apply false
+    alias(libs.plugins.jetbrains.kotlin.android) apply false
 }

+ 47 - 17
OscellaMobile/gradle/libs.versions.toml

@@ -1,25 +1,45 @@
 [versions]
 accompanistSystemuicontroller = "0.36.0"
-agp = "8.5.1"
-bom = "3.0.1"
+agp = "8.6.0"
+bom = "VERSION"
+bomVersion = "2.0"
+coilComposeVersion = "2.4.0"
+githubBom = "2"
+githubBomVersion = "2.6.1"
 kotlin = "1.9.0"
-coreKtx = "1.13.1"
+coreKtx = "1.10.1"
 junit = "4.13.2"
-junitVersion = "1.2.1"
-espressoCore = "3.6.1"
-ktorClientAndroid = "3.0.1"
-lifecycleRuntimeKtx = "2.8.6"
-activityCompose = "1.9.3"
+junitVersion = "1.1.5"
+espressoCore = "3.5.1"
+ktorClientAndroid = "2.3.7"
+lifecycleRuntimeKtx = "2.6.1"
+activityCompose = "1.8.0"
 composeBom = "2024.04.01"
-navigationRuntimeKtx = "2.8.3"
-navigationCompose = "2.8.3"
-storageKt = "3.0.1"
-
+storageKt = "2.6.1"
+storageKtVersion = "1.9.0"
+navigationRuntimeKtx = "2.8.1"
+navigationCompose = "2.8.1"
+runtimeAndroid = "1.7.2"
+uiAndroid = "1.7.2"
+volley = "1.2.1"
+material = "1.7.5"
+coilCompose = "2.4.0"
 [libraries]
 accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanistSystemuicontroller" }
 androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
-auth-kt = { module = "io.github.jan-tennert.supabase:auth-kt" }
 bom = { module = "io.github.jan-tennert.supabase:bom", version.ref = "bom" }
+bom-v2 = { module = "io.github.jan-tennert.supabase:bom", version.ref = "githubBom" }
+bom-v20 = { module = "io.github.jan-tennert.supabase:bom", version.ref = "bomVersion" }
+bom-v261 = { module = "io.github.jan-tennert.supabase:bom", version.ref = "githubBomVersion" }
+coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coilComposeVersion" }
+github-gotrue-kt = { module = "io.github.jan-tennert.supabase:gotrue-kt", version.ref = "bom" }
+github-postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
+github-realtime-kt = { module = "io.github.jan-tennert.supabase:realtime-kt" }
+gotrue-kt = { module = "io.github.jan-tennert.supabase:gotrue-kt" }
+io-github-jan-tennert-supabase-gotrue-kt = { module = "io.github.jan-tennert.supabase:gotrue-kt" }
+io-github-jan-tennert-supabase-gotrue-kt2 = { module = "io.github.jan-tennert.supabase:gotrue-kt" }
+io-github-jan-tennert-supabase-postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
+io-github-jan-tennert-supabase-postgrest-kt2 = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
 junit = { group = "junit", name = "junit", version.ref = "junit" }
 androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
 androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
@@ -33,14 +53,24 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin
 androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
 androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
 androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
-androidx-navigation-runtime-ktx = { group = "androidx.navigation", name = "navigation-runtime-ktx", version.ref = "navigationRuntimeKtx" }
-androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
+androidx-material = { group = "androidx.compose.material", name = "material" }
 ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktorClientAndroid" }
+ktor-client-android_z = { module = "io.ktor:ktor-client-[android]" }
 postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
 realtime-kt = { module = "io.github.jan-tennert.supabase:realtime-kt" }
-storage-kt = { module = "io.github.jan-tennert.supabase:storage-kt", version.ref = "storageKt" }
+storage-kt = { module = "io.github.jan-tennert.supabase:storage-kt", version.ref = "bom" }
+storage-kt-v190 = { module = "io.github.jan-tennert.supabase:storage-kt", version.ref = "storageKtVersion" }
+storage-kt-v261 = { module = "io.github.jan-tennert.supabase:storage-kt", version.ref = "storageKt" }
+supabase-gotrue-kt = { module = "io.github.jan-tennert.supabase:gotrue-kt" }
+supabase-postgrest-kt = { module = "io.github.jan-tennert.supabase:postgrest-kt" }
+supabase-realtime-kt = { module = "io.github.jan-tennert.supabase:realtime-kt" }
+androidx-navigation-runtime-ktx = { group = "androidx.navigation", name = "navigation-runtime-ktx", version.ref = "navigationRuntimeKtx" }
+androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
+androidx-runtime-android = { group = "androidx.compose.runtime", name = "runtime-android", version.ref = "runtimeAndroid" }
+androidx-ui-android = { group = "androidx.compose.ui", name = "ui-android", version.ref = "uiAndroid" }
+volley = { group = "com.android.volley", name = "volley", version.ref = "volley" }
 
 [plugins]
 android-application = { id = "com.android.application", version.ref = "agp" }
-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
+jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }