From 592615e07cb792e30a201506e6a4229091264836 Mon Sep 17 00:00:00 2001 From: BEEEAM-J Date: Wed, 24 Jan 2024 17:34:39 +0900 Subject: [PATCH] =?UTF-8?q?fix/#115=20:=20=EB=82=B4=20=EA=B8=80=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20-=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=97=86=EC=9D=8C=20=EC=8A=A4=ED=81=AC=EB=A6=B0=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../my/MyEvaluationContract.kt | 5 +- .../my/MyEvaluationScreen.kt | 50 ++++++++++++++----- .../my/src/main/res/values/strings.xml | 1 + 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/feature/lectureevaluation/my/src/main/java/com/suwiki/feature/lectureevaluation/my/MyEvaluationContract.kt b/feature/lectureevaluation/my/src/main/java/com/suwiki/feature/lectureevaluation/my/MyEvaluationContract.kt index 4f64a67e..e6f5192c 100644 --- a/feature/lectureevaluation/my/src/main/java/com/suwiki/feature/lectureevaluation/my/MyEvaluationContract.kt +++ b/feature/lectureevaluation/my/src/main/java/com/suwiki/feature/lectureevaluation/my/MyEvaluationContract.kt @@ -14,7 +14,10 @@ data class MyEvaluationState( val showDeleteLectureEvaluationDialog: Boolean = false, val showDeleteExamEvaluationDialog: Boolean = false, val showLackPointDialog: Boolean = false, -) +) { + val showLectureEmptyScreen: Boolean = myLectureEvaluationList.isEmpty() + val showExamEmptyScreen: Boolean = myExamEvaluationList.isEmpty() +} sealed interface MyEvaluationSideEffect { data object PopBackStack : MyEvaluationSideEffect diff --git a/feature/lectureevaluation/my/src/main/java/com/suwiki/feature/lectureevaluation/my/MyEvaluationScreen.kt b/feature/lectureevaluation/my/src/main/java/com/suwiki/feature/lectureevaluation/my/MyEvaluationScreen.kt index 2eb78882..b16192fe 100644 --- a/feature/lectureevaluation/my/src/main/java/com/suwiki/feature/lectureevaluation/my/MyEvaluationScreen.kt +++ b/feature/lectureevaluation/my/src/main/java/com/suwiki/feature/lectureevaluation/my/MyEvaluationScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.items @@ -11,6 +12,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -20,7 +22,9 @@ import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.suwiki.core.designsystem.component.appbar.SuwikiAppBarWithTitle import com.suwiki.core.designsystem.component.container.SuwikiEditContainer @@ -28,6 +32,7 @@ import com.suwiki.core.designsystem.component.dialog.SuwikiDialog import com.suwiki.core.designsystem.component.loading.LoadingScreen import com.suwiki.core.designsystem.component.tabbar.SuwikiTabBar import com.suwiki.core.designsystem.component.tabbar.TabTitle +import com.suwiki.core.designsystem.theme.Gray95 import com.suwiki.core.designsystem.theme.SuwikiTheme import com.suwiki.core.designsystem.theme.White import com.suwiki.core.model.enums.LectureEvaluationTab @@ -160,21 +165,29 @@ fun MyEvaluationScreen( ) { page -> when (LectureEvaluationTab.entries[page]) { LectureEvaluationTab.LECTURE_EVALUATION -> { - MyLectureEvaluationLazyColumn( - itemList = uiState.myLectureEvaluationList, - listState = lectureEvaluationListState, - onClickLectureEditButton = onClickLectureEvaluationEditButton, - onClickDeleteButton = onClickLectureEvaluationDeleteButton, - ) + if (uiState.showLectureEmptyScreen) { + EmptyScreen() + } else { + MyLectureEvaluationLazyColumn( + itemList = uiState.myLectureEvaluationList, + listState = lectureEvaluationListState, + onClickLectureEditButton = onClickLectureEvaluationEditButton, + onClickDeleteButton = onClickLectureEvaluationDeleteButton, + ) + } } LectureEvaluationTab.EXAM_INFO -> { - MyExamEvaluationLazyColumn( - itemList = uiState.myExamEvaluationList, - listState = examEvaluationListState, - onClickExamEditButton = onClickExamEvaluationEditButton, - onClickDeleteButton = onClickExamEvaluationDeleteButton, - ) + if (uiState.showExamEmptyScreen) { + EmptyScreen() + } else { + MyExamEvaluationLazyColumn( + itemList = uiState.myExamEvaluationList, + listState = examEvaluationListState, + onClickExamEditButton = onClickExamEvaluationEditButton, + onClickDeleteButton = onClickExamEvaluationDeleteButton, + ) + } } } } @@ -247,6 +260,19 @@ fun MyLectureEvaluationLazyColumn( } } +@Composable +fun EmptyScreen() { + Text( + modifier = Modifier + .padding(top = 150.dp) + .fillMaxSize(), + text = stringResource(R.string.empty_screen_text), + textAlign = TextAlign.Center, + style = SuwikiTheme.typography.header4, + color = Gray95, + ) +} + @Composable fun MyExamEvaluationLazyColumn( modifier: Modifier = Modifier, diff --git a/feature/lectureevaluation/my/src/main/res/values/strings.xml b/feature/lectureevaluation/my/src/main/res/values/strings.xml index 57f86743..608311bd 100644 --- a/feature/lectureevaluation/my/src/main/res/values/strings.xml +++ b/feature/lectureevaluation/my/src/main/res/values/strings.xml @@ -9,4 +9,5 @@ 강의평가를 정말로 삭제하시겠습니까?\n현재 보유 포인트 : %dp 포인트가 부족합니다. 현재 보유 포인트 : %dp + 등록된 평가가 없어요