Skip to content

Commit

Permalink
[FEATURE] #130 : survey Detail 페이지 로딩 Lottie 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 18, 2024
1 parent 8e2dcc3 commit 3639ef4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.wap.wapp.feature.survey.check.detail

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand All @@ -18,6 +19,7 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.wap.designsystem.WappTheme
import com.wap.designsystem.component.CircleLoader
import com.wap.designsystem.component.WappButton
import com.wap.wapp.core.commmon.extensions.toSupportingText
import com.wap.wapp.core.model.survey.QuestionType
Expand Down Expand Up @@ -92,7 +94,11 @@ internal fun SurveyDetailScreen(
verticalArrangement = Arrangement.spacedBy(32.dp),
) {
when (surveyUiState) {
is SurveyDetailViewModel.SurveyUiState.Init -> {}
is SurveyDetailViewModel.SurveyUiState.Loading -> {
Spacer(modifier = Modifier.weight(1f))
CircleLoader(modifier = Modifier.fillMaxSize())
Spacer(modifier = Modifier.weight(1f))
}

is SurveyDetailViewModel.SurveyUiState.Success -> {
SurveyInformationCard(
Expand All @@ -107,13 +113,9 @@ internal fun SurveyDetailScreen(
) {
surveyUiState.survey.surveyAnswerList.forEach { surveyAnswer ->
when (surveyAnswer.questionType) {
QuestionType.OBJECTIVE -> {
ObjectiveQuestionCard(surveyAnswer)
}
QuestionType.OBJECTIVE -> ObjectiveQuestionCard(surveyAnswer)

QuestionType.SUBJECTIVE -> {
SubjectiveQuestionCard(surveyAnswer)
}
QuestionType.SUBJECTIVE -> SubjectiveQuestionCard(surveyAnswer)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SurveyDetailViewModel @Inject constructor(
val errorFlow: SharedFlow<Throwable> = _errorFlow.asSharedFlow()

private val _surveyUiState: MutableStateFlow<SurveyUiState> =
MutableStateFlow(SurveyUiState.Init)
MutableStateFlow(SurveyUiState.Loading)
val surveyUiState: StateFlow<SurveyUiState> = _surveyUiState.asStateFlow()

fun getSurvey(surveyId: String) {
Expand All @@ -38,8 +38,7 @@ class SurveyDetailViewModel @Inject constructor(
}

sealed class SurveyUiState {
data object Init : SurveyUiState()

data object Loading : SurveyUiState()
data class Success(val survey: Survey) : SurveyUiState()
}
}

0 comments on commit 3639ef4

Please sign in to comment.