Skip to content

Commit

Permalink
FEAT: 기본 프로필 설정 UI 구현 (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed Feb 7, 2024
1 parent 47131af commit 7afbee7
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,21 @@ class ProfileEditViewModel @Inject constructor(
validateFields()
}

fun updateEmail(newEmail: String) {
_email.value = newEmail
validateFields()
}

fun updatePhoneNumber(newPhoneNumber: String) {
_phoneNum.value = newPhoneNumber
validateFields()
}

private fun validateFields() {
_isAllFieldsValid.value = _major.value.isNotBlank() &&
_selectedPart.value != null &&
_interests.value.isNotEmpty()
_interests.value.isNotEmpty() &&
_email.value.isNotBlank() &&
_phoneNum.value.isNotBlank()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ 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.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
Expand All @@ -32,6 +34,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.kusitms.presentation.R
import com.kusitms.presentation.common.ui.KusitmsMarginVerticalSpacer
import com.kusitms.presentation.common.ui.KusitmsSnackField
import com.kusitms.presentation.common.ui.KusitsmTopBarBackTextWithIcon
import com.kusitms.presentation.common.ui.theme.KusitmsColorPalette
import com.kusitms.presentation.common.ui.theme.KusitmsTypo
Expand All @@ -52,6 +55,8 @@ fun ProfileEditScreen(
viewModel: ProfileEditViewModel = hiltViewModel(),
onBack: () -> Unit,
) {
val scrollState = rememberScrollState()

val expanded by viewModel.expended.collectAsStateWithLifecycle()
val email by viewModel.email.collectAsState()
val phoneNum by viewModel.phoneNum.collectAsState()
Expand Down Expand Up @@ -115,6 +120,7 @@ fun ProfileEditScreen(
.fillMaxWidth()
.padding(20.dp)
.background(KusitmsColorPalette.current.Grey900)
.verticalScroll(scrollState)
.height(910.dp),
verticalArrangement = Arrangement.Top,
horizontalAlignment = Alignment.Start
Expand All @@ -141,21 +147,34 @@ fun ProfileEditScreen(
}
}
Spacer(modifier = Modifier.height(20.dp))
Text(text = stringResource(id = R.string.signin_member_title1), style = KusitmsTypo.current.SubTitle2_Semibold, color = KusitmsColorPalette.current.Grey300)
Text(
text = stringResource(id = R.string.signin_member_title1),
style = KusitmsTypo.current.SubTitle2_Semibold,
color = KusitmsColorPalette.current.Grey300
)
Spacer(modifier = Modifier.height(28.dp))
Text(text = stringResource(id = R.string.signin_member_caption1_1), style = KusitmsTypo.current.Caption1, color = KusitmsColorPalette.current.Grey400)
Text(
text = stringResource(id = R.string.signin_member_caption1_1),
style = KusitmsTypo.current.Caption1,
color = KusitmsColorPalette.current.Grey400
)
Spacer(modifier = Modifier.height(5.dp))
SignInFixedInput(modelValue = name)
Spacer(modifier = Modifier.height(20.dp))

//전공
Text(text = stringResource(id = R.string.signin_member_caption1_2), style = KusitmsTypo.current.Caption1, color = KusitmsColorPalette.current.Grey400)
Text(
text = stringResource(id = R.string.signin_member_caption1_2),
style = KusitmsTypo.current.Caption1,
color = KusitmsColorPalette.current.Grey400
)
Spacer(modifier = Modifier.height(5.dp))
KusitmsInputField(
text = R.string.signin_member_hint1_1,
value = major,
onValueChange = viewModel::updateMajor)
if(major.length > 20) {
onValueChange = viewModel::updateMajor
)
if (major.length > 20) {
Spacer(modifier = Modifier.height(4.dp))
Text(
text = "최대 20자까지 입력할 수 있어요",
Expand All @@ -165,7 +184,76 @@ fun ProfileEditScreen(
}

Spacer(modifier = Modifier.height(24.dp))
//파트 선택

Text(
text = stringResource(id = R.string.signin_member_caption1_3),
style = KusitmsTypo.current.Caption1,
color = KusitmsColorPalette.current.Grey400
)
Spacer(modifier = Modifier.height(5.dp))
(if (!selectedPart.isNullOrEmpty()) {
selectedPart
} else {
stringResource(R.string.signin_member_hint1_2)
})?.let {
KusitmsSnackField(
text = it,
onSnackClick = {
isOpenPartBottomSheet = true
}
)
}

//관심 카테고리
Spacer(modifier = Modifier.height(24.dp))
Text(
text = stringResource(id = R.string.signin_member_caption1_4),
style = KusitmsTypo.current.Caption1,
color = KusitmsColorPalette.current.Grey400
)
Spacer(modifier = Modifier.height(5.dp))
KusitmsSnackField(
text = likeCategoryText,
onSnackClick = {
isOpenLikeCategoryBottomSheet = true
}
)


Spacer(modifier = Modifier.height(40.dp))
Text(
text = stringResource(id = R.string.signin_member_title2),
style = KusitmsTypo.current.SubTitle2_Semibold,
color = KusitmsColorPalette.current.Grey300
)
//이메일
Spacer(modifier = Modifier.height(24.dp))
Text(
text = stringResource(id = R.string.signin_member_caption1_5),
style = KusitmsTypo.current.Caption1,
color = KusitmsColorPalette.current.Grey400
)
Spacer(modifier = Modifier.height(5.dp))
KusitmsInputField(
text = R.string.signin_member_hint1_4,
value = email,
onValueChange = viewModel::updateEmail
)

//전화번호
Spacer(modifier = Modifier.height(20.dp))
Text(
text = stringResource(id = R.string.signin_member_caption1_6),
style = KusitmsTypo.current.Caption1,
color = KusitmsColorPalette.current.Grey400
)
Spacer(modifier = Modifier.height(5.dp))
KusitmsInputField(
text = R.string.signin_member_hint1_5,
value = phoneNum,
onValueChange = viewModel::updatePhoneNumber
)
}
}
}
Expand Down

0 comments on commit 7afbee7

Please sign in to comment.