From beff37bd62af7c86c27298650e391c641182b7c4 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sun, 18 Feb 2024 15:59:11 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[FEATURE]=20#130=20:=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EB=82=B4=EA=B0=80?= =?UTF-8?q?=20=EC=9E=91=EC=84=B1=ED=95=9C=20=EC=84=A4=EB=AC=B8=EC=9D=84=20?= =?UTF-8?q?=EB=B3=BC=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wap/wapp/feature/profile/ProfileScreen.kt | 5 +++++ .../feature/profile/component/WappSurveyHistoryRow.kt | 4 ++-- .../wapp/feature/profile/navigation/ProfileNavigation.kt | 2 ++ .../profile/profilesetting/component/UserProfile.kt | 8 +++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt index 78b7aac0..79e135e6 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/ProfileScreen.kt @@ -41,6 +41,7 @@ internal fun ProfileRoute( navigateToProfileSetting: (String) -> Unit, navigateToAttendance: () -> Unit, navigateToSignIn: () -> Unit, + navigateToSurveyDetail: (String) -> Unit, ) { val todayEventsState by viewModel.todayEvents.collectAsStateWithLifecycle() val recentEventsState by viewModel.recentEvents.collectAsStateWithLifecycle() @@ -67,6 +68,7 @@ internal fun ProfileRoute( navigateToProfileSetting = navigateToProfileSetting, navigateToAttendance = navigateToAttendance, navigateToSignIn = navigateToSignIn, + navigateToSurveyDetail = navigateToSurveyDetail, ) } @@ -81,6 +83,7 @@ internal fun ProfileScreen( navigateToProfileSetting: (String) -> Unit, navigateToAttendance: () -> Unit, navigateToSignIn: () -> Unit, + navigateToSurveyDetail: (String) -> Unit, ) { val scrollState = rememberScrollState() @@ -137,6 +140,7 @@ internal fun ProfileScreen( userRespondedSurveysState = userRespondedSurveysState, attendanceCardBoardColor = WappTheme.colors.blue4FF, navigateToAttendance = navigateToAttendance, + navigateToSurveyDetail = navigateToSurveyDetail, ) } @@ -161,6 +165,7 @@ internal fun ProfileScreen( userRespondedSurveysState = userRespondedSurveysState, attendanceCardBoardColor = WappTheme.colors.yellow34, navigateToAttendance = navigateToAttendance, + navigateToSurveyDetail = navigateToSurveyDetail, ) } diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/component/WappSurveyHistoryRow.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/component/WappSurveyHistoryRow.kt index da585a5f..4acbd438 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/component/WappSurveyHistoryRow.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/component/WappSurveyHistoryRow.kt @@ -19,13 +19,13 @@ import com.wap.wapp.core.model.survey.Survey internal fun WappSurveyHistoryRow( survey: Survey, modifier: Modifier = Modifier, - onClick: () -> Unit = {}, + onClick: (String) -> Unit, ) { Row( verticalAlignment = Alignment.CenterVertically, modifier = modifier .padding(horizontal = 10.dp) - .clickable { onClick() }, + .clickable { onClick(survey.surveyId) }, ) { Row( verticalAlignment = Alignment.CenterVertically, diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/navigation/ProfileNavigation.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/navigation/ProfileNavigation.kt index 0f428055..0bfff2eb 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/navigation/ProfileNavigation.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/navigation/ProfileNavigation.kt @@ -17,12 +17,14 @@ fun NavGraphBuilder.profileScreen( navigateToProfileSetting: (String) -> Unit, navigateToAttendance: () -> Unit, navigateToSignIn: () -> Unit, + navigateToSurveyDetail: (String) -> Unit, ) { composable(route = profileNavigationRoute) { ProfileRoute( navigateToProfileSetting = navigateToProfileSetting, navigateToAttendance = navigateToAttendance, navigateToSignIn = navigateToSignIn, + navigateToSurveyDetail = navigateToSurveyDetail, ) } } diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/UserProfile.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/UserProfile.kt index 69ec1923..d2d0488c 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/UserProfile.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/UserProfile.kt @@ -47,6 +47,7 @@ internal fun UserProfile( userRespondedSurveysState: ProfileViewModel.SurveysState, attendanceCardBoardColor: Color, navigateToAttendance: () -> Unit, + navigateToSurveyDetail: (String) -> Unit, ) { Column(modifier = Modifier.padding(horizontal = 10.dp)) { ProfileAttendanceCard( @@ -63,6 +64,7 @@ internal fun UserProfile( MySurveyHistory( userRespondedSurveysState = userRespondedSurveysState, + navigateToSurveyDetail = navigateToSurveyDetail, modifier = Modifier.padding(vertical = 20.dp), ) } @@ -204,6 +206,7 @@ private fun MyAttendanceStatus( @Composable private fun MySurveyHistory( userRespondedSurveysState: ProfileViewModel.SurveysState, + navigateToSurveyDetail: (String) -> Unit, modifier: Modifier = Modifier, ) { Column(modifier = modifier) { @@ -243,7 +246,10 @@ private fun MySurveyHistory( items = userRespondedSurveysState.surveys, key = { survey -> survey.surveyId }, ) { survey -> - WappSurveyHistoryRow(survey) + WappSurveyHistoryRow( + survey, + onClick = navigateToSurveyDetail, + ) } } } From 51e4f00c86e86a8d363abe7fbbf335fba0d4985c Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sun, 18 Feb 2024 16:01:40 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[FEATURE]=20#130=20:=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20->=20=EC=84=A4=EB=AC=B8=20=EC=9D=91=EB=8B=B5=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EC=8B=9C=20=EB=92=A4=EB=A1=9C=20?= =?UTF-8?q?=EA=B0=80=EB=A9=B4=20=ED=94=84=EB=A1=9C=ED=95=84=EB=A1=9C=20?= =?UTF-8?q?=EA=B0=80=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wap/wapp/navigation/WappNavHost.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt index e1a5c3f6..6f0f88b3 100644 --- a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt +++ b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt @@ -111,16 +111,16 @@ fun WappNavHost( navigateToSignIn = { navController.navigateToSignIn(navOptions { popUpTo(profileNavigationRoute) }) }, + navigateToSurveyDetail = { surveyId -> + navController.navigateToSurveyDetail( + surveyId, + navOptions { popUpTo(profileNavigationRoute) }, + ) + }, ) attendanceScreen( navigateToSignIn = { - navController.navigateToSignIn( - navOptions { - popUpTo( - attendanceNavigationRoute, - ) - }, - ) + navController.navigateToSignIn(navOptions { popUpTo(attendanceNavigationRoute) }) }, navigateToAttendanceManagement = navController::navigateToAttendanceManagement, ) From 8e2dcc311c889760991a3a8fa1b60fffdeef17c9 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sun, 18 Feb 2024 16:15:15 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[FEATURE]=20#130=20:=20survey=20Detail=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=92=A4=EB=A1=9C=20=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=ED=98=B9=EC=9D=80=20=EC=99=84=EB=A3=8C=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EB=88=84=EB=A5=BC=20=EC=8B=9C=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=95=84=20=ED=98=B9=EC=9D=80=20survey=20Check=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EB=A1=9C=20=EB=8F=8C=EC=95=84=EA=B0=80?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/wap/wapp/MainActivity.kt | 2 +- .../com/wap/wapp/navigation/WappNavHost.kt | 7 +++++-- .../survey/check/detail/SurveyDetailScreen.kt | 19 +++++++++++++++-- .../check/navigation/SurveyCheckNavigation.kt | 21 +++++++++++++++---- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/wap/wapp/MainActivity.kt b/app/src/main/java/com/wap/wapp/MainActivity.kt index 8b6e9df7..04fcb523 100644 --- a/app/src/main/java/com/wap/wapp/MainActivity.kt +++ b/app/src/main/java/com/wap/wapp/MainActivity.kt @@ -118,7 +118,7 @@ private fun handleBottomBarState( eventEditNavigationRoute -> setBottomBarState(false) SurveyRoute.answerRoute("{id}") -> setBottomBarState(false) surveyCheckRoute -> setBottomBarState(false) - SurveyCheckRoute.surveyDetailRoute("{id}") -> setBottomBarState(false) + SurveyCheckRoute.surveyDetailRoute("{id}", "{backStack}") -> setBottomBarState(false) else -> setBottomBarState(true) } diff --git a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt index 6f0f88b3..648f7036 100644 --- a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt +++ b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt @@ -37,6 +37,7 @@ import com.wap.wapp.feature.profile.profilesetting.navigation.profileSettingScre import com.wap.wapp.feature.splash.navigation.splashNavigationRoute import com.wap.wapp.feature.splash.navigation.splashScreen import com.wap.wapp.feature.survey.check.navigation.SurveyCheckRoute.surveyCheckRoute +import com.wap.wapp.feature.survey.check.navigation.SurveyDetailBackStack import com.wap.wapp.feature.survey.check.navigation.navigateToSurveyCheck import com.wap.wapp.feature.survey.check.navigation.navigateToSurveyDetail import com.wap.wapp.feature.survey.check.navigation.surveyCheckNavGraph @@ -98,6 +99,7 @@ fun WappNavHost( navOptions { popUpTo(surveyCheckRoute) { inclusive = true } }, ) }, + navigateToProfile = navController::navigateToProfile, ) managementSurveyNavGraph( navigateToManagement = navController::navigateToManagement, @@ -113,8 +115,9 @@ fun WappNavHost( }, navigateToSurveyDetail = { surveyId -> navController.navigateToSurveyDetail( - surveyId, - navOptions { popUpTo(profileNavigationRoute) }, + surveyId = surveyId, + backStack = SurveyDetailBackStack.PROFILE, + navOptions = navOptions { popUpTo(profileNavigationRoute) }, ) }, ) diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt index 63331fec..aac8f07e 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt @@ -21,13 +21,16 @@ import com.wap.designsystem.WappTheme import com.wap.designsystem.component.WappButton import com.wap.wapp.core.commmon.extensions.toSupportingText import com.wap.wapp.core.model.survey.QuestionType +import com.wap.wapp.feature.survey.check.navigation.SurveyDetailBackStack import kotlinx.coroutines.flow.collectLatest @Composable internal fun SurveyDetailRoute( viewModel: SurveyDetailViewModel = hiltViewModel(), surveyId: String, + backStack: String, navigateToSurveyCheck: () -> Unit, + navigateToProfile: () -> Unit, ) { val surveyUiState by viewModel.surveyUiState.collectAsStateWithLifecycle() val snackBarHostState = remember { SnackbarHostState() } @@ -45,8 +48,20 @@ internal fun SurveyDetailRoute( SurveyDetailScreen( snackBarHostState = snackBarHostState, surveyUiState = surveyUiState, - onDoneButtonClicked = { navigateToSurveyCheck() }, - onBackButtonClicked = { navigateToSurveyCheck() }, + onDoneButtonClicked = { + if (backStack == SurveyDetailBackStack.SURVEY_CHECK.name) { + navigateToSurveyCheck() + } else { + navigateToProfile() + } + }, + onBackButtonClicked = { + if (backStack == SurveyDetailBackStack.SURVEY_CHECK.name) { + navigateToSurveyCheck() + } else { + navigateToProfile() + } + }, ) } diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/navigation/SurveyCheckNavigation.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/navigation/SurveyCheckNavigation.kt index 57961327..aede9359 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/navigation/SurveyCheckNavigation.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/navigation/SurveyCheckNavigation.kt @@ -12,8 +12,9 @@ import com.wap.wapp.feature.survey.check.detail.SurveyDetailRoute fun NavController.navigateToSurveyDetail( surveyId: String, + backStack: SurveyDetailBackStack = SurveyDetailBackStack.SURVEY_CHECK, navOptions: NavOptions? = navOptions {}, -) = this.navigate(SurveyCheckRoute.surveyDetailRoute(surveyId), navOptions) +) = this.navigate(SurveyCheckRoute.surveyDetailRoute(surveyId, backStack.name), navOptions) fun NavController.navigateToSurveyCheck(navOptions: NavOptions? = navOptions {}) = this.navigate(SurveyCheckRoute.surveyCheckRoute, navOptions) @@ -22,6 +23,7 @@ fun NavGraphBuilder.surveyCheckNavGraph( navigateToSurveyDetail: (String) -> Unit, navigateToSurveyCheck: () -> Unit, navigateToSurvey: () -> Unit, + navigateToProfile: () -> Unit, ) { composable(route = SurveyCheckRoute.surveyCheckRoute) { SurveyCheckScreen( @@ -31,22 +33,33 @@ fun NavGraphBuilder.surveyCheckNavGraph( } composable( - route = SurveyCheckRoute.surveyDetailRoute("{id}"), + route = SurveyCheckRoute.surveyDetailRoute("{id}", "{backStack}"), arguments = listOf( navArgument("id") { type = NavType.StringType }, + navArgument("backStack") { + type = NavType.StringType + }, ), ) { navBackStackEntry -> val surveyId = navBackStackEntry.arguments?.getString("id") ?: "" + val backStack = navBackStackEntry.arguments?.getString("backStack") ?: "SURVEY_CHECK" SurveyDetailRoute( - navigateToSurveyCheck = navigateToSurveyCheck, surveyId = surveyId, + backStack = backStack, + navigateToSurveyCheck = navigateToSurveyCheck, + navigateToProfile = navigateToProfile, ) } } object SurveyCheckRoute { const val surveyCheckRoute = "survey/check" - fun surveyDetailRoute(surveyId: String) = "survey/detail/$surveyId" + fun surveyDetailRoute(surveyId: String, backStack: String) = + "survey/detail/$surveyId/$backStack" +} + +enum class SurveyDetailBackStack { + SURVEY_CHECK, PROFILE } From 3639ef41f431f1888461a721236444abd5b466ed Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sun, 18 Feb 2024 16:24:10 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[FEATURE]=20#130=20:=20survey=20Detail=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A1=9C=EB=94=A9=20Lottie=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/check/detail/SurveyDetailScreen.kt | 16 +++++++++------- .../survey/check/detail/SurveyDetailViewModel.kt | 5 ++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt index aac8f07e..34aae521 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt @@ -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 @@ -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 @@ -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( @@ -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) } } } diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailViewModel.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailViewModel.kt index 065e8370..f3198e96 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailViewModel.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailViewModel.kt @@ -22,7 +22,7 @@ class SurveyDetailViewModel @Inject constructor( val errorFlow: SharedFlow = _errorFlow.asSharedFlow() private val _surveyUiState: MutableStateFlow = - MutableStateFlow(SurveyUiState.Init) + MutableStateFlow(SurveyUiState.Loading) val surveyUiState: StateFlow = _surveyUiState.asStateFlow() fun getSurvey(surveyId: String) { @@ -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() } } From 034f0b0ebf93e87968b402f7090d7be7dad4d15d Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sun, 18 Feb 2024 16:42:06 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[FEATURE]=20#130=20:=20survey=20Detail=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=99=84=EB=A3=8C=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=ED=95=98=EB=8B=A8=20=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/check/detail/SurveyDetailScreen.kt | 92 ++++++++++--------- 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt index 34aae521..c8f080ee 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailScreen.kt @@ -3,6 +3,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.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState @@ -36,6 +37,13 @@ internal fun SurveyDetailRoute( ) { val surveyUiState by viewModel.surveyUiState.collectAsStateWithLifecycle() val snackBarHostState = remember { SnackbarHostState() } + val navigateToPrevPage = { + if (backStack == SurveyDetailBackStack.SURVEY_CHECK.name) { + navigateToSurveyCheck() + } else { + navigateToProfile() + } + } LaunchedEffect(true) { viewModel.getSurvey(surveyId) @@ -50,20 +58,8 @@ internal fun SurveyDetailRoute( SurveyDetailScreen( snackBarHostState = snackBarHostState, surveyUiState = surveyUiState, - onDoneButtonClicked = { - if (backStack == SurveyDetailBackStack.SURVEY_CHECK.name) { - navigateToSurveyCheck() - } else { - navigateToProfile() - } - }, - onBackButtonClicked = { - if (backStack == SurveyDetailBackStack.SURVEY_CHECK.name) { - navigateToSurveyCheck() - } else { - navigateToProfile() - } - }, + onDoneButtonClicked = navigateToPrevPage, + onBackButtonClicked = navigateToPrevPage, ) } @@ -82,50 +78,60 @@ internal fun SurveyDetailScreen( onBackButtonClicked = onBackButtonClicked, ) }, + contentWindowInsets = WindowInsets(0.dp), snackbarHost = { SnackbarHost(snackBarHostState) }, containerColor = WappTheme.colors.backgroundBlack, ) { paddingValues -> Column( modifier = Modifier - .padding(paddingValues) - .padding(vertical = 16.dp, horizontal = 8.dp) .fillMaxSize() - .verticalScroll(scrollState), - verticalArrangement = Arrangement.spacedBy(32.dp), + .padding(paddingValues) + .padding(top = 16.dp, start = 8.dp, end = 8.dp), ) { - when (surveyUiState) { - is SurveyDetailViewModel.SurveyUiState.Loading -> { - Spacer(modifier = Modifier.weight(1f)) - CircleLoader(modifier = Modifier.fillMaxSize()) - Spacer(modifier = Modifier.weight(1f)) - } + Column( + modifier = Modifier + .weight(1f) + .fillMaxSize() + .verticalScroll(scrollState), + verticalArrangement = Arrangement.spacedBy(32.dp), + ) { + when (surveyUiState) { + is SurveyDetailViewModel.SurveyUiState.Loading -> { + Spacer(modifier = Modifier.weight(1f)) + + CircleLoader(modifier = Modifier.fillMaxSize()) + + Spacer(modifier = Modifier.weight(1f)) + } - is SurveyDetailViewModel.SurveyUiState.Success -> { - SurveyInformationCard( - title = surveyUiState.survey.title, - content = surveyUiState.survey.content, - userName = surveyUiState.survey.userName, - eventName = surveyUiState.survey.eventName, - ) + is SurveyDetailViewModel.SurveyUiState.Success -> { + SurveyInformationCard( + title = surveyUiState.survey.title, + content = surveyUiState.survey.content, + userName = surveyUiState.survey.userName, + eventName = surveyUiState.survey.eventName, + ) - Column( - verticalArrangement = Arrangement.spacedBy(32.dp), - ) { - surveyUiState.survey.surveyAnswerList.forEach { surveyAnswer -> - when (surveyAnswer.questionType) { - QuestionType.OBJECTIVE -> ObjectiveQuestionCard(surveyAnswer) + Column( + verticalArrangement = Arrangement.spacedBy(32.dp), + ) { + surveyUiState.survey.surveyAnswerList.forEach { surveyAnswer -> + when (surveyAnswer.questionType) { + QuestionType.OBJECTIVE -> ObjectiveQuestionCard(surveyAnswer) - QuestionType.SUBJECTIVE -> SubjectiveQuestionCard(surveyAnswer) + QuestionType.SUBJECTIVE -> SubjectiveQuestionCard(surveyAnswer) + } } } } - - WappButton( - onClick = onDoneButtonClicked, - textRes = com.wap.wapp.core.designsystem.R.string.done, - ) } } + + WappButton( + onClick = onDoneButtonClicked, + textRes = com.wap.wapp.core.designsystem.R.string.done, + modifier = Modifier.padding(vertical = 20.dp), + ) } } } From 13bf640262584b0b2cee755de6a1bbb9786eb306 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sun, 18 Feb 2024 16:46:08 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[FEATURE]=20#130=20:=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=9E=90=20=EC=9D=91=EB=8B=B5=20=EC=83=89=EC=83=81=20=EB=85=B8?= =?UTF-8?q?=EB=9E=80=EC=83=89=EC=9C=BC=EB=A1=9C=20=ED=95=98=EC=9D=B4?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=ED=8C=85=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/check/detail/SubjectiveQuestionCard.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SubjectiveQuestionCard.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SubjectiveQuestionCard.kt index 586c7e71..0303056a 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SubjectiveQuestionCard.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SubjectiveQuestionCard.kt @@ -34,15 +34,20 @@ internal fun SubjectiveQuestionCard(surveyAnswer: SurveyAnswer) { color = WappTheme.colors.white, textAlign = TextAlign.Start, ) + Spacer(modifier = Modifier.height(16.dp)) Text( text = surveyAnswer.questionAnswer, style = WappTheme.typography.contentRegular, - color = WappTheme.colors.white, + color = WappTheme.colors.yellow34, textAlign = TextAlign.Start, ) - Divider() + + Divider( + color = WappTheme.colors.gray82, + modifier = Modifier.padding(top = 5.dp), + ) } } }