diff --git a/app/src/main/java/team/ppac/navigation/FarmemeNavHost.kt b/app/src/main/java/team/ppac/navigation/FarmemeNavHost.kt index 3fdeadfb..2d7f3ab5 100644 --- a/app/src/main/java/team/ppac/navigation/FarmemeNavHost.kt +++ b/app/src/main/java/team/ppac/navigation/FarmemeNavHost.kt @@ -52,6 +52,7 @@ fun FarmemeNavHost( analyticsHelper = analyticsHelper, navigateToDetail = navigateToDetail, navigateToSetting = navigateToSetting, + navigateToRegister = navigateToRegister, ) } } diff --git a/core/analytics/src/main/java/team/ppac/analytics/action/Const.kt b/core/analytics/src/main/java/team/ppac/analytics/action/Const.kt index 4a824008..81e2677f 100644 --- a/core/analytics/src/main/java/team/ppac/analytics/action/Const.kt +++ b/core/analytics/src/main/java/team/ppac/analytics/action/Const.kt @@ -10,3 +10,4 @@ const val PAGINATION_COUNT = "page_count" const val CONTENT_TYPE = "content_type" const val MY_PAGE_RECENT_MEME = "my_recent_meme" const val MY_PAGE_SAVED_MEME = "my_saved_meme" +const val MY_PAGE_REGISTERED_MEME = "my_registered_meme" diff --git a/core/analytics/src/main/java/team/ppac/analytics/action/MyPageAction.kt b/core/analytics/src/main/java/team/ppac/analytics/action/MyPageAction.kt index 54545f7b..443babe7 100644 --- a/core/analytics/src/main/java/team/ppac/analytics/action/MyPageAction.kt +++ b/core/analytics/src/main/java/team/ppac/analytics/action/MyPageAction.kt @@ -7,6 +7,7 @@ enum class MyPageAction(private val tag: String) : ActionType { CLICK_MEME("click_meme"), CLICK_COPY("click_copy"), CLICK_SETTINGS("click_settings"), + CLICK_REGISTER("click_register"), ; override fun getAction(): String = tag diff --git a/core/common/android/src/main/kotlin/team/ppac/common/android/component/error/FarmemeErrorScreen.kt b/core/common/android/src/main/kotlin/team/ppac/common/android/component/error/FarmemeErrorScreen.kt index 6832cab8..ec61c648 100644 --- a/core/common/android/src/main/kotlin/team/ppac/common/android/component/error/FarmemeErrorScreen.kt +++ b/core/common/android/src/main/kotlin/team/ppac/common/android/component/error/FarmemeErrorScreen.kt @@ -38,10 +38,8 @@ fun FarmemeErrorScreen( ) Spacer(modifier = Modifier.size(24.dp)) FarmemeFilledButton( - backgroundColor = FarmemeTheme.backgroundColor.primary, text = "새로고침하기", - textColor = FarmemeTheme.textColor.inverse, - onClick = onRetryClick + onClick = onRetryClick, ) } } diff --git a/core/designsystem/src/main/kotlin/team/ppac/designsystem/component/button/Button.kt b/core/designsystem/src/main/kotlin/team/ppac/designsystem/component/button/Button.kt index d65f0c08..7ace1ee0 100644 --- a/core/designsystem/src/main/kotlin/team/ppac/designsystem/component/button/Button.kt +++ b/core/designsystem/src/main/kotlin/team/ppac/designsystem/component/button/Button.kt @@ -79,9 +79,9 @@ fun FarmemeWeakButton( @Composable fun FarmemeFilledButton( modifier: Modifier = Modifier, - backgroundColor: Color, + backgroundColor: Color = FarmemeTheme.backgroundColor.primary, text: String, - textColor: Color, + textColor: Color = FarmemeTheme.textColor.inverse, onClick: () -> Unit = { }, ) { Box( @@ -136,8 +136,6 @@ private fun FarmemeWeakButtonPreview() { @Preview private fun FarmemeFilledButtonPreview() { FarmemeFilledButton( - backgroundColor = FarmemeTheme.backgroundColor.primary, text = "버튼", - textColor = FarmemeTheme.textColor.inverse, ) } \ No newline at end of file diff --git a/core/designsystem/src/main/kotlin/team/ppac/designsystem/foundation/Icon.kt b/core/designsystem/src/main/kotlin/team/ppac/designsystem/foundation/Icon.kt index b03078ef..52a2de77 100644 --- a/core/designsystem/src/main/kotlin/team/ppac/designsystem/foundation/Icon.kt +++ b/core/designsystem/src/main/kotlin/team/ppac/designsystem/foundation/Icon.kt @@ -401,16 +401,6 @@ object FarmemeIcon { contentDescription = null, ) - @Composable - fun EmptyResult( - modifier: Modifier = Modifier, - ) = Icon( - modifier = modifier, - painter = painterResource(R.drawable.ic_empty_80), - contentDescription = null, - tint = Color.Unspecified - ) - @Composable fun Required( modifier: Modifier = Modifier, @@ -434,7 +424,7 @@ object FarmemeIcon { @Composable fun Upload( modifier: Modifier = Modifier, - )= Icon( + ) = Icon( modifier = modifier, painter = painterResource(R.drawable.ic_upload_16), contentDescription = null, diff --git a/core/designsystem/src/main/res/drawable/ic_empty_80.xml b/core/designsystem/src/main/res/drawable/ic_empty_80.xml deleted file mode 100644 index 074db2e6..00000000 --- a/core/designsystem/src/main/res/drawable/ic_empty_80.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - diff --git a/core/designsystem/src/main/res/drawable/img_empty.png b/core/designsystem/src/main/res/drawable/img_empty.png new file mode 100644 index 00000000..748eb68d Binary files /dev/null and b/core/designsystem/src/main/res/drawable/img_empty.png differ diff --git a/feature/mypage/src/main/java/team/ppac/mypage/MyPageRoute.kt b/feature/mypage/src/main/java/team/ppac/mypage/MyPageRoute.kt index 4c7b45bd..2c8851f4 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/MyPageRoute.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/MyPageRoute.kt @@ -24,7 +24,6 @@ import team.ppac.common.android.util.ComposableLifecycle import team.ppac.designsystem.foundation.FarmemeIcon import team.ppac.mypage.mvi.MyPageIntent import team.ppac.mypage.mvi.MyPageSideEffect -import timber.log.Timber @Composable internal fun MyPageRoute( @@ -32,6 +31,7 @@ internal fun MyPageRoute( viewModel: MyPageViewModel = hiltViewModel(), navigateToDetail: (String) -> Unit, navigateToSetting: () -> Unit, + navigateToRegister: () -> Unit, ) { var lastPage by remember { mutableIntStateOf(0) } @@ -86,6 +86,15 @@ internal fun MyPageRoute( navigateToSetting() } + MyPageSideEffect.NavigateToRegister -> { + analyticsHelper.reportAction( + action = MyPageAction.CLICK_REGISTER, + screen = ScreenType.MY_PAGE + ) + + navigateToRegister() + } + is MyPageSideEffect.ShowLevelUpSnackBar -> { viewModel.showSnackbar( message = "LV.${sideEffect.level}로 레벨업했어요!", diff --git a/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt b/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt index 6badc608..d3f0772b 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/MyPageScreen.kt @@ -43,14 +43,17 @@ import team.ppac.designsystem.component.toolbar.FarmemeActionToolBar import team.ppac.designsystem.foundation.FarmemeRadius import team.ppac.domain.repository.SavedMemeEvent import team.ppac.mypage.component.MyPageLevelBox +import team.ppac.mypage.component.MyPageMemesTabBar import team.ppac.mypage.component.MyPageProgressBar import team.ppac.mypage.component.MyPagePullRefreshIndicator import team.ppac.mypage.component.MyPageSpeechBubble import team.ppac.mypage.component.RecentMemeContent +import team.ppac.mypage.component.RegisteredMemeContent import team.ppac.mypage.component.SavedMemeContent import team.ppac.mypage.model.LevelUiModel import team.ppac.mypage.model.MyPageLevel import team.ppac.mypage.mvi.MyPageIntent +import team.ppac.mypage.mvi.MyPageTabType import team.ppac.mypage.mvi.MyPageUiState @OptIn(ExperimentalMaterialApi::class) @@ -61,6 +64,7 @@ internal fun MyPageScreen( onIntent: (MyPageIntent) -> Unit, ) { val savedMemes = uiState.savedMemes.collectAsLazyPagingItems() + val registeredMemes = uiState.registeredMemes.collectAsLazyPagingItems() val pullRefreshState = rememberPullRefreshState( refreshing = uiState.isRefreshing, onRefresh = { @@ -126,14 +130,48 @@ internal fun MyPageScreen( }, isLoading = uiState.isLoading, ) + MyPageMemesTabBar( + currentTabType = uiState.currentTabType, + onClick = { tab -> + onIntent(MyPageIntent.ClickMemesTab(currentTabType = tab)) + }, + ) + Spacer( + modifier = Modifier + .fillMaxWidth() + .height(1.dp) + .background(FarmemeTheme.borderColor.tertiary), + ) + Spacer(modifier = Modifier.height(20.dp)) if (!uiState.isLoading) { - SavedMemeContent( - savedMemes = savedMemes, - onMemeClick = { memeId -> - onIntent(MyPageIntent.ClickSavedMemeItem(memeId = memeId)) - }, - onCopyClick = { onIntent(MyPageIntent.ClickCopy(it)) } - ) + when (uiState.currentTabType) { + MyPageTabType.REGISTERED_MEMES -> { + RegisteredMemeContent( + registeredMemes = registeredMemes, + onMemeClick = { memeId -> + onIntent(MyPageIntent.ClickRegisteredMemeItem(memeId = memeId)) + }, + onCopyClick = { + onIntent(MyPageIntent.ClickCopy(it)) + }, + onRegisterClick = { + onIntent(MyPageIntent.ClickRegister) + }, + ) + } + + MyPageTabType.SAVED_MEMES -> { + SavedMemeContent( + savedMemes = savedMemes, + onMemeClick = { memeId -> + onIntent(MyPageIntent.ClickSavedMemeItem(memeId = memeId)) + }, + onCopyClick = { + onIntent(MyPageIntent.ClickCopy(it)) + }, + ) + } + } } } MyPagePullRefreshIndicator( diff --git a/feature/mypage/src/main/java/team/ppac/mypage/MyPageViewModel.kt b/feature/mypage/src/main/java/team/ppac/mypage/MyPageViewModel.kt index 33838d9e..cbeeedec 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/MyPageViewModel.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/MyPageViewModel.kt @@ -72,6 +72,12 @@ class MyPageViewModel @Inject constructor( memeId = intent.memeId ) + is MyPageIntent.ClickRegisteredMemeItem -> navigateToDetail( + contentType = intent.contentType, + memeId = intent.memeId + ) + + MyPageIntent.ClickRegister -> navigateToRegister() MyPageIntent.ClickSettingButton -> navigateToSetting() is MyPageIntent.ClickRetryButton -> { initialAction() @@ -85,6 +91,13 @@ class MyPageViewModel @Inject constructor( MyPageIntent.InitView -> initialAction() MyPageIntent.RefreshData -> refreshAction() is MyPageIntent.ClickCopy -> postSideEffect(MyPageSideEffect.LogClickCopy(intent.meme)) + is MyPageIntent.ClickMemesTab -> { + reduce { + copy( + currentTabType = intent.currentTabType, + ) + } + } } } @@ -101,6 +114,10 @@ class MyPageViewModel @Inject constructor( postSideEffect(MyPageSideEffect.NavigateToSetting) } + private fun navigateToRegister() { + postSideEffect(MyPageSideEffect.NavigateToRegister) + } + private fun initialAction() { launch { getUserData() diff --git a/feature/mypage/src/main/java/team/ppac/mypage/component/EmptyMemeContent.kt b/feature/mypage/src/main/java/team/ppac/mypage/component/EmptyMemeContent.kt new file mode 100644 index 00000000..7c091890 --- /dev/null +++ b/feature/mypage/src/main/java/team/ppac/mypage/component/EmptyMemeContent.kt @@ -0,0 +1,73 @@ +package team.ppac.mypage.component + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.size +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import team.ppac.designsystem.FarmemeTheme +import team.ppac.designsystem.component.button.FarmemeFilledButton +import team.ppac.mypage.mvi.MyPageTabType + +@Composable +fun EmptyMemeContent( + modifier: Modifier = Modifier, + tabType: MyPageTabType, + onUploadClick: () -> Unit = {}, +) { + val (title, content) = when (tabType) { + MyPageTabType.REGISTERED_MEMES -> "올린 밈이 없어요" to "공유하고 싶은 밈이 있다면\n업로드해보세요." + MyPageTabType.SAVED_MEMES -> "저장한 밈이 없어요" to "관심있는 밈을 저장하고\n필요할 때 편하게 사용해보세요." + } + + Column( + modifier = modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Spacer(modifier = Modifier.height(160.dp)) + Image( + modifier = Modifier.size(80.dp), + painter = painterResource(id = team.ppac.designsystem.R.drawable.img_empty), + contentDescription = null, + ) + Spacer(modifier = Modifier.height(20.dp)) + Text( + text = title, + textAlign = TextAlign.Center, + style = FarmemeTheme.typography.heading.small.bold.copy( + color = FarmemeTheme.textColor.primary + ), + ) + Spacer(modifier = Modifier.height(9.dp)) + Text( + text = content, + textAlign = TextAlign.Center, + style = FarmemeTheme.typography.body.large.medium.copy( + color = FarmemeTheme.textColor.tertiary + ), + ) + if (tabType == MyPageTabType.REGISTERED_MEMES) { + Spacer(modifier = Modifier.height(20.dp)) + FarmemeFilledButton( + text = "밈 올리기", + onClick = onUploadClick, + ) + } + Spacer(modifier = Modifier.height(220.dp)) + } +} + +@Preview(showBackground = true) +@Composable +private fun EmptyMemeContentPreview() { + EmptyMemeContent(tabType = MyPageTabType.REGISTERED_MEMES) +} \ No newline at end of file diff --git a/feature/mypage/src/main/java/team/ppac/mypage/component/MyPageMemesTabBar.kt b/feature/mypage/src/main/java/team/ppac/mypage/component/MyPageMemesTabBar.kt new file mode 100644 index 00000000..6c99c11a --- /dev/null +++ b/feature/mypage/src/main/java/team/ppac/mypage/component/MyPageMemesTabBar.kt @@ -0,0 +1,110 @@ +package team.ppac.mypage.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import team.ppac.designsystem.FarmemeTheme +import team.ppac.designsystem.util.extension.noRippleClickable +import team.ppac.mypage.mvi.MyPageTabType + +@Composable +internal fun MyPageMemesTabBar( + modifier: Modifier = Modifier, + currentTabType: MyPageTabType, + onClick: (MyPageTabType) -> Unit, +) { + Row( + modifier = modifier + .fillMaxWidth() + .padding(horizontal = 20.dp) + ) { + MyPageMemesTab( + modifier = Modifier.weight(1f), + currentTabType = MyPageTabType.REGISTERED_MEMES, + isSelected = currentTabType == MyPageTabType.REGISTERED_MEMES, + onClick = onClick, + ) + Spacer(modifier = Modifier.width(8.dp)) + MyPageMemesTab( + modifier = Modifier.weight(1f), + currentTabType = MyPageTabType.SAVED_MEMES, + isSelected = currentTabType == MyPageTabType.SAVED_MEMES, + onClick = onClick, + ) + } +} + +@Composable +internal fun MyPageMemesTab( + modifier: Modifier = Modifier, + currentTabType: MyPageTabType, + isSelected: Boolean, + onClick: (MyPageTabType) -> Unit, +) { + val textColor = + if (isSelected) FarmemeTheme.textColor.primary else FarmemeTheme.textColor.tertiary + val lineColor = if (isSelected) FarmemeTheme.backgroundColor.primary else Color.Unspecified + + Column( + modifier = modifier.noRippleClickable(onClick = { + onClick(currentTabType) + }), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Spacer(modifier = Modifier.height(10.dp)) + Text( + text = currentTabType.title, + color = textColor, + style = FarmemeTheme.typography.body.xLarge.semibold, + ) + Spacer(modifier = Modifier.height(15.dp)) + Spacer( + modifier = Modifier + .fillMaxWidth() + .height(2.dp) + .background(lineColor), + ) + } +} + +@Preview(showBackground = true) +@Composable +private fun MyPageMemesTabBarPreview( + modifier: Modifier = Modifier, +) { + MyPageMemesTabBar( + currentTabType = MyPageTabType.REGISTERED_MEMES, + onClick = {}, + ) +} + +@Preview(showBackground = true) +@Composable +private fun MyPageMemesTabPreview( + modifier: Modifier = Modifier, +) { + Column { + MyPageMemesTab( + currentTabType = MyPageTabType.REGISTERED_MEMES, + isSelected = true, + onClick = {}, + ) + MyPageMemesTab( + currentTabType = MyPageTabType.SAVED_MEMES, + isSelected = false, + onClick = {}, + ) + } +} \ No newline at end of file diff --git a/feature/mypage/src/main/java/team/ppac/mypage/component/RecentMemeContent.kt b/feature/mypage/src/main/java/team/ppac/mypage/component/RecentMemeContent.kt index dfd2dd37..1289b232 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/component/RecentMemeContent.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/component/RecentMemeContent.kt @@ -61,7 +61,7 @@ internal fun RecentMemeContent( } else { RecentMemeEmpty() } - Spacer(modifier = Modifier.height(50.dp)) + Spacer(modifier = Modifier.height(46.dp)) } } } diff --git a/feature/mypage/src/main/java/team/ppac/mypage/component/RegisteredMemeContent.kt b/feature/mypage/src/main/java/team/ppac/mypage/component/RegisteredMemeContent.kt new file mode 100644 index 00000000..cff6a1df --- /dev/null +++ b/feature/mypage/src/main/java/team/ppac/mypage/component/RegisteredMemeContent.kt @@ -0,0 +1,103 @@ +package team.ppac.mypage.component + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid +import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.paging.PagingData +import androidx.paging.compose.LazyPagingItems +import androidx.paging.compose.collectAsLazyPagingItems +import kotlinx.coroutines.flow.flowOf +import team.ppac.common.android.component.FARMEME_MEME_ITEM_MAX_HEIGHT +import team.ppac.common.android.component.FarmemeMemeItem +import team.ppac.domain.model.Meme +import team.ppac.mypage.mvi.MyPageTabType + +@Composable +internal fun RegisteredMemeContent( + modifier: Modifier = Modifier, + registeredMemes: LazyPagingItems, + onMemeClick: (String) -> Unit, + onCopyClick: (Meme) -> Unit, + onRegisterClick: () -> Unit, +) { + Column( + modifier = modifier.fillMaxWidth(), + ) { + if (registeredMemes.itemCount > 0) { + RegisteredMemeList( + registeredMemes = registeredMemes, + onMemeItemClick = onMemeClick, + onCopyClick = onCopyClick + ) + } else { + EmptyMemeContent( + tabType = MyPageTabType.REGISTERED_MEMES, + onUploadClick = onRegisterClick, + ) + } + Spacer(modifier = Modifier.height(50.dp)) + } +} + +@Composable +private fun RegisteredMemeList( + modifier: Modifier = Modifier, + registeredMemes: LazyPagingItems, + onMemeItemClick: (String) -> Unit, + onCopyClick: (Meme) -> Unit, +) { + LazyVerticalStaggeredGrid( + modifier = modifier + .fillMaxWidth() + .heightIn(max = (FARMEME_MEME_ITEM_MAX_HEIGHT * registeredMemes.itemCount).dp) + .wrapContentHeight(), + userScrollEnabled = false, + columns = StaggeredGridCells.Fixed(2), + horizontalArrangement = Arrangement.spacedBy(space = 12.dp), + contentPadding = PaddingValues( + start = 20.dp, + end = 20.dp, + ), + verticalItemSpacing = 20.dp, + ) { + items(count = registeredMemes.itemCount) { index -> + val meme = registeredMemes[index] + + if (meme != null) { + FarmemeMemeItem( + modifier = Modifier, + memeId = meme.id, + memeTitle = meme.title, + lolCount = 0, + imageUrl = meme.imageUrl, + onMemeClick = onMemeItemClick, + onCopyClick = { + onCopyClick(meme) + }, + ) + } + } + } +} + +@Preview +@Composable +private fun RegisteredMemeContentPreview() { + RegisteredMemeContent( + registeredMemes = flowOf(PagingData.empty()).collectAsLazyPagingItems(), + onMemeClick = {}, + onCopyClick = {}, + onRegisterClick = {}, + ) +} \ No newline at end of file diff --git a/feature/mypage/src/main/java/team/ppac/mypage/component/SavedMemeContent.kt b/feature/mypage/src/main/java/team/ppac/mypage/component/SavedMemeContent.kt index 2d8c2114..96974762 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/component/SavedMemeContent.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/component/SavedMemeContent.kt @@ -7,13 +7,10 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn -import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells -import androidx.compose.material.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -23,10 +20,8 @@ import androidx.paging.compose.collectAsLazyPagingItems import kotlinx.coroutines.flow.flowOf import team.ppac.common.android.component.FARMEME_MEME_ITEM_MAX_HEIGHT import team.ppac.common.android.component.FarmemeMemeItem -import team.ppac.designsystem.FarmemeTheme -import team.ppac.designsystem.component.list.FarmemeListHeader -import team.ppac.designsystem.foundation.FarmemeIcon import team.ppac.domain.model.Meme +import team.ppac.mypage.mvi.MyPageTabType @Composable internal fun SavedMemeContent( @@ -38,20 +33,16 @@ internal fun SavedMemeContent( Column( modifier = modifier.fillMaxWidth(), ) { - FarmemeListHeader( - title = "나의 파밈함", - leadingIcon = { - FarmemeIcon.BookmarkLine(Modifier.size(20.dp)) - }, - ) if (savedMemes.itemCount > 0) { SavedMemeList( savedMemes = savedMemes, onMemeItemClick = onMemeClick, - onCopyClick = onCopyClick + onCopyClick = onCopyClick, ) } else { - SavedMemeEmpty() + EmptyMemeContent( + tabType = MyPageTabType.SAVED_MEMES, + ) } Spacer(modifier = Modifier.height(50.dp)) } @@ -96,24 +87,6 @@ private fun SavedMemeList( } } -@Composable -private fun SavedMemeEmpty( - modifier: Modifier = Modifier, -) { - Column( - modifier = modifier.fillMaxWidth(), - horizontalAlignment = Alignment.CenterHorizontally, - ) { - Spacer(modifier = Modifier.height(50.dp)) - Text( - text = "저장한 밈이 없어요", - style = FarmemeTheme.typography.body.large.medium, - color = FarmemeTheme.textColor.assistive, - ) - Spacer(modifier = Modifier.height(50.dp)) - } -} - @Preview @Composable private fun SavedMemeContentPreview() { diff --git a/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageIntent.kt b/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageIntent.kt index e72b7448..ff653a74 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageIntent.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageIntent.kt @@ -2,6 +2,7 @@ package team.ppac.mypage.mvi import team.ppac.analytics.action.MY_PAGE_RECENT_MEME import team.ppac.analytics.action.MY_PAGE_SAVED_MEME +import team.ppac.analytics.action.MY_PAGE_REGISTERED_MEME import team.ppac.common.android.base.UiIntent import team.ppac.domain.model.Meme @@ -17,8 +18,15 @@ sealed class MyPageIntent : UiIntent { val memeId: String ) : MyPageIntent() + data class ClickRegisteredMemeItem( + val contentType: String = MY_PAGE_REGISTERED_MEME, + val memeId: String + ) : MyPageIntent() + + data object ClickRegister : MyPageIntent() data object ClickRetryButton : MyPageIntent() data object InitView : MyPageIntent() data object RefreshData : MyPageIntent() data class ClickCopy(val meme: Meme) : MyPageIntent() + data class ClickMemesTab(val currentTabType: MyPageTabType) : MyPageIntent() } \ No newline at end of file diff --git a/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageSideEffect.kt b/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageSideEffect.kt index 3444dc40..94104aaa 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageSideEffect.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageSideEffect.kt @@ -6,6 +6,7 @@ import team.ppac.domain.model.Meme sealed class MyPageSideEffect : UiSideEffect { data class NavigateToDetail(val contentType: String, val memeId: String) : MyPageSideEffect() data object NavigateToSetting : MyPageSideEffect() + data object NavigateToRegister : MyPageSideEffect() data class ShowLevelUpSnackBar(val level: Int) : MyPageSideEffect() data class LogClickCopy(val meme: Meme) : MyPageSideEffect() } \ No newline at end of file diff --git a/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageUiState.kt b/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageUiState.kt index 7dd60b60..7310551d 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageUiState.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/mvi/MyPageUiState.kt @@ -14,11 +14,19 @@ data class MyPageUiState( val isRefreshing: Boolean = false, val isError: Boolean = false, val levelUiModel: LevelUiModel = LevelUiModel(), + val currentTabType: MyPageTabType = MyPageTabType.REGISTERED_MEMES, val recentMemes: ImmutableList = persistentListOf(), val savedMemes: Flow> = flowOf(PagingData.empty()), + val registeredMemes: Flow> = flowOf(PagingData.empty()), ) : UiState { companion object { val INITIAL_STATE get() = MyPageUiState() } +} + +enum class MyPageTabType(val title: String) { + REGISTERED_MEMES(title = "나의 밈"), + SAVED_MEMES(title = "나의 파밈함"), + ; } \ No newline at end of file diff --git a/feature/mypage/src/main/java/team/ppac/mypage/navigation/MyPageNavigation.kt b/feature/mypage/src/main/java/team/ppac/mypage/navigation/MyPageNavigation.kt index e5ec465f..0847a132 100644 --- a/feature/mypage/src/main/java/team/ppac/mypage/navigation/MyPageNavigation.kt +++ b/feature/mypage/src/main/java/team/ppac/mypage/navigation/MyPageNavigation.kt @@ -15,6 +15,7 @@ fun NavGraphBuilder.myPageScreen( analyticsHelper: AnalyticsHelper, navigateToDetail: (String) -> Unit, navigateToSetting: () -> Unit, + navigateToRegister: () -> Unit, ) { composable( route = MY_PAGE_ROUTE @@ -23,6 +24,7 @@ fun NavGraphBuilder.myPageScreen( analyticsHelper = analyticsHelper, navigateToDetail = navigateToDetail, navigateToSetting = navigateToSetting, + navigateToRegister = navigateToRegister, ) } } \ No newline at end of file diff --git a/feature/register/src/main/java/team/ppac/register/RegisterScreen.kt b/feature/register/src/main/java/team/ppac/register/RegisterScreen.kt index e56f51aa..d3d05894 100644 --- a/feature/register/src/main/java/team/ppac/register/RegisterScreen.kt +++ b/feature/register/src/main/java/team/ppac/register/RegisterScreen.kt @@ -53,6 +53,7 @@ internal fun RegisterScreen( } ) { LazyColumn( + modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally, ) { item { diff --git a/feature/search/src/main/java/team/ppac/search/detail/component/EmptyResultContent.kt b/feature/search/src/main/java/team/ppac/search/detail/component/EmptyResultContent.kt index 29532d18..99e827f3 100644 --- a/feature/search/src/main/java/team/ppac/search/detail/component/EmptyResultContent.kt +++ b/feature/search/src/main/java/team/ppac/search/detail/component/EmptyResultContent.kt @@ -1,5 +1,6 @@ package team.ppac.search.detail.component +import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -11,10 +12,10 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import team.ppac.designsystem.FarmemeTheme -import team.ppac.designsystem.foundation.FarmemeIcon @Composable fun EmptyResultContent( @@ -28,7 +29,11 @@ fun EmptyResultContent( modifier = Modifier, horizontalAlignment = Alignment.CenterHorizontally ) { - FarmemeIcon.EmptyResult() + Image( + modifier = Modifier.size(80.dp), + painter = painterResource(id = team.ppac.designsystem.R.drawable.img_empty), + contentDescription = null, + ) Spacer(modifier = Modifier.size(20.dp)) Text( text = "밈이 없어요", diff --git a/feature/setting/src/main/java/team/ppac/setting/SettingScreen.kt b/feature/setting/src/main/java/team/ppac/setting/SettingScreen.kt index ddf5df6a..5bc1f010 100644 --- a/feature/setting/src/main/java/team/ppac/setting/SettingScreen.kt +++ b/feature/setting/src/main/java/team/ppac/setting/SettingScreen.kt @@ -102,9 +102,7 @@ private fun SettingBody( if (hasNewAppVersion) { Spacer(modifier = Modifier.height(16.dp)) FarmemeFilledButton( - backgroundColor = FarmemeTheme.backgroundColor.primary, text = "앱 업데이트하기", - textColor = FarmemeTheme.textColor.inverse, onClick = onAppUpdateClick, ) }