diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt index 629f8a1d5..8b4b6e27b 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt @@ -3,18 +3,14 @@ package com.terning.core.designsystem.component.bottomsheet import androidx.compose.foundation.Image import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.material3.rememberModalBottomSheetState @@ -29,12 +25,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.terning.core.R import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable import kotlinx.coroutines.launch @@ -44,12 +38,13 @@ import kotlinx.coroutines.launch fun SignUpBottomSheet( modifier: Modifier = Modifier, onDismiss: () -> Unit, - onSaveClick: (Int) -> Unit + onSaveClick: (Int) -> Unit, + initialSelectedOption: Int ) { val scope = rememberCoroutineScope() val sheetState = rememberModalBottomSheetState() - var selectedImageIndex by remember { mutableIntStateOf(-1) } + var selectedImageIndex by remember { mutableIntStateOf(initialSelectedOption) } TerningBasicBottomSheet( content = { @@ -66,7 +61,8 @@ fun SignUpBottomSheet( RadioButtonGroup( onOptionSelected = { index -> selectedImageIndex = index - } + }, + initialSelectedOption = initialSelectedOption ) Spacer(modifier = modifier.padding(bottom = 24.dp)) RoundButton( @@ -95,7 +91,8 @@ fun SignUpBottomSheet( @Composable fun RadioButtonGroup( modifier: Modifier = Modifier, - onOptionSelected: (Int) -> Unit + onOptionSelected: (Int) -> Unit, + initialSelectedOption: Int ) { val options = listOf( R.drawable.ic_terning_profile_00, @@ -106,7 +103,7 @@ fun RadioButtonGroup( R.drawable.ic_terning_profile_05 ) - var selectedOption by rememberSaveable { mutableIntStateOf(options[0]) } + var selectedOption by rememberSaveable { mutableIntStateOf(options[initialSelectedOption]) } LazyVerticalGrid( columns = GridCells.Fixed(3), @@ -142,14 +139,4 @@ fun RadioButtonGroup( ) } } -} - -@Preview(showBackground = true) -@Composable -fun SignUpBottomSheetPreview() { - TerningPointTheme { - RadioButtonGroup( - onOptionSelected = {} - ) - } } \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/component/datepicker/DatePicker.kt b/core/src/main/java/com/terning/core/designsystem/component/datepicker/DatePicker.kt index 511d2f3df..c0c133587 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/datepicker/DatePicker.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/datepicker/DatePicker.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn @@ -94,7 +93,7 @@ fun DateItemsPicker( firstIndex: Int, onItemSelected: (String) -> Unit, modifier: Modifier = Modifier, - isYear: Boolean, + isYear: Boolean ) { val listState = rememberLazyListState(firstIndex) val currentValue = remember { mutableStateOf("") } @@ -134,6 +133,7 @@ fun DateItemsPicker( if (it == firstVisibleItemIndex + 1) { currentValue.value = items[index] } + Spacer(modifier = Modifier.height(7.dp)) Text( text = when (isYear) { @@ -142,10 +142,10 @@ fun DateItemsPicker( }, style = TerningTheme.typography.title3, color = if (it == firstVisibleItemIndex + 1) Grey500 else Grey300, - textAlign = TextAlign.Center, - modifier = modifier.padding(vertical = 8.dp) + textAlign = TextAlign.Center ) + Spacer(modifier = Modifier.height(7.dp)) } } } -} +} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt index fd3bab05d..67c799550 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt @@ -61,7 +61,7 @@ fun TerningBasicTextField( BasicTextField( value = value, onValueChange = { - if (maxTextLength == null || it.length <= maxTextLength) { + if (maxTextLength == null || it.length <= maxTextLength + 1) { onValueChange(it) } }, diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringOneScreen.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringOneScreen.kt index 820f67c76..6a5b4cf85 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringOneScreen.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringOneScreen.kt @@ -15,11 +15,11 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar +import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R import com.terning.feature.filtering.filtering.component.StatusOneRadioGroup @@ -30,7 +30,6 @@ fun FilteringOneScreen( name: String, navController: NavController, modifier: Modifier = Modifier, - viewModel: FilteringViewModel = hiltViewModel(), onButtonClick: (Int) -> Unit = {}, ) { val isButtonValid = remember { mutableStateOf(false) } @@ -74,6 +73,7 @@ fun FilteringOneScreen( name ), style = TerningTheme.typography.body5, + color = Grey300, modifier = modifier.padding( top = 3.dp, start = 24.dp, diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringThreeScreen.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringThreeScreen.kt index 51c1a204e..116d67782 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringThreeScreen.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringThreeScreen.kt @@ -18,13 +18,13 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner -import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle import androidx.navigation.NavController import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.datepicker.DatePickerUI import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar +import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.toast import com.terning.feature.R @@ -39,7 +39,6 @@ fun FilteringThreeScreen( modifier: Modifier = Modifier, viewModel: FilteringViewModel = hiltViewModel(), ) { - val state by viewModel.state.collectAsStateWithLifecycle() val context = LocalContext.current val lifecycleOwner = LocalLifecycleOwner.current @@ -101,6 +100,7 @@ fun FilteringThreeScreen( Text( text = stringResource(id = R.string.filtering_status3_sub), style = TerningTheme.typography.body5, + color = Grey300, modifier = modifier.padding( top = 3.dp, start = 24.dp, diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringTwoScreen.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringTwoScreen.kt index fd56e08cd..92d865285 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringTwoScreen.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringTwoScreen.kt @@ -15,11 +15,11 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavController import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar +import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R import com.terning.feature.filtering.filtering.component.StatusTwoRadioGroup @@ -27,16 +27,15 @@ import com.terning.feature.filtering.filtering.navigation.navigateFilteringThree @Composable fun FilteringTwoScreen( - grade : Int, + grade: Int, navController: NavController, modifier: Modifier = Modifier, - viewModel: FilteringViewModel = hiltViewModel(), onButtonClick: (Int) -> Unit = {}, ) { val isButtonValid = remember { mutableStateOf(false) } - var workingPeriod by remember{ mutableIntStateOf(-1) } + var workingPeriod by remember { mutableIntStateOf(-1) } Scaffold( modifier = modifier, @@ -69,6 +68,7 @@ fun FilteringTwoScreen( Text( text = stringResource(id = R.string.filtering_status2_sub), style = TerningTheme.typography.body5, + color = Grey300, modifier = modifier.padding( top = 3.dp, start = 24.dp, @@ -76,20 +76,12 @@ fun FilteringTwoScreen( ) ) StatusTwoRadioGroup( - onButtonClick = {index -> + onButtonClick = { index -> onButtonClick(index) isButtonValid.value = true workingPeriod = index } ) - Text( - text = stringResource(id = R.string.filtering_status1_warning), - style = TerningTheme.typography.detail3, - modifier = modifier.padding( - start = 24.dp, - top = 9.dp - ) - ) Spacer(modifier = modifier.weight(1f)) RectangleButton( style = TerningTheme.typography.button0, diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInViewModel.kt index d2c2abaaf..95172e193 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInViewModel.kt @@ -107,6 +107,5 @@ class SignInViewModel @Inject constructor( companion object { private const val KAKAO_NOT_LOGGED_IN = "statusCode=302" private const val KAKAO = "KAKAO" - private const val BEARER = "Bearer " } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 60d6e2899..fe5fb8984 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -98,6 +98,7 @@ fun SignUpScreen( showBottomSheet = false signUpViewModel.fetchCharacter(it) }, + initialSelectedOption = signUpState.character ) } Text( diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index 1d3bb9cfa..86a944511 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -34,7 +34,12 @@ class SignUpViewModel @Inject constructor( fun isInputValid(name: String) { val nameErrorRegex = Regex(NAME_ERROR) - val trimmedName = if (name.length > MAX_LENGTH) name.substring(0, MAX_LENGTH) else name + var trimmedName = "" + var outOfBoundName = false + if (name.length > MAX_LENGTH) { + trimmedName = name.substring(0, MAX_LENGTH) + outOfBoundName = true + } else trimmedName = name when { nameErrorRegex.containsMatchIn(trimmedName) -> _state.value = _state.value.copy( @@ -46,7 +51,16 @@ class SignUpViewModel @Inject constructor( isButtonValid = false ) - trimmedName.isEmpty() -> _state.value = _state.value.copy( + trimmedName.isEmpty() || trimmedName.isBlank() -> _state.value = _state.value.copy( + name = trimmedName, + drawLineColor = Grey500, + helper = R.string.sign_up_helper, + helperIcon = null, + helperColor = Grey400, + isButtonValid = false + ) + + outOfBoundName -> _state.value = _state.value.copy( name = trimmedName, drawLineColor = Grey500, helper = R.string.sign_up_helper, diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt index ba425dd73..28fca2bfe 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt @@ -22,7 +22,7 @@ fun SignUpProfile( modifier: Modifier = Modifier, index: Int ) { - var grade = when (index) { + val grade = when (index) { 0 -> R.drawable.ic_terning_profile_00 1 -> R.drawable.ic_terning_profile_01 2 -> R.drawable.ic_terning_profile_02 diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index c17ddd097..35e11fc38 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -135,7 +135,7 @@ %s님 - 공지사항 + 약관 및 정책 의견 보내기 버전정보 로그아웃