You've already forked RekomenciMobile
feat: added template for resume details screen
This commit is contained in:
@@ -15,5 +15,10 @@ sealed class AppDestination(val route: String) {
|
||||
|
||||
data object Profile : AppDestination("app/profile")
|
||||
|
||||
data object FillProfile : AppDestination("app/fill_profile")
|
||||
data object FillProfile : AppDestination("app/fill_profile")
|
||||
|
||||
data object ResumeDetails : AppDestination("resume/details") {
|
||||
const val ARG_ID = "id"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-24
@@ -1,9 +1,11 @@
|
||||
package com.prodhack.moscow2025.presentation.navigation
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
@@ -13,6 +15,7 @@ import com.prodhack.moscow2025.presentation.screens.fillProfile.FillProfileScree
|
||||
import com.prodhack.moscow2025.presentation.screens.login.LoginScreen
|
||||
import com.prodhack.moscow2025.presentation.screens.profile.ProfileScreen
|
||||
import com.prodhack.moscow2025.presentation.screens.register.RegisterScreen
|
||||
import com.prodhack.moscow2025.presentation.screens.resumeDetails.ResumeDetailsScreen
|
||||
import com.prodhack.moscow2025.presentation.utils.ErrorCallbacks
|
||||
import com.prodhack.moscow2025.presentation.utils.ErrorCollectorScope
|
||||
import org.koin.compose.viewmodel.koinActivityViewModel
|
||||
@@ -74,32 +77,40 @@ fun TTasksNavHost(
|
||||
)
|
||||
}
|
||||
|
||||
composable(AppDestination.FillProfile.route) {
|
||||
FillProfileScreen(
|
||||
snackbarHostState = snackbarHostState,
|
||||
onSuccess = {
|
||||
navController.navigate(AppDestination.Main.route) {
|
||||
popUpTo(AppDestination.FillProfile.route) {
|
||||
inclusive = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
composable(AppDestination.Main.route) {
|
||||
MainScreen()
|
||||
composable(AppDestination.FillProfile.route) {
|
||||
FillProfileScreen(
|
||||
snackbarHostState = snackbarHostState,
|
||||
onSuccess = {
|
||||
navController.navigate(AppDestination.Main.route) {
|
||||
popUpTo(AppDestination.FillProfile.route) {
|
||||
inclusive = true
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
composable(AppDestination.Profile.route)
|
||||
{
|
||||
ProfileScreen(
|
||||
snackbarHostState = snackbarHostState,
|
||||
navigateToLoginScreen = {
|
||||
navController.navigate(AppDestination.Login.route)
|
||||
}
|
||||
)
|
||||
}
|
||||
composable(AppDestination.Main.route) {
|
||||
MainScreen(openResumeDetails = { id ->
|
||||
navController.navigate(AppDestination.ResumeDetails.route, Bundle().apply {
|
||||
putString(AppDestination.ResumeDetails.ARG_ID, id)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
composable(AppDestination.Profile.route)
|
||||
{
|
||||
ProfileScreen(
|
||||
snackbarHostState = snackbarHostState,
|
||||
navigateToLoginScreen = {
|
||||
navController.navigate(AppDestination.Login.route)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
composable(AppDestination.ResumeDetails.route) {
|
||||
ResumeDetailsScreen(navBackStackEntry = it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.prodhack.moscow2025.presentation.navigation
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.navigation.Navigator
|
||||
|
||||
fun NavController.navigate(
|
||||
route: String,
|
||||
args: Bundle
|
||||
) {
|
||||
val nodeId = graph.findNode(route = route)?.id
|
||||
if (nodeId != null) {
|
||||
navigate(nodeId, args, null, null)
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ import org.koin.androidx.compose.koinViewModel
|
||||
@Composable
|
||||
fun ErrorCollectorScope.MainScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
openResumeDetails: (String) -> Unit,
|
||||
viewModel: MainScreenViewModel = koinViewModel()
|
||||
) {
|
||||
val typography = MaterialTheme.typography
|
||||
@@ -100,10 +101,9 @@ fun ErrorCollectorScope.MainScreen(
|
||||
)
|
||||
) {
|
||||
items(items.itemCount) {
|
||||
val resume = items[it]
|
||||
resume?.let {
|
||||
ResumeShortInfoCard(info = it) {
|
||||
|
||||
items[it]?.let { resume ->
|
||||
ResumeShortInfoCard(info = resume) {
|
||||
openResumeDetails(resume.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.prodhack.moscow2025.presentation.screens.resumeDetails
|
||||
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NavBackStackEntry
|
||||
import com.prodhack.moscow2025.presentation.navigation.AppDestination
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
import org.koin.core.parameter.parametersOf
|
||||
|
||||
@Composable
|
||||
fun ResumeDetailsScreen(
|
||||
navBackStackEntry: NavBackStackEntry,
|
||||
viewModel: ResumeDetailsViewModel = koinViewModel {
|
||||
parametersOf(
|
||||
navBackStackEntry.arguments?.getString(AppDestination.ResumeDetails.ARG_ID, "") ?: ""
|
||||
)
|
||||
}
|
||||
) {
|
||||
|
||||
Text("Opened resume details for id ${navBackStackEntry.arguments?.getString(AppDestination.ResumeDetails.ARG_ID, "") ?: ""}")
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.prodhack.moscow2025.presentation.screens.resumeDetails
|
||||
|
||||
import com.prodhack.moscow2025.presentation.utils.base.BaseViewModel
|
||||
import org.koin.android.annotation.KoinViewModel
|
||||
import org.koin.core.annotation.Provided
|
||||
|
||||
@KoinViewModel
|
||||
class ResumeDetailsViewModel(
|
||||
@Provided resumeId: String
|
||||
) : BaseViewModel() {
|
||||
}
|
||||
Reference in New Issue
Block a user