Skip to content

Commit 85682ce

Browse files
authored
[Fix/#133] 굿즈 카테고리 QA 이슈 반영
1 parent d97eb18 commit 85682ce

File tree

5 files changed

+62
-23
lines changed

5 files changed

+62
-23
lines changed

app/src/main/java/com/poti/android/presentation/history/participant/component/HistoryDepositBottomSheet.kt

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ package com.poti.android.presentation.history.participant.component
22

33
import androidx.compose.foundation.layout.Arrangement
44
import androidx.compose.foundation.layout.Column
5+
import androidx.compose.foundation.layout.ExperimentalLayoutApi
6+
import androidx.compose.foundation.layout.WindowInsets
57
import androidx.compose.foundation.layout.fillMaxWidth
8+
import androidx.compose.foundation.layout.isImeVisible
69
import androidx.compose.foundation.layout.padding
710
import androidx.compose.material3.ExperimentalMaterial3Api
811
import androidx.compose.material3.rememberModalBottomSheetState
@@ -14,14 +17,17 @@ import androidx.compose.runtime.setValue
1417
import androidx.compose.ui.Modifier
1518
import androidx.compose.ui.res.stringResource
1619
import androidx.compose.ui.text.input.ImeAction
20+
import androidx.compose.ui.text.input.KeyboardType
1721
import androidx.compose.ui.tooling.preview.Preview
22+
import androidx.compose.ui.unit.Dp
1823
import androidx.compose.ui.unit.dp
1924
import com.poti.android.R
25+
import com.poti.android.core.common.util.screenWidthDp
2026
import com.poti.android.core.designsystem.component.bottomsheet.PotiBottomSheet
2127
import com.poti.android.core.designsystem.component.field.PotiShortTextField
2228
import com.poti.android.core.designsystem.theme.PotiTheme
2329

24-
@OptIn(ExperimentalMaterial3Api::class)
30+
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
2531
@Composable
2632
fun HistoryDepositBottomSheet(
2733
onDismissRequest: () -> Unit,
@@ -30,25 +36,32 @@ fun HistoryDepositBottomSheet(
3036
) {
3137
var depositor by remember { mutableStateOf("") }
3238
var depositTime by remember { mutableStateOf("") }
39+
val isKeyboardVisible = WindowInsets.isImeVisible
40+
val bottomPadding = remember(isKeyboardVisible) {
41+
if (isKeyboardVisible) 60.dp else 226.dp
42+
}
43+
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
3344

3445
PotiBottomSheet(
3546
modifier = modifier,
3647
onDismissRequest = onDismissRequest,
37-
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
48+
sheetState = sheetState,
3849
text = stringResource(R.string.history_deposit_bottomsheet_button),
3950
onClick = { onConfirmClick(depositor, depositTime) },
40-
content = {
41-
BottomSheetContent(
42-
depositor = depositor,
43-
onDepositorChanged = { depositor = it },
44-
depositTime = depositTime,
45-
onDepositTimeChanged = { depositTime = it },
46-
modifier = modifier
47-
.padding(horizontal = 16.dp),
48-
)
49-
},
5051
enabled = depositor.isNotBlank() && depositTime.isNotBlank(),
51-
)
52+
) {
53+
BottomSheetContent(
54+
depositor = depositor,
55+
onDepositorChanged = { depositor = it },
56+
depositTime = depositTime,
57+
onDepositTimeChanged = { depositTime = it },
58+
bottomPadding = bottomPadding,
59+
modifier = Modifier
60+
.padding(
61+
horizontal = screenWidthDp(16.dp),
62+
),
63+
)
64+
}
5265
}
5366

5467
@Composable
@@ -57,6 +70,7 @@ private fun BottomSheetContent(
5770
onDepositorChanged: (String) -> Unit,
5871
depositTime: String,
5972
onDepositTimeChanged: (String) -> Unit,
73+
bottomPadding: Dp,
6074
modifier: Modifier = Modifier,
6175
) {
6276
Column(
@@ -75,7 +89,8 @@ private fun BottomSheetContent(
7589
onValueChanged = onDepositTimeChanged,
7690
placeholder = stringResource(R.string.history_deposit_bottomsheet_deposit_time_placeholder),
7791
label = stringResource(R.string.history_deposit_bottomsheet_deposit_time_label),
78-
modifier = Modifier.padding(bottom = 226.dp),
92+
keyboardType = KeyboardType.Number,
93+
modifier = Modifier.padding(bottom = bottomPadding),
7994
)
8095
}
8196
}

app/src/main/java/com/poti/android/presentation/party/home/HomeViewModel.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.poti.android.presentation.party.home
22

33
import com.poti.android.core.base.BaseViewModel
4+
import com.poti.android.core.common.extension.getSuccessDataOrNull
45
import com.poti.android.core.common.state.ApiState
56
import com.poti.android.domain.repository.HomeRepository
67
import com.poti.android.presentation.party.home.model.HomeUiEffect
@@ -19,7 +20,7 @@ class HomeViewModel @Inject constructor(
1920
override fun processIntent(intent: HomeUiIntent) {
2021
when (intent) {
2122
HomeUiIntent.OnFloatingClick -> sendEffect(NavigateToPartyCreate)
22-
is HomeUiIntent.OnMyArtistCategoryClick -> sendEffect(NavigateToMyArtistCategory(intent.artistId))
23+
is HomeUiIntent.OnMyArtistCategoryClick -> sendEffect(NavigateToMyArtistCategory(if (uiState.value.artistIdToNull) null else intent.artistId))
2324
is HomeUiIntent.OnProductCardClick -> sendEffect(NavigateToGoodsPartyList(intent.artistId, intent.title))
2425
HomeUiIntent.LoadHomeContent -> loadHomeContent()
2526
HomeUiIntent.OnOtherProductCategoryClick -> sendEffect(NavigateToOtherProductCategory)
@@ -36,6 +37,7 @@ class HomeViewModel @Inject constructor(
3637
updateState {
3738
copy(homeContentLoadState = ApiState.Success(homeContent))
3839
}
40+
validateArtistId()
3941
}
4042
.onFailure { throwable ->
4143
updateState {
@@ -45,4 +47,16 @@ class HomeViewModel @Inject constructor(
4547
}
4648
}
4749
}
50+
51+
private fun validateArtistId() {
52+
uiState.value.homeContentLoadState.getSuccessDataOrNull()?.let { content ->
53+
val diff = content.myGroupItems.any { item ->
54+
item.artistId != content.myGroupItems.first().artistId
55+
}
56+
57+
if (diff) {
58+
updateState { copy(artistIdToNull = true) }
59+
}
60+
}
61+
}
4862
}

app/src/main/java/com/poti/android/presentation/party/home/model/Contracts.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.poti.android.domain.model.home.HomeContent
88

99
data class HomeUiState(
1010
val homeContentLoadState: ApiState<HomeContent> = ApiState.Loading,
11+
val artistIdToNull: Boolean = false,
1112
) : UiState
1213

1314
sealed interface HomeUiIntent : UiIntent {

app/src/main/java/com/poti/android/presentation/party/product/productcategory/ProductCategoryScreen.kt

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package com.poti.android.presentation.party.product.productcategory
33
import androidx.compose.foundation.layout.Box
44
import androidx.compose.foundation.layout.Column
55
import androidx.compose.foundation.layout.PaddingValues
6+
import androidx.compose.foundation.layout.Spacer
67
import androidx.compose.foundation.layout.fillMaxWidth
8+
import androidx.compose.foundation.layout.height
79
import androidx.compose.foundation.layout.padding
810
import androidx.compose.foundation.layout.wrapContentWidth
911
import androidx.compose.foundation.lazy.LazyColumn
@@ -56,6 +58,7 @@ fun ProductCategoryRoute(
5658
uiState.productCategoryLoadState.onSuccess { goodsCategory ->
5759
ProductCategoryScreen(
5860
title = if (viewModel.isMyArtist) stringResource(R.string.home_recommend_goods, goodsCategory.nickname) else stringResource(R.string.home_other_goods),
61+
isMyArtsit = viewModel.isMyArtist,
5962
productCategory = goodsCategory,
6063
selectedSortType = uiState.selectedSortType,
6164
isSortBottomSheetVisible = uiState.isSortBottomSheetVisible,
@@ -73,6 +76,7 @@ fun ProductCategoryRoute(
7376
@Composable
7477
private fun ProductCategoryScreen(
7578
title: String,
79+
isMyArtsit: Boolean,
7680
productCategory: ProductCategory,
7781
selectedSortType: ProductSortType,
7882
isSortBottomSheetVisible: Boolean,
@@ -110,13 +114,17 @@ private fun ProductCategoryScreen(
110114
),
111115
) {
112116
item {
113-
PotiSmallButton(
114-
text = stringResource(selectedSortType.displayRes),
115-
onClick = onSortFilterClick,
116-
modifier = Modifier
117-
.fillMaxWidth()
118-
.wrapContentWidth(Alignment.End),
119-
)
117+
if (isMyArtsit) {
118+
PotiSmallButton(
119+
text = stringResource(selectedSortType.displayRes),
120+
onClick = onSortFilterClick,
121+
modifier = Modifier
122+
.fillMaxWidth()
123+
.wrapContentWidth(Alignment.End),
124+
)
125+
} else {
126+
Spacer(Modifier.height(12.dp))
127+
}
120128
}
121129

122130
items(productCategory.groupItems) { groupItem ->
@@ -154,6 +162,7 @@ private fun ProductCategoryScreenPreview() {
154162
PotiTheme {
155163
ProductCategoryScreen(
156164
title = "",
165+
isMyArtsit = false,
157166
productCategory = dummyProductCategory,
158167
selectedSortType = ProductSortType.LATEST,
159168
isSortBottomSheetVisible = false,

app/src/main/java/com/poti/android/presentation/party/product/productcategory/model/Contracts.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import com.poti.android.domain.model.party.ProductCategory
99
data class ProductCategoryUiState(
1010
val productCategoryLoadState: ApiState<ProductCategory> = ApiState.Loading,
1111
val isSortBottomSheetVisible: Boolean = false,
12-
val selectedSortType: ProductSortType = ProductSortType.LATEST,
12+
val selectedSortType: ProductSortType = ProductSortType.HOT,
1313
) : UiState
1414

1515
sealed interface ProductCategoryUiIntent : UiIntent {

0 commit comments

Comments
 (0)