mirror of
https://github.com/AdrianKuta/KahootQuiz.git
synced 2025-09-16 18:14:22 +02:00
feat: Implement QuizScreen and basic navigation structure
This commit introduces the `QuizScreen` composable, its associated `QuizScreenViewModel`, and sets up the basic navigation graph for the application. Key changes: - **UI Layer (`ui:quiz` module):** - Added `QuizScreen.kt` with a basic composable structure. - Implemented `QuizScreenViewModel.kt` which fetches quiz data using `GetQuizUseCase` and exposes it via `QuizUiState`. - Created `QuizUiState` data class to hold the quiz data for the UI. - Added `navigation/QuizNavigation.kt` to define the `QuizRoute` and `quizScreen` navigation extension. - Updated `ui/quiz/build.gradle.kts` to include dependencies for Hilt navigation and Timber. - **App Module (`app` module):** - Created `KahootQuizApp.kt` which sets up the main `Scaffold` and includes the navigation graph. - Added `KahootQuizNavGraph.kt` to define the `NavHost` and integrate the `quizScreen`. - Modified `MainActivity.kt` to call the new `KahootQuizApp` composable, removing the previous direct use case call and UI. - **Data Layer (`model:data` module):** - Updated `QuizMapper.kt` to convert `time` from `Long?` to `Duration?` (using `milliseconds`) when mapping `QuestionDto` to the domain `Question` model.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package dev.adriankuta.kahootquiz
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import dev.adriankuta.kahootquiz.ui.quiz.navigation.QuizRoute
|
||||
import dev.adriankuta.kahootquiz.ui.quiz.navigation.quizScreen
|
||||
|
||||
@Composable
|
||||
fun KahootQuizNavGraph(
|
||||
modifier: Modifier = Modifier,
|
||||
navController: NavHostController = rememberNavController(),
|
||||
) {
|
||||
NavHost(
|
||||
navController = navController,
|
||||
startDestination = QuizRoute,
|
||||
modifier = modifier
|
||||
) {
|
||||
quizScreen()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user