Skip to content

Commit 4f1429f

Browse files
committed
FEAT: 모임 만남 제안 화면
1 parent 470190d commit 4f1429f

File tree

4 files changed

+100
-39
lines changed

4 files changed

+100
-39
lines changed

feature/proposal-create/src/main/java/com/plottwist/feature/proposal_create/component/CreateProposalPostCard.kt

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import androidx.compose.ui.graphics.Color
2121
import androidx.compose.ui.graphics.vector.ImageVector
2222
import androidx.compose.ui.res.stringResource
2323
import androidx.compose.ui.res.vectorResource
24+
import androidx.compose.ui.text.style.TextAlign
2425
import androidx.compose.ui.tooling.preview.Preview
2526
import androidx.compose.ui.unit.dp
2627
import com.plottwist.core.designsystem.R
@@ -38,7 +39,8 @@ fun CreateProposalPostCard(
3839
selectedGatheringName: String,
3940
onSelectGatheringClick: () -> Unit,
4041
onCloseSelectedGatheringClick: () -> Unit,
41-
modifier: Modifier = Modifier
42+
modifier: Modifier = Modifier,
43+
isEnabledEditGatheringName: Boolean = true
4244
) {
4345
PostCard(
4446
modifier = modifier,
@@ -53,6 +55,7 @@ fun CreateProposalPostCard(
5355
SelectedGatheringButton(
5456
modifier = Modifier.align(Alignment.TopEnd),
5557
gatheringName = selectedGatheringName,
58+
isEnabledEditGatheringName = isEnabledEditGatheringName,
5659
onClick = onCloseSelectedGatheringClick
5760
)
5861
} else {
@@ -114,14 +117,18 @@ fun SelectGatheringButton(
114117
fun SelectedGatheringButton(
115118
gatheringName: String,
116119
onClick: () -> Unit,
117-
modifier: Modifier = Modifier
120+
modifier: Modifier = Modifier,
121+
isEnabledEditGatheringName: Boolean = true
118122
) {
119123
Row(
120124
modifier = modifier
121-
.dashedBorder(
122-
color = Color(0xFFA0A0A0),
123-
shape = RoundedCornerShape(10.dp),
124-
strokeWidth = 1.dp
125+
.then(
126+
if(isEnabledEditGatheringName) Modifier.dashedBorder(
127+
color = Color(0xFFA0A0A0),
128+
shape = RoundedCornerShape(10.dp),
129+
strokeWidth = 1.dp
130+
)
131+
else Modifier
125132
)
126133
.clip(RoundedCornerShape(10.dp))
127134
.padding(8.dp)
@@ -135,14 +142,17 @@ fun SelectedGatheringButton(
135142
modifier = Modifier.weight(1f),
136143
text = stringResource(R.string.create_proposal_selected_gathering_name, gatheringName),
137144
style = TukSerifTypography.body14R,
145+
textAlign = if(isEnabledEditGatheringName) TextAlign.Start else TextAlign.End,
138146
color = Color(0xFF888888)
139147
)
140-
Icon(
141-
modifier = Modifier.size(20.dp),
142-
imageVector = ImageVector.vectorResource(R.drawable.ic_close_small),
143-
contentDescription = "close",
144-
tint = Color(0xFF888888)
145-
)
148+
if(isEnabledEditGatheringName){
149+
Icon(
150+
modifier = Modifier.size(20.dp),
151+
imageVector = ImageVector.vectorResource(R.drawable.ic_close_small),
152+
contentDescription = "close",
153+
tint = Color(0xFF888888)
154+
)
155+
}
146156
}
147157
}
148158

feature/proposal-create/src/main/java/com/plottwist/feature/proposal_create/gathering_proposal/CreateGatheringProposalContract.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ data class CreateGatheringProposalState(
99
val whatLabel : TextFieldState = TextFieldState(),
1010
val whenTags : List<String> = emptyList(),
1111
val whereTags : List<String> = emptyList(),
12-
val whatTags : List<String> = emptyList()
12+
val whatTags : List<String> = emptyList(),
13+
val gatheringName: String,
14+
val gatheringId: Long,
15+
val isReady: Boolean = false
1316
)
1417

1518
sealed class CreateGatheringProposalAction {
1619
data object ClickBack : CreateGatheringProposalAction()
1720
data object ClickWhenRefresh : CreateGatheringProposalAction()
1821
data object ClickWhereRefresh : CreateGatheringProposalAction()
1922
data object ClickWhatRefresh : CreateGatheringProposalAction()
23+
data object ClickNext: CreateGatheringProposalAction()
2024
}
2125

2226
sealed class CreateGatheringProposalSideEffect {

feature/proposal-create/src/main/java/com/plottwist/feature/proposal_create/gathering_proposal/CreateGatheringProposalScreen.kt

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import androidx.compose.runtime.getValue
1919
import androidx.compose.ui.Alignment
2020
import androidx.compose.ui.Modifier
2121
import androidx.compose.ui.graphics.Color
22-
import androidx.compose.ui.input.nestedscroll.NestedScrollConnection
23-
import androidx.compose.ui.input.nestedscroll.nestedScroll
2422
import androidx.compose.ui.res.stringResource
2523
import androidx.compose.ui.tooling.preview.Preview
2624
import androidx.compose.ui.unit.dp
@@ -34,6 +32,7 @@ import com.plottwist.core.designsystem.foundation.type.TukSerifTypography
3432
import com.plottwist.core.ui.component.TopAppBarCloseButton
3533
import com.plottwist.feature.proposal_create.CreateProposalGradientBackgroundImage
3634
import com.plottwist.feature.proposal_create.component.CreateGatheringProposalPostCard
35+
import com.plottwist.feature.proposal_create.component.CreateProposalPostCard
3736
import org.orbitmvi.orbit.compose.collectAsState
3837
import org.orbitmvi.orbit.compose.collectSideEffect
3938

@@ -45,9 +44,11 @@ fun CreateGatheringProposalScreen(
4544
) {
4645
val state by viewModel.collectAsState()
4746

48-
viewModel.collectSideEffect {
49-
when (it) {
50-
CreateGatheringProposalSideEffect.NavigateBack -> onBack()
47+
viewModel.collectSideEffect { sideEffect ->
48+
when (sideEffect) {
49+
CreateGatheringProposalSideEffect.NavigateBack -> {
50+
onBack()
51+
}
5152
}
5253
}
5354

@@ -56,10 +57,13 @@ fun CreateGatheringProposalScreen(
5657
whenLabel = state.whenLabel,
5758
whereLabel = state.whereLabel,
5859
whatLabel = state.whatLabel,
60+
isReady = state.isReady,
61+
selectedGatheringName = state.gatheringName,
5962
onBackClick = { viewModel.handleAction(CreateGatheringProposalAction.ClickBack) },
6063
onWhenRefreshClick = { viewModel.handleAction(CreateGatheringProposalAction.ClickWhenRefresh) },
6164
onWhereRefreshClick = { viewModel.handleAction(CreateGatheringProposalAction.ClickWhereRefresh) },
62-
onWhatRefreshClick = { viewModel.handleAction(CreateGatheringProposalAction.ClickWhatRefresh) }
65+
onWhatRefreshClick = { viewModel.handleAction(CreateGatheringProposalAction.ClickWhatRefresh) },
66+
onNextClick = { viewModel.handleAction(CreateGatheringProposalAction.ClickNext) }
6367
)
6468
}
6569

@@ -68,10 +72,13 @@ private fun CreateGatheringProposalScreen(
6872
whenLabel: TextFieldState,
6973
whereLabel: TextFieldState,
7074
whatLabel: TextFieldState,
75+
isReady: Boolean,
76+
selectedGatheringName: String,
7177
onBackClick: () -> Unit,
7278
onWhenRefreshClick: () -> Unit,
7379
onWhereRefreshClick: () -> Unit,
7480
onWhatRefreshClick: () -> Unit,
81+
onNextClick: () -> Unit,
7582
modifier: Modifier = Modifier,
7683
verticalState: ScrollState = rememberScrollState(),
7784
) {
@@ -105,30 +112,45 @@ private fun CreateGatheringProposalScreen(
105112
color = Gray900
106113
)
107114

108-
CreateGatheringProposalPostCard(
109-
modifier = Modifier
110-
.width(300.dp)
111-
.height(370.dp)
112-
.align(Alignment.CenterHorizontally)
113-
,
114-
whereLabel = whereLabel,
115-
whenLabel = whenLabel,
116-
whatLabel = whatLabel,
117-
onWhenRefreshClick = onWhenRefreshClick,
118-
onWhereRefreshClick = onWhereRefreshClick,
119-
onWhatRefreshClick = onWhatRefreshClick
120-
)
115+
if(isReady) {
116+
CreateProposalPostCard(
117+
modifier = Modifier
118+
.width(300.dp)
119+
.height(370.dp)
120+
.align(Alignment.CenterHorizontally),
121+
whereLabel = whereLabel.text.toString(),
122+
whenLabel = whenLabel.text.toString(),
123+
whatLabel = whatLabel.text.toString(),
124+
selectedGatheringName = selectedGatheringName,
125+
isEnabledEditGatheringName = false,
126+
onSelectGatheringClick = { },
127+
onCloseSelectedGatheringClick = {}
128+
)
129+
} else {
130+
CreateGatheringProposalPostCard(
131+
modifier = Modifier
132+
.width(300.dp)
133+
.height(370.dp)
134+
.align(Alignment.CenterHorizontally)
135+
,
136+
whereLabel = whereLabel,
137+
whenLabel = whenLabel,
138+
whatLabel = whatLabel,
139+
onWhenRefreshClick = onWhenRefreshClick,
140+
onWhereRefreshClick = onWhereRefreshClick,
141+
onWhatRefreshClick = onWhatRefreshClick
142+
)
143+
}
144+
121145
}
122146

123147
TukSolidButton(
124148
modifier = Modifier
125149
.fillMaxWidth()
126150
.padding(horizontal = 20.dp, vertical = 16.dp),
127-
text = stringResource(R.string.common_next),
151+
text = if(isReady) "제안하기" else stringResource(R.string.common_next),
128152
buttonType = TukSolidButtonType.ACTIVE,
129-
onClick = {
130-
// TODO
131-
}
153+
onClick = onNextClick
132154
)
133155
}
134156
}
@@ -159,6 +181,9 @@ private fun CreateGatheringProposalScreenPreview() {
159181
whatLabel = TextFieldState(),
160182
onWhenRefreshClick = {},
161183
onWhereRefreshClick = {},
162-
onWhatRefreshClick = {}
184+
onWhatRefreshClick = {},
185+
isReady = false,
186+
selectedGatheringName = "",
187+
onNextClick = {}
163188
)
164189
}

feature/proposal-create/src/main/java/com/plottwist/feature/proposal_create/gathering_proposal/CreateGatheringProposalViewModel.kt

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
package com.plottwist.feature.proposal_create.gathering_proposal
22

33
import androidx.compose.foundation.text.input.TextFieldState
4+
import androidx.lifecycle.SavedStateHandle
45
import androidx.lifecycle.ViewModel
6+
import androidx.navigation.toRoute
57
import com.plottwist.core.domain.gathering.usecase.GetPurposesUseCase
68
import com.plottwist.core.domain.model.Purposes
9+
import com.plottwist.core.ui.navigation.Route
10+
import com.plottwist.feature.proposal_create.CreateProposalState
711
import dagger.hilt.android.lifecycle.HiltViewModel
812
import org.orbitmvi.orbit.ContainerHost
913
import org.orbitmvi.orbit.viewmodel.container
1014
import javax.inject.Inject
1115

1216
@HiltViewModel
1317
class CreateGatheringProposalViewModel @Inject constructor(
14-
private val getPurposesUseCase: GetPurposesUseCase
18+
private val getPurposesUseCase: GetPurposesUseCase,
19+
savedStateHandle: SavedStateHandle
1520
) : ContainerHost<CreateGatheringProposalState, CreateGatheringProposalSideEffect>, ViewModel() {
16-
override val container = container<CreateGatheringProposalState, CreateGatheringProposalSideEffect>(CreateGatheringProposalState()) {
21+
override val container = container<CreateGatheringProposalState, CreateGatheringProposalSideEffect>(
22+
savedStateHandle.toRoute<Route.CreateGatheringProposal>().let { route ->
23+
CreateGatheringProposalState(
24+
gatheringName = route.gatheringName,
25+
gatheringId = route.gatheringId
26+
)
27+
}) {
1728
getPurposes()
1829
}
1930

@@ -50,6 +61,10 @@ class CreateGatheringProposalViewModel @Inject constructor(
5061
CreateGatheringProposalAction.ClickWhereRefresh -> {
5162
handleWhereRefresh()
5263
}
64+
65+
CreateGatheringProposalAction.ClickNext -> {
66+
handleNext()
67+
}
5368
}
5469
}
5570

@@ -93,4 +108,11 @@ class CreateGatheringProposalViewModel @Inject constructor(
93108
}
94109
}
95110

111+
private fun handleNext() = intent {
112+
reduce {
113+
state.copy(
114+
isReady = true
115+
)
116+
}
117+
}
96118
}

0 commit comments

Comments
 (0)