Skip to content

Commit

Permalink
[MERGE] #152 -> develop
Browse files Browse the repository at this point in the history
[FIX/#152] 온보딩, 마이페이지 1차 QA
  • Loading branch information
leeeyubin authored Jul 19, 2024
2 parents d080386 + eb2109b commit 0e3366c
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 = {
Expand All @@ -66,7 +61,8 @@ fun SignUpBottomSheet(
RadioButtonGroup(
onOptionSelected = { index ->
selectedImageIndex = index
}
},
initialSelectedOption = initialSelectedOption
)
Spacer(modifier = modifier.padding(bottom = 24.dp))
RoundButton(
Expand Down Expand Up @@ -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,
Expand All @@ -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),
Expand Down Expand Up @@ -142,14 +139,4 @@ fun RadioButtonGroup(
)
}
}
}

@Preview(showBackground = true)
@Composable
fun SignUpBottomSheetPreview() {
TerningPointTheme {
RadioButtonGroup(
onOptionSelected = {}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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("") }
Expand Down Expand Up @@ -134,6 +133,7 @@ fun DateItemsPicker(
if (it == firstVisibleItemIndex + 1) {
currentValue.value = items[index]
}
Spacer(modifier = Modifier.height(7.dp))
Text(
text =
when (isYear) {
Expand All @@ -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))
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,7 +30,6 @@ fun FilteringOneScreen(
name: String,
navController: NavController,
modifier: Modifier = Modifier,
viewModel: FilteringViewModel = hiltViewModel(),
onButtonClick: (Int) -> Unit = {},
) {
val isButtonValid = remember { mutableStateOf(false) }
Expand Down Expand Up @@ -74,6 +73,7 @@ fun FilteringOneScreen(
name
),
style = TerningTheme.typography.body5,
color = Grey300,
modifier = modifier.padding(
top = 3.dp,
start = 24.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,27 @@ 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
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,
Expand Down Expand Up @@ -69,27 +68,20 @@ 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,
bottom = 25.dp
)
)
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fun SignUpScreen(
showBottomSheet = false
signUpViewModel.fetchCharacter(it)
},
initialSelectedOption = signUpState.character
)
}
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion feature/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@

<!--MyPage-->
<string name="my_page_name">%s님</string>
<string name="my_page_notice">공지사항</string>
<string name="my_page_notice">약관 및 정책</string>
<string name="my_page_opinion">의견 보내기</string>
<string name="my_page_version">버전정보</string>
<string name="my_page_logout">로그아웃</string>
Expand Down

0 comments on commit 0e3366c

Please sign in to comment.