Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] MA00,MA04 디자인 QA #126

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ac.dnd.mour.android.presentation.common.view.chip

import ac.dnd.mour.android.presentation.common.theme.Body1
import ac.dnd.mour.android.presentation.common.theme.Gray000
import ac.dnd.mour.android.presentation.common.theme.Gray400
import ac.dnd.mour.android.presentation.common.theme.Gray500
import ac.dnd.mour.android.presentation.common.theme.Gray700
import ac.dnd.mour.android.presentation.common.theme.Gray800
Expand Down Expand Up @@ -84,18 +83,14 @@ fun ChipItem(
) {
Text(
text = chipText,
style = Body1.merge(
color = textColor.value,
fontWeight = if (isSelected) FontWeight.SemiBold else FontWeight.Normal
)
style = Body1.merge(color = textColor.value),
fontWeight = if (isSelected) FontWeight.SemiBold else FontWeight.Normal,
)
if (chipCount > 0) {
Spacer(modifier = Modifier.width(4.dp))
Text(
text = chipCount.toString(),
style = Body1.merge(
color = textColor.value
)
style = Body1.merge(color = textColor.value)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ fun TypingPriceField(
placeholder = {
Text(
text = hintText,
style = Headline3.merge(
color = Gray600,
fontWeight = FontWeight.SemiBold
)
fontWeight = FontWeight.SemiBold,
style = Headline3.merge(color = Gray600)
)
},
visualTransformation = textFormat,
Expand All @@ -133,7 +131,6 @@ fun TypingPriceField(
contentPadding = innerPadding
)
}
Spacer(modifier = Modifier.height(8.dp))
Divider(
modifier = Modifier
.fillMaxWidth()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.mour.android.presentation.ui.main.home.common.group.get.type
package ac.dnd.mour.android.presentation.model.relation

import ac.dnd.mour.android.presentation.R

Expand All @@ -11,6 +11,8 @@ enum class DefaultGroupType(
ACQUAINTANCE("지인", R.drawable.ic_group_acquaintance),
RECTAL("직장", R.drawable.ic_group_rectal);

fun getTypeName() = typeName

companion object {
fun checkEditable(name: String): Boolean {
return entries.find { it.typeName == name } == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ac.dnd.mour.android.presentation.ui.main.home
import ac.dnd.mour.android.presentation.R
import ac.dnd.mour.android.presentation.common.theme.Gray000
import ac.dnd.mour.android.presentation.common.theme.Icon24
import ac.dnd.mour.android.presentation.common.theme.Primary3
import ac.dnd.mour.android.presentation.common.util.LaunchedEffectWithLifecycle
import ac.dnd.mour.android.presentation.common.util.coroutine.event.EventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.MutableEventFlow
Expand Down Expand Up @@ -37,8 +36,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
Expand All @@ -59,7 +56,6 @@ fun HomeScreen(
handler: CoroutineExceptionHandler
) {
val scope = rememberCoroutineScope()
var historyExpandedState by remember { mutableStateOf(false) }
val bottomBarItemList: List<MainBottomBarItem> = listOf(
MainBottomBarItem(
route = HistoryConstant.ROUTE,
Expand Down Expand Up @@ -98,11 +94,9 @@ fun HomeScreen(
pageCount = { bottomBarItemList.size }
)

LaunchedEffect(selectedItem, historyExpandedState) {
if (selectedItem != 0 || historyExpandedState) {
LaunchedEffect(selectedItem) {
if (selectedItem != 0) {
appState.systemUiController.setStatusBarColor(Gray000)
} else {
appState.systemUiController.setStatusBarColor(Primary3)
}
pagerState.animateScrollToPage(selectedItem)
}
Expand All @@ -129,10 +123,8 @@ fun HomeScreen(
when (bottomBarItemList[page].route) {
HistoryConstant.ROUTE -> {
HistoryScreen(
appState = appState,
changeState = {
historyExpandedState = it
}
selectedItem = selectedItem,
appState = appState
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import ac.dnd.mour.android.presentation.common.util.coroutine.event.MutableEvent
import ac.dnd.mour.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.mour.android.presentation.common.view.BottomSheetScreen
import ac.dnd.mour.android.presentation.common.view.DialogScreen
import ac.dnd.mour.android.presentation.model.relation.DefaultGroupType
import ac.dnd.mour.android.presentation.ui.main.ApplicationState
import ac.dnd.mour.android.presentation.ui.main.home.common.group.add.AddGroupScreen
import ac.dnd.mour.android.presentation.ui.main.home.common.group.edit.EditGroupScreen
import ac.dnd.mour.android.presentation.ui.main.home.common.group.get.type.DefaultGroupType
import ac.dnd.mour.android.presentation.ui.main.rememberApplicationState
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ac.dnd.mour.android.presentation.R
import ac.dnd.mour.android.presentation.common.theme.Body1
import ac.dnd.mour.android.presentation.common.theme.Gray000
import ac.dnd.mour.android.presentation.common.theme.Gray600
import ac.dnd.mour.android.presentation.common.theme.Gray700
import ac.dnd.mour.android.presentation.common.theme.Gray800
import ac.dnd.mour.android.presentation.common.theme.Headline1
import ac.dnd.mour.android.presentation.common.theme.Primary2
import ac.dnd.mour.android.presentation.common.theme.Primary3
Expand Down Expand Up @@ -166,6 +166,8 @@ fun HistoryBackgroundComponent(
.align(Alignment.TopEnd)
.padding(top = 8.dp)
.offset(x = 23.dp)
.width(236.dp)
.height(160.dp)
) {
LottieAnimation(
composition = composition,
Expand All @@ -181,6 +183,7 @@ fun HistoryBackgroundComponent(
) {
Spacer(modifier = Modifier.height(40.dp))
Text(
fontWeight = FontWeight.SemiBold,
style = Headline1.merge(color = Gray000),
text = "총 ${model.groups.size}번의 마음을 \n주고 받았어요",
fontSize = 20.scaledSp(),
Expand Down Expand Up @@ -226,18 +229,14 @@ fun HistoryBackgroundComponent(
Column {
Text(
text = "지난 일정 ${model.unrecordedSchedule.size}개",
style = Body1.merge(
color = Gray700,
fontWeight = FontWeight.SemiBold
)
fontWeight = FontWeight.SemiBold,
style = Body1.merge(color = Gray800)
)
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = "한번에 기록하기",
style = Body1.merge(
color = Gray600,
fontWeight = FontWeight.Medium
)
fontWeight = FontWeight.Medium,
style = Body1.merge(color = Gray600)
)
Image(
painter = painterResource(R.drawable.ic_chevron_right_gray),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import ac.dnd.mour.android.presentation.common.view.chip.ChipItem
import ac.dnd.mour.android.presentation.common.view.chip.ChipType
import ac.dnd.mour.android.presentation.model.history.HistorySortedType
import ac.dnd.mour.android.presentation.model.history.HistoryViewType
import ac.dnd.mour.android.presentation.model.relation.DefaultGroupType
import ac.dnd.mour.android.presentation.ui.main.ApplicationState
import ac.dnd.mour.android.presentation.ui.main.home.history.detail.HistoryDetailConstant
import android.annotation.SuppressLint
Expand Down Expand Up @@ -66,7 +67,6 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import kotlinx.coroutines.CoroutineExceptionHandler
import timber.log.Timber

@SuppressLint("InvalidColorHexValue")
@Composable
Expand Down Expand Up @@ -95,34 +95,32 @@ fun HistoryPageScreen(
}
}
)
}.sortedByDescending {
it.relationList.size
}.filter {
if (searchText.isNotEmpty()) {
it.name.contains(searchText)
} else {
true
}
}
val relations =
if (selectedGroupId == -1L) groups.flatMap { it.relationList }
else if (selectedGroupId < -1L) listOf()
else groups.find { it.id == selectedGroupId }
?.relationList
?: groups.flatMap { it.relationList }
.sortedByDescending {
if (viewSortType == HistorySortedType.LATEST) it.id else null
}
.sortedBy {
if (viewSortType == HistorySortedType.INTIMACY) {
when (viewType) {
HistoryViewType.TOTAL -> it.giveMoney + it.takeMoney
HistoryViewType.GIVE -> it.giveMoney
HistoryViewType.TAKE -> it.takeMoney
}
} else {
null
}
}
.filter {
if (searchText.isNotEmpty()) {
it.name.contains(searchText)
} else {
true
}

val relations = groups.flatMap { it.relationList }
.sortedByDescending {
when (viewSortType) {
HistorySortedType.LATEST -> it.id
HistorySortedType.INTIMACY -> when (viewType) {
HistoryViewType.TOTAL -> it.giveMoney + it.takeMoney
HistoryViewType.GIVE -> it.giveMoney
HistoryViewType.TAKE -> it.takeMoney
}
}
}
.filter {
if (selectedGroupId == -1L) true
else if (selectedGroupId < 0) false
else it.group.id == selectedGroupId
}

fun navigateToHistoryDetail(id: Long) {
val route = makeRoute(
Expand Down Expand Up @@ -153,9 +151,9 @@ fun HistoryPageScreen(
contentAlignment = Alignment.CenterStart
) {
GroupChipListComponent(
chipType = ChipType.MAIN,
currentSelectedId = selectedGroupId,
groups = groups,
relationCount = model.groups.flatMap { it.relationList }.size,
onSelectChip = { groupId ->
selectedGroupId = groupId
}
Expand All @@ -166,12 +164,13 @@ fun HistoryPageScreen(
.width(56.dp)
.fillMaxHeight()
.background(
Brush.horizontalGradient(
brush = Brush.horizontalGradient(
listOf(
Color(0x00F6F6F7),
Color(0xFFF6F6F7),
)
)
),
alpha = 0.4f
)
)
}
Expand Down Expand Up @@ -240,6 +239,9 @@ fun HistoryPageScreen(
},
)
}
item(1) {
Spacer(modifier = Modifier.height(80.dp))
}
}
}
}
Expand Down Expand Up @@ -317,33 +319,33 @@ fun HistoryPageScreen(

@Composable
private fun GroupChipListComponent(
chipType: ChipType = ChipType.LESS_BORDER,
currentSelectedId: Long,
onSelectChip: (Long) -> Unit,
relationCount: Int,
groups: List<GroupWithRelationDetail>
) {
val defaultList = listOf("전체", "가족", "친구", "지인", "직장")
val defaultList = DefaultGroupType.entries
.map { it.getTypeName() }
.filter { value ->
value !in groups.map { it.name }
}

LazyRow(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
items(defaultList.size) { index ->
item(1) {
ChipItem(
chipType = chipType,
chipType = ChipType.MAIN,
currentSelectedId = setOf(currentSelectedId),
chipId = (-index - 1).toLong(),
chipText = defaultList[index],
chipCount = if (index==0) groups.size else 0,
chipId = -1L,
chipText = "전체",
chipCount = relationCount,
onSelectChip = {
onSelectChip((-index - 1).toLong())
onSelectChip(-1L)
}
)
}

items(groups) { group ->
ChipItem(
chipType = chipType,
chipType = ChipType.MAIN,
currentSelectedId = setOf(currentSelectedId),
chipId = group.id,
chipText = group.name,
Expand All @@ -353,6 +355,19 @@ private fun GroupChipListComponent(
}
)
}

items(defaultList.size) { index ->
ChipItem(
chipType = ChipType.MAIN,
currentSelectedId = setOf(currentSelectedId),
chipId = (-index - 2).toLong(),
chipText = defaultList[index],
chipCount = 0,
onSelectChip = {
onSelectChip((-index - 2).toLong())
}
)
}
}
}

Expand Down Expand Up @@ -430,9 +445,9 @@ private fun EmptyRelationViewPreview() {
@Preview
private fun GroupChipListComponent1Preview() {
GroupChipListComponent(
chipType = ChipType.MAIN,
currentSelectedId = -1,
groups = listOf(),
relationCount = 10,
onSelectChip = {

}
Expand All @@ -443,7 +458,6 @@ private fun GroupChipListComponent1Preview() {
@Preview
private fun GroupChipListComponent2Preview() {
GroupChipListComponent(
chipType = ChipType.MAIN,
currentSelectedId = -1,
groups = listOf(
GroupWithRelationDetail(
Expand Down Expand Up @@ -543,6 +557,7 @@ private fun GroupChipListComponent2Preview() {
)
)
),
relationCount = 10,
onSelectChip = {

}
Expand Down
Loading
Loading