Skip to content

Commit

Permalink
[feat/school_auth]: Add Token Verify Screen
Browse files Browse the repository at this point in the history
  • Loading branch information
kez-lab committed Nov 10, 2023
1 parent 91e51d2 commit e72050b
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.everymeal.presentation.ui.signup.school

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.CenterAlignedTopAppBar
Expand All @@ -24,10 +21,13 @@ import androidx.hilt.navigation.compose.hiltViewModel
import com.everymeal.presentation.R
import com.everymeal.presentation.components.EveryMealConditionAgreeDialog
import com.everymeal.presentation.components.EveryMealConditionAgreeDialogItem
import com.everymeal.presentation.components.EveryMealMainButton
import com.everymeal.presentation.components.EveryMealTextField
import com.everymeal.presentation.ui.signup.school.email.SchoolAuthPostEmailScreen
import com.everymeal.presentation.ui.theme.EveryMealTypography
import com.everymeal.presentation.ui.theme.Main100

enum class SchoolAuthScreenType {
POST_EMAIL,
VERIFY_TOKEN,
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down Expand Up @@ -59,8 +59,7 @@ fun SchoolAuthScreen(
SchoolAuthContent(
modifier = Modifier
.padding(innerPadding)
.padding(horizontal = 20.dp)
.padding(top = 28.dp),
.padding(horizontal = 20.dp),
viewModel = viewModel,
state = viewState
)
Expand Down Expand Up @@ -112,43 +111,11 @@ fun SchoolAuthContent(
viewModel: SchoolAuthViewModel,
state: SchoolContract.State
) {
Column(
modifier = modifier
) {
Text(
text = stringResource(id = R.string.school_auth_content),
style = EveryMealTypography.Heading1
)
Spacer(modifier = Modifier.size(40.dp))
Text(
text = stringResource(id = R.string.email),
style = EveryMealTypography.Body5
)
Spacer(modifier = Modifier.size(6.dp))
EveryMealTextField(
modifier = Modifier.fillMaxWidth(),
value = state.emailLink,
onValueChange = {
viewModel.setEvent(SchoolContract.Event.OnEmailTextChanged(it))
},
supportingText = {
if (state.isEmailError) {
Text(
text = stringResource(id = R.string.email_error),
style = EveryMealTypography.Body5,
color = Main100
)
}
}
)
Spacer(modifier = Modifier.weight(1f))
EveryMealMainButton(
text = stringResource(id = R.string.next),
onClick = {
viewModel.setEvent(SchoolContract.Event.OnNextButtonClicked)
},
)
}
SchoolAuthPostEmailScreen(
modifier = modifier,
viewModel = viewModel,
state = state,
)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.everymeal.presentation.base.ViewState
class SchoolContract {

data class State(
val schoolAuthScreenType: SchoolAuthScreenType = SchoolAuthScreenType.POST_EMAIL,
val isShowConditionBottomSheet: Boolean = false,
val isEmailError: Boolean = false,
val emailLink: String = "",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.everymeal.presentation.ui.signup.school.email

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.everymeal.presentation.R
import com.everymeal.presentation.components.EveryMealMainButton
import com.everymeal.presentation.components.EveryMealTextField
import com.everymeal.presentation.ui.signup.school.SchoolAuthScreenType
import com.everymeal.presentation.ui.signup.school.SchoolAuthViewModel
import com.everymeal.presentation.ui.signup.school.SchoolContract
import com.everymeal.presentation.ui.theme.EveryMealTypography
import com.everymeal.presentation.ui.theme.Gray100
import com.everymeal.presentation.ui.theme.Gray900
import com.everymeal.presentation.ui.theme.Main100

@Composable
fun SchoolAuthPostEmailScreen(
modifier: Modifier,
state: SchoolContract.State,
viewModel: SchoolAuthViewModel
) {
Column(
modifier = modifier.padding(top = 48.dp)
) {
Text(
text = when (state.schoolAuthScreenType) {
SchoolAuthScreenType.POST_EMAIL -> stringResource(id = R.string.school_auth_content)
SchoolAuthScreenType.VERIFY_TOKEN -> stringResource(id = R.string.email_token_verify_title)
},
style = EveryMealTypography.Heading1,
color = Gray900
)
Spacer(modifier = Modifier.size(40.dp))
Text(
text = when(state.schoolAuthScreenType) {
SchoolAuthScreenType.POST_EMAIL -> stringResource(id = R.string.email)
SchoolAuthScreenType.VERIFY_TOKEN -> stringResource(id = R.string.verify_token)
},
style = EveryMealTypography.Body5,
color = Gray100
)
Spacer(modifier = Modifier.size(6.dp))
EveryMealTextField(
modifier = Modifier.fillMaxWidth(),
value = state.emailLink,
onValueChange = {
viewModel.setEvent(SchoolContract.Event.OnEmailTextChanged(it))
},
supportingText = {
if (state.isEmailError) {
Text(
text = stringResource(id = R.string.email_error),
style = EveryMealTypography.Body5,
color = Main100
)
}
}
)
Spacer(modifier = Modifier.weight(1f))
EveryMealMainButton(
text = stringResource(id = R.string.next),
onClick = {
viewModel.setEvent(SchoolContract.Event.OnNextButtonClicked)
},
)
}
}
2 changes: 2 additions & 0 deletions presentation/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<string name="exit">나가기</string>
<string name="next">다음</string>
<string name="email">이메일</string>
<string name="verify_token">인증번호</string>
<string name="email_error">잘못된 이메일 형식이에요</string>

<!-- 로그인, 온보딩, 대학선택화면 -->
Expand Down Expand Up @@ -123,6 +124,7 @@
<string name="school_auth_content">학교 인증을 위해\n대학 메일을 입력해주세요</string>
<string name="condition_agree_title">이용을 위한 동의가 필요해요</string>
<string name="condition_agree">[필수] 이용 약관 동의</string>
<string name="email_token_verify_title">메일로 전달받은\n인증번호를 입력해주세요</string>


<!-- 에러다이얼로그 -->
Expand Down

0 comments on commit e72050b

Please sign in to comment.