Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
isanghoony committed Dec 10, 2024
1 parent 26fd618 commit d6520fc
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 57 deletions.
19 changes: 9 additions & 10 deletions app/src/main/java/com/ddd/attendance/ui/component/DDDSituation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ fun DDDMemberSituation(

@Composable
fun AttendanceStatusRow(
modifier: Modifier = Modifier,
onPressQrcode:() -> Unit,
onPressMyPage:() -> Unit
) {
Row(
modifier = Modifier
modifier = modifier
.fillMaxWidth()
.height(52.dp)
.background(DDD_WHITE),
Expand All @@ -103,20 +104,18 @@ fun AttendanceStatusRow(
Spacer(modifier = Modifier.weight(1F))

Image(
modifier = Modifier.noRippleClickable(onClick = onPressMyPage),
painter = painterResource(R.drawable.ic_36_my_info),
modifier = Modifier.noRippleClickable(onClick = onPressQrcode),
painter = painterResource(R.drawable.ic_36_qr_code),
contentDescription = "Arrow Icon"
)

Spacer(modifier = Modifier.width(12.dp))

Image(
modifier = Modifier.noRippleClickable(onClick = onPressQrcode),
painter = painterResource(R.drawable.ic_36_qr_code),
modifier = Modifier.noRippleClickable(onClick = onPressMyPage),
painter = painterResource(R.drawable.ic_36_my_info),
contentDescription = "Arrow Icon"
)

Spacer(modifier = Modifier.width(24.dp))
}
}

Expand All @@ -134,7 +133,7 @@ fun DDDMemberSituationItem(
text = "$count",
color = textColor,
textStyle = MaterialTheme.typography.headlineSmall,
fontWeight = FontWeight.W700,
fontWeight = FontWeight.Bold,
)

Spacer(modifier = Modifier.height(4.dp))
Expand All @@ -143,7 +142,7 @@ fun DDDMemberSituationItem(
text = label,
textStyle = MaterialTheme.typography.bodyMedium,
color = DDD_TEXT_SECONDARY,
fontWeight = FontWeight.W500,
fontWeight = FontWeight.Medium,
)
}
}
Expand All @@ -169,7 +168,7 @@ fun DDDAdminSituationItem(
DDDText(
text = text,
color = DDD_WHITE,
fontWeight = FontWeight.W700,
fontWeight = FontWeight.Bold,
fontSize = 20.sp
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ddd.attendance.ui.login.screen.affiliation

import android.app.Activity
import android.content.Intent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -43,15 +44,16 @@ fun AffiliationScreen(
navController: NavController,
viewModel: LoginProcessViewModel
) {
val context = LocalContext.current
val context = LocalContext.current as? Activity
Content(
onClickBackButton = {
navController.popBackStack()
},
onClickNext = {
// 어디로 가야하는가~
context.startActivity(Intent(context, MainActivity::class.java))
viewModel.onClickNextFromUserAffiliation()
context?.startActivity(Intent(context, MainActivity::class.java))
context?.finish()
}
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ddd.attendance.ui.main.screen.member

import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -57,8 +58,12 @@ fun MemberScreen(
private fun Content(
onPressMyPage:() -> Unit,
onPressQrcode:() -> Unit,
onClickBackButton: () -> Unit,
onClickBackButton:() -> Unit,
) {
BackHandler {
onClickBackButton()
}

Box(
modifier = Modifier
.fillMaxSize()
Expand All @@ -75,71 +80,93 @@ private fun Content(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(horizontal = 24.dp)
) {
item {
Spacer(Modifier.height(36.dp))
HeaderSection(onPressMyPage, onPressQrcode)
}

AttendanceStatusRow(
onPressQrcode = onPressMyPage,
onPressMyPage = onPressQrcode
)

item {
Spacer(Modifier.height(20.dp))

DDDText(
text = stringResource(R.string.member_attendance_status, "김디디"),
color = DDD_TEXT_PRIMARY,
textStyle = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.Bold
)

Spacer(Modifier.height(16.dp))

DDDText(
text = stringResource(R.string.member_activity_period, "2025.03.12 ~ 2025.08.12"),
color = DDD_NEUTRAL_GRAY_50,
textStyle = MaterialTheme.typography.bodySmall,
fontWeight = FontWeight.Normal
)

Spacer(Modifier.height(8.dp))

DDDMemberSituation(
attendanceCount = 2,
tardyCount = 3,
absentCount = 5
)

Spacer(Modifier.height(56.dp))

DDDText(
text = stringResource(R.string.member_th_schedule, "12"),
color = DDD_TEXT_PRIMARY,
textStyle = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Medium
)

Spacer(Modifier.height(16.dp))
BodySection()
}

items(schedules) { item ->
ScheduleItem(
modifier = Modifier.padding(horizontal = 24.dp),
month = item.month,
day = item.day,
title = item.title,
content = item.content
)

Spacer(Modifier.height(12.dp))
}
}
}
}

@Composable
private fun ScheduleItem(month: String, day: String, title: String, content: String) {
private fun HeaderSection(
onPressMyPage:() -> Unit,
onPressQrcode:() -> Unit
) {
AttendanceStatusRow(
modifier = Modifier.padding(start = 16.dp, end = 24.dp),
onPressQrcode = onPressMyPage,
onPressMyPage = onPressQrcode
)
}

@Composable
private fun BodySection() {
Column(
modifier = Modifier.padding(horizontal = 24.dp)
) {
DDDText(
text = stringResource(R.string.member_attendance_status, "김디디"),
color = DDD_TEXT_PRIMARY,
textStyle = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.Bold
)

Spacer(Modifier.height(16.dp))

DDDText(
text = stringResource(R.string.member_activity_period, "2025.03.12 ~ 2025.08.12"),
color = DDD_NEUTRAL_GRAY_50,
textStyle = MaterialTheme.typography.bodySmall,
fontWeight = FontWeight.Normal
)

Spacer(Modifier.height(8.dp))

DDDMemberSituation(
attendanceCount = 2,
tardyCount = 3,
absentCount = 5
)

Spacer(Modifier.height(56.dp))

DDDText(
text = stringResource(R.string.member_th_schedule, "12"),
color = DDD_TEXT_PRIMARY,
textStyle = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Medium
)

Spacer(Modifier.height(16.dp))
}
}

@Composable
private fun ScheduleItem(modifier: Modifier = Modifier
,month: String,
day: String,
title: String,
content: String) {
Box(
modifier = Modifier
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(DDD_GRAY_F5)
Expand Down

0 comments on commit d6520fc

Please sign in to comment.