Skip to content

Commit

Permalink
style: 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed May 2, 2024
1 parent a7b5fc4 commit 3d1570f
Show file tree
Hide file tree
Showing 28 changed files with 98 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ fun VerticalGrid(
val column = index % columns
val row = index / columns
placeable.placeRelative(
x = column * itemWidth + if(column > 0) gap else 0,
y = columnY[column] + if(row > 0) verticalGap else 0,
x = column * itemWidth + if (column > 0) gap else 0,
y = columnY[column] + if (row > 0) verticalGap else 0,
)
columnY[column] += placeable.height
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fun FlatButton(
modifier: Modifier = Modifier,
buttonColor: Color = MaterialTheme.bbibbiScheme.mainYellow,
textColor: Color = MaterialTheme.bbibbiScheme.backgroundPrimary,
contentPadding: PaddingValues = PaddingValues(
contentPadding: PaddingValues = PaddingValues(
start = 24.dp,
top = 12.dp,
end = 24.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.no5ing.bbibbi.presentation.feature.uistate.post
import com.no5ing.bbibbi.data.model.BaseModel
import com.no5ing.bbibbi.data.model.member.Member
import com.no5ing.bbibbi.data.model.post.DailyCalendarElement
import com.no5ing.bbibbi.data.model.post.Post

data class CalendarFeedUiState(
val post: DailyCalendarElement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.AlertDialogDefaults
import androidx.compose.material3.BasicAlertDialog
import androidx.compose.material3.Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.AlertDialogDefaults
import androidx.compose.material3.BasicAlertDialog
import androidx.compose.material3.Button
Expand All @@ -17,23 +16,13 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
import com.no5ing.bbibbi.R
import com.no5ing.bbibbi.presentation.feature.view.common.AlertDialogContent
import com.no5ing.bbibbi.presentation.feature.view.common.AlertDialogFlowRow
import com.no5ing.bbibbi.presentation.feature.view.common.ButtonsCrossAxisSpacing
import com.no5ing.bbibbi.presentation.feature.view.common.ButtonsMainAxisSpacing
import com.no5ing.bbibbi.presentation.theme.bbibbiScheme
import com.no5ing.bbibbi.presentation.theme.bbibbiTypo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,20 @@ fun PostTypeSwitchButton(
) {
val isSurvival = state.value == PostType.SURVIVAL
val widthMax = 138.dp.dpToPx()
val buttonPosition: Dp by animateDpAsState(targetValue =
if(isSurvival) 0.dp else 69.dp, animationSpec = tween(
durationMillis = 130,
easing = LinearEasing,
),
val buttonPosition: Dp by animateDpAsState(
targetValue =
if (isSurvival) 0.dp else 69.dp, animationSpec = tween(
durationMillis = 130,
easing = LinearEasing,
),
label = ""
)
val survivalButtonColor: Color by animateColorAsState(
targetValue =if(isSurvival) MaterialTheme.bbibbiScheme.backgroundPrimary else MaterialTheme.bbibbiScheme.gray500,
targetValue = if (isSurvival) MaterialTheme.bbibbiScheme.backgroundPrimary else MaterialTheme.bbibbiScheme.gray500,
label = "",
)
val missionButtonColor: Color by animateColorAsState(
targetValue = if(isSurvival) MaterialTheme.bbibbiScheme.gray500 else MaterialTheme.bbibbiScheme.backgroundPrimary,
targetValue = if (isSurvival) MaterialTheme.bbibbiScheme.gray500 else MaterialTheme.bbibbiScheme.backgroundPrimary,
label = "",
)
Box(
Expand All @@ -77,7 +78,7 @@ fun PostTypeSwitchButton(
Timber.d("offset: $offset")
}
}
//.padding(vertical = 8.dp, horizontal = 12.dp)
//.padding(vertical = 8.dp, horizontal = 12.dp)
) {
Box(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import com.no5ing.bbibbi.presentation.component.snackBarWarning
import com.no5ing.bbibbi.presentation.feature.uistate.family.MainFeedUiState
import com.no5ing.bbibbi.presentation.feature.view.main.calendar.MainCalendarDay
import com.no5ing.bbibbi.presentation.feature.view.main.post_view.PostViewContent
import com.no5ing.bbibbi.presentation.feature.view_model.mission.GetMissionByIdViewModel
import com.no5ing.bbibbi.presentation.feature.view_model.post.AddPostReactionViewModel
import com.no5ing.bbibbi.presentation.feature.view_model.post.CalendarWeekViewModel
import com.no5ing.bbibbi.presentation.feature.view_model.post.FamilySwipePostsViewModel
Expand Down Expand Up @@ -316,7 +315,10 @@ fun CalendarDetailPage(
CalendarDetailBody(
onTapProfile = onTapProfile,
onTapRealEmojiCreate = onTapRealEmojiCreate,
item = MainFeedUiState(item.post.toPost(), item.writer),
item = MainFeedUiState(
item.post.toPost(),
item.writer
),
familyPostReactionBarViewModel = familyPostReactionBarViewModel,
removePostReactionViewModel = removePostReactionViewModel,
addPostReactionViewModel = addPostReactionViewModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fun HomePage(
unsavedDialogUri.value = tempUri
unsavedDialogEnabled.value = true
}
if(isDayTime) {
if (isDayTime) {
mainPageViewModel.invoke(Arguments())
} else {
mainPageNightViewModel.invoke(Arguments())
Expand Down Expand Up @@ -135,7 +135,7 @@ fun HomePage(
isUploadAbleTime = remember { gapUntilNext() > 0 },
isAlreadyUploaded = !mainPageState.value.isReady() ||
mainPageState.value.data.isMeSurvivalUploadedToday,
pickers = if(mainPageState.value.isReady()) mainPageState.value.data.pickers
pickers = if (mainPageState.value.isReady()) mainPageState.value.data.pickers
else emptyList(),
)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fun HomePageContent(

val survivalFeedItems = if (mainPageModel.isReady())
mainPageModel.data.survivalFeeds
else emptyList()
else emptyList()
val missionFeedItems = if (mainPageModel.isReady())
mainPageModel.data.missionFeeds
else emptyList()
Expand Down Expand Up @@ -124,14 +124,14 @@ fun HomePageContent(
)
Spacer(modifier = Modifier.height(24.dp))
UploadCountDownBar(warningState = warningState)
if(postViewTypeState.value == PostType.SURVIVAL) {
if (postViewTypeState.value == PostType.SURVIVAL) {
SurvivalTextDescription(warningState = warningState)
} else {
MissionTextDescription(
warningState = warningState,
isMissionUnlocked = mainPageModel.isReady() && mainPageModel.data.isMissionUnlocked,
missionText = if(mainPageModel.isReady()) mainPageModel.data.dailyMissionContent else "",
remainingMemberCnt = if(mainPageModel.isReady()) mainPageModel.data.leftUploadCountUntilMissionUnlock else 0
missionText = if (mainPageModel.isReady()) mainPageModel.data.dailyMissionContent else "",
remainingMemberCnt = if (mainPageModel.isReady()) mainPageModel.data.leftUploadCountUntilMissionUnlock else 0
)
}

Expand Down Expand Up @@ -227,8 +227,10 @@ fun MissionFeedTab(
verticalArrangement = Arrangement.Center,
) {
Image(
painter = painterResource(if(isMissionUnlocked) R.drawable.bbibbi
else R.drawable.chest_bibbi),
painter = painterResource(
if (isMissionUnlocked) R.drawable.bbibbi
else R.drawable.chest_bibbi
),
contentDescription = null, // 필수 param
modifier = Modifier
.fillMaxWidth(),
Expand Down Expand Up @@ -257,7 +259,9 @@ fun MissionFeedTab(
@Composable
fun SurvivalTextDescription(warningState: MutableState<Int>) {
Row(
modifier = Modifier.fillMaxWidth().height(20.dp),
modifier = Modifier
.fillMaxWidth()
.height(20.dp),
horizontalArrangement = Arrangement.spacedBy(2.dp, Alignment.CenterHorizontally),
verticalAlignment = Alignment.CenterVertically,
) {
Expand Down Expand Up @@ -294,7 +298,9 @@ fun MissionTextDescription(
remainingMemberCnt: Int,
) {
Row(
modifier = Modifier.fillMaxWidth().height(20.dp),
modifier = Modifier
.fillMaxWidth()
.height(20.dp),
horizontalArrangement = Arrangement.spacedBy(2.dp, Alignment.CenterHorizontally),
verticalAlignment = Alignment.CenterVertically,
) {
Expand All @@ -305,7 +311,7 @@ fun MissionTextDescription(
}
append("만 더 올리면 미션 열쇠를 받아요!")
}
if(isMissionUnlocked) {
if (isMissionUnlocked) {
Text(
text = missionText,
color = MaterialTheme.bbibbiScheme.textSecondary,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.no5ing.bbibbi.R
import com.no5ing.bbibbi.presentation.component.MicroTextBubbleBox
import com.no5ing.bbibbi.presentation.theme.bbibbiScheme
import com.no5ing.bbibbi.presentation.theme.bbibbiTypo
import com.no5ing.bbibbi.util.asyncImagePainter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -30,32 +29,27 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.no5ing.bbibbi.R
import com.no5ing.bbibbi.data.model.APIResponse
import com.no5ing.bbibbi.data.model.member.Member
import com.no5ing.bbibbi.data.model.view.MainPageModel
import com.no5ing.bbibbi.data.model.view.MainPageTopBarModel
import com.no5ing.bbibbi.presentation.component.CircleProfileImage
import com.no5ing.bbibbi.presentation.feature.uistate.family.MainFeedStoryElementUiState
import com.no5ing.bbibbi.presentation.theme.bbibbiScheme
import com.no5ing.bbibbi.presentation.theme.bbibbiTypo
import com.no5ing.bbibbi.util.LocalSessionState
import com.no5ing.bbibbi.util.gapBetweenNow
import com.no5ing.bbibbi.util.gapUntilNext
import kotlinx.coroutines.flow.StateFlow

@Composable
fun HomePageStoryBar(
//mainPageState: StateFlow<APIResponse<MainPageModel>>,
items: List<MainPageTopBarModel>,
items: List<MainPageTopBarModel>,
deferredPickStateSet: StateFlow<Set<String>>,
onTapProfile: (String) -> Unit = {},
onTapPick: (MainPageTopBarModel) -> Unit = {},
onTapInvite: () -> Unit = {},
) {
val meId = LocalSessionState.current.memberId
// val mainPageModel by mainPageState.collectAsState()
// val mainPageModel by mainPageState.collectAsState()
val deferredPickSet = deferredPickStateSet.collectAsState()
// val items = if (mainPageModel.isReady()) mainPageModel.data.topBarElements else emptyList()
// val items = if (mainPageModel.isReady()) mainPageModel.data.topBarElements else emptyList()

if (items.size == 1) {
HomePageNoFamilyBar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand All @@ -30,7 +29,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Outline
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.Path
Expand All @@ -40,13 +38,11 @@ import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.AsyncImage
import com.no5ing.bbibbi.R
import com.no5ing.bbibbi.data.model.view.MainPagePickerModel
import com.no5ing.bbibbi.presentation.component.CircleProfileImage
import com.no5ing.bbibbi.presentation.component.button.CameraCaptureButton
import com.no5ing.bbibbi.presentation.theme.bbibbiScheme
import com.no5ing.bbibbi.presentation.theme.bbibbiTypo
Expand All @@ -72,7 +68,7 @@ fun BoxScope.HomePageSurvivalUploadButton(
exit = fadeOut(),
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
if(pickers.isNotEmpty() && isUploadAbleTime && !isAlreadyUploaded && !isLoading) {
if (pickers.isNotEmpty() && isUploadAbleTime && !isAlreadyUploaded && !isLoading) {
WaitingMembersPop(
pickers = pickers,
)
Expand Down Expand Up @@ -119,7 +115,7 @@ fun BoxScope.HomePageMissionUploadButton(
Column(horizontalAlignment = Alignment.CenterHorizontally) {
UploadHelperPop(
text =
if(!isMeUploadedToday)
if (!isMeUploadedToday)
"생존신고 후 미션 사진을 올릴 수 있어요"
else if (!isMissionUnlocked)
"아직 미션 사진을 찍을 수 없어요"
Expand Down Expand Up @@ -228,7 +224,7 @@ fun WaitingMembersPop(
}
Spacer(modifier = Modifier.width(16.dp.times(pickersShattered.size - 1)))
}
if(pickers.size == 1) {
if (pickers.size == 1) {
Text(
text = "${pickers.first().displayName}님이 기다리고 있어요",
style = MaterialTheme.bbibbiTypo.bodyTwoRegular,
Expand Down
Loading

0 comments on commit 3d1570f

Please sign in to comment.