Skip to content

Commit

Permalink
[FEATURE] #63 : Profile 화면 함수 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Dec 27, 2023
1 parent 2e479e1 commit c954bb5
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.wap.wapp.feature.profile
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -32,6 +33,7 @@ import com.wap.designsystem.WappTheme
import com.wap.designsystem.component.WappCard
import com.wap.wapp.core.designresource.R.drawable
import com.wap.wapp.core.designresource.R.string
import com.wap.wapp.feature.profile.component.WappAttendacneRow
import com.wap.wapp.feature.profile.component.WappProfileCard

@Composable
Expand Down Expand Up @@ -85,7 +87,7 @@ internal fun ProfileScreen(
WappProfileCard(role = role, userName = userName)

if (role == Role.GUEST) {
GuestModeScreen(navigateToSignInScreen = navigateToSignInScreen)
GuestScreen(navigateToSignInScreen = navigateToSignInScreen)
return
}

Expand All @@ -94,7 +96,7 @@ internal fun ProfileScreen(
}

@Composable
private fun GuestModeScreen(navigateToSignInScreen: () -> Unit) {
private fun GuestScreen(navigateToSignInScreen: () -> Unit) {
Text(
text = SpannableGuestText(),
color = WappTheme.colors.white,
Expand Down Expand Up @@ -125,49 +127,86 @@ private fun GuestModeScreen(navigateToSignInScreen: () -> Unit) {
}
}

@Composable
private fun SpannableGuestText() = buildAnnotatedString {
append("로그인하여\n")
withStyle(
style = SpanStyle(
color = WappTheme.colors.yellow34,
textDecoration = TextDecoration.Underline,
),
) {
append("WAPP")
}
append("")
withStyle(
style = SpanStyle(
color = WappTheme.colors.yellow34,
textDecoration = TextDecoration.Underline,
),
) {
append("추억")
}
append("을 쌓아보세요!")
}

@Composable
private fun UserScreen() {
Column(modifier = Modifier.padding(horizontal = 10.dp)) {
val cardModifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
WapAttendance(modifier = Modifier.padding(top = 20.dp))

WappCard(modifier = cardModifier.padding(vertical = 20.dp)) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 15.dp, vertical = 10.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = "WAP 출석",
style = WappTheme.typography.captionBold.copy(fontSize = 20.sp),
color = WappTheme.colors.white,
)

Image(
painter = painterResource(id = drawable.ic_check),
contentDescription = "",
modifier = Modifier.padding(start = 10.dp),
)
}
MyAttendanceStatus(modifier = Modifier.padding(top = 20.dp))

MySurveyHistory(modifier = Modifier.padding(top = 20.dp))
}
}

@Composable
private fun WapAttendance(modifier: Modifier) {
WappCard(
modifier = modifier
.fillMaxWidth()
.wrapContentHeight(),
) {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 15.dp, vertical = 10.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = "2023-12-23",
style = WappTheme.typography.contentRegular,
text = "WAP 출석",
style = WappTheme.typography.captionBold.copy(fontSize = 20.sp),
color = WappTheme.colors.white,
modifier = Modifier.padding(top = 20.dp),
)

Text(
text = "오늘은 별 다른 행사가 없어요!",
style = WappTheme.typography.contentRegular.copy(fontSize = 20.sp),
color = WappTheme.colors.white,
modifier = Modifier.padding(top = 5.dp),
Image(
painter = painterResource(id = drawable.ic_check),
contentDescription = "",
modifier = Modifier.padding(start = 10.dp),
)
}

Text(
text = "2023-12-23",
style = WappTheme.typography.contentRegular,
color = WappTheme.colors.white,
modifier = Modifier.padding(top = 20.dp),
)

Text(
text = "오늘은 별 다른 행사가 없어요!",
style = WappTheme.typography.contentRegular.copy(fontSize = 20.sp),
color = WappTheme.colors.white,
modifier = Modifier.padding(top = 5.dp),
)
}
}
}

@Composable
private fun MyAttendanceStatus(modifier: Modifier = Modifier) {
Column(modifier = modifier) {
Text(
text = stringResource(id = R.string.my_attendance),
style = WappTheme.typography.titleBold.copy(fontSize = 20.sp),
Expand All @@ -176,45 +215,42 @@ private fun UserScreen() {
)

WappCard(
modifier = cardModifier,
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(top = 10.dp),
) {
LazyColumn() {
Column(
verticalArrangement = Arrangement.spacedBy(10.dp),
modifier = Modifier.padding(vertical = 10.dp),
) {
WappAttendacneRow(isAttendance = false)
WappAttendacneRow(isAttendance = true)
WappAttendacneRow(isAttendance = false)
WappAttendacneRow(isAttendance = true)
}
}
}
}

@Composable
private fun MySurveyHistory(modifier: Modifier = Modifier) {
Column(modifier = modifier) {
Text(
text = stringResource(id = R.string.survey_i_did),
style = WappTheme.typography.titleBold.copy(fontSize = 20.sp),
color = WappTheme.colors.white,
modifier = Modifier.padding(start = 5.dp),
)

WappCard(modifier = cardModifier) {
WappCard(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(top = 10.dp),
) {
LazyColumn() {
}
}
}
}

@Composable
private fun SpannableGuestText() = buildAnnotatedString {
append("로그인하여\n")
withStyle(
style = SpanStyle(
color = WappTheme.colors.yellow34,
textDecoration = TextDecoration.Underline,
),
) {
append("WAPP")
}
append("")
withStyle(
style = SpanStyle(
color = WappTheme.colors.yellow34,
textDecoration = TextDecoration.Underline,
),
) {
append("추억")
}
append("을 쌓아보세요!")
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ import com.wap.designsystem.WappTheme
import com.wap.wapp.core.designresource.R

@Composable
internal fun WappAttendacneRow() {
Row(modifier = Modifier.padding(horizontal = 10.dp)) {
internal fun WappAttendacneRow(
isAttendance: Boolean,
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier.padding(horizontal = 10.dp),
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.weight(1f),
) {
WappAttendanceBadge()
WappAttendanceBadge(isAttendance = isAttendance)
Text(
text = "프로젝트 세미나",
style = WappTheme.typography.labelRegular,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.wap.wapp.feature.profile.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.wap.designsystem.WappTheme
import com.wap.wapp.core.designresource.R

@Composable
internal fun WappSurveyHistoryRow(
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier.padding(horizontal = 10.dp),
) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.weight(1f),
) {
Text(
text = "프로젝트 세미나",
style = WappTheme.typography.labelRegular,
color = WappTheme.colors.white,
modifier = Modifier.padding(start = 10.dp),
)
}
Text(
text = "09월 04일",
style = WappTheme.typography.labelRegular,
color = WappTheme.colors.white,
)
}
}

@Composable
private fun WappAttendanceBadge(isAttendance: Boolean = true) {
val drawableId = if (isAttendance) R.drawable.ic_attendance else R.drawable.ic_absent
Image(painter = painterResource(id = drawableId), contentDescription = "")
}

0 comments on commit c954bb5

Please sign in to comment.