Skip to content

Commit ede7f36

Browse files
authored
Merge pull request #127 from YAPP-Github/refacotr/#126-stats-qa
통계 화면 QA 적용
2 parents 140d054 + a7774b4 commit ede7f36

File tree

10 files changed

+48
-32
lines changed

10 files changed

+48
-32
lines changed

core/design-system/src/main/java/com/twix/designsystem/components/stats/PictureDayCell.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fun PictureDayCell(
5656
modifier =
5757
Modifier
5858
.size(36.dp)
59-
.rotate(-16f)
59+
.rotate(16f)
6060
.border(1.dp, GrayColor.C400, cornerShape)
6161
.background(CommonColor.White, cornerShape),
6262
)
@@ -68,8 +68,8 @@ fun PictureDayCell(
6868
.size(36.dp)
6969
.clip(cornerShape)
7070
.then(
71-
if (showBackgroundCard) {
72-
Modifier.border(1.dp, borderColor, cornerShape)
71+
if (hasImage) {
72+
Modifier.border((1.2).dp, borderColor, cornerShape)
7373
} else {
7474
Modifier
7575
},
@@ -104,7 +104,7 @@ fun PictureDayCell(
104104

105105
AppText(
106106
text = date.dayOfMonth.toString(),
107-
style = AppTextStyle.B1,
107+
style = AppTextStyle.B3,
108108
color = textColor,
109109
textAlign = TextAlign.Center,
110110
)

core/design-system/src/main/java/com/twix/designsystem/components/stats/StampCell.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ fun StampCell(
3131
AppText(
3232
text = stats.nickname,
3333
style = AppTextStyle.B4,
34-
color = GrayColor.C500,
34+
color = GrayColor.C400,
3535
)
3636

3737
Spacer(modifier = Modifier.weight(1f))
3838

3939
AppText(
4040
text = stringResource(R.string.stats_stamp_end_count).format(stats.completedCount),
4141
style = AppTextStyle.B4,
42-
color = GrayColor.C500,
42+
color = GrayColor.C400,
4343
)
4444
}
4545

core/design-system/src/main/java/com/twix/designsystem/components/stats/StatsCalendar.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import androidx.compose.foundation.layout.Row
77
import androidx.compose.foundation.layout.Spacer
88
import androidx.compose.foundation.layout.fillMaxWidth
99
import androidx.compose.foundation.layout.height
10-
import androidx.compose.foundation.layout.size
1110
import androidx.compose.runtime.Composable
11+
import androidx.compose.ui.Alignment
1212
import androidx.compose.ui.Modifier
1313
import androidx.compose.ui.res.stringResource
1414
import androidx.compose.ui.text.style.TextAlign
@@ -82,16 +82,20 @@ private fun DayOfWeekHeader() {
8282
modifier = Modifier.fillMaxWidth(),
8383
) {
8484
days.forEach { day ->
85-
AppText(
86-
text = day,
87-
style = AppTextStyle.B2,
88-
color = GrayColor.C300,
85+
Box(
8986
modifier =
9087
Modifier
9188
.weight(1f)
9289
.height(24.dp),
93-
textAlign = TextAlign.Center,
94-
)
90+
contentAlignment = Alignment.Center,
91+
) {
92+
AppText(
93+
text = day,
94+
style = AppTextStyle.C1,
95+
color = GrayColor.C300,
96+
textAlign = TextAlign.Center,
97+
)
98+
}
9599
}
96100
}
97101
}

core/design-system/src/main/res/values/strings.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
<string name="word_friday">금</string>
4040
<string name="word_saturday">토</string>
4141

42+
<!-- 날짜 포맷 -->
43+
<string name="date_year_month_day">%s년 %02d월 %02d일</string>
44+
<string name="date_year_month_day_no_padding">%1$d년 %2$d월 %3$d일</string>
45+
4246
<!-- 동작 -->
4347
<string name="action_edit">수정하기</string>
4448
<string name="action_delete">삭제하기</string>
@@ -73,7 +77,6 @@
7377
<string name="goal_list_title_previous">지난 우리 목표</string>
7478
<string name="goal_list_title_today">오늘 우리 목표</string>
7579
<string name="goal_list_title_next">다음 우리 목표</string>
76-
<string name="date_year_month_day">%s년 %02d월 %02d일</string>
7780
<string name="goal_detail_empty_goal_guide">아직 목표가 없어요!</string>
7881

7982
<!-- 설정 화면 -->
@@ -92,7 +95,7 @@
9295
<string name="stats_stamp_end_tab_title">종료</string>
9396

9497
<!-- 통계 상세 화면 -->
95-
<string name="stats_complete_count">%1$s %2$d/%3$d</string>
98+
<string name="stats_complete_count">%1$s - %2$d/%3$d</string>
9699

97100
<!-- 알림 화면 -->
98101
<string name="notification_recent_14_days">최근 14일</string>

core/util/src/main/java/com/twix/util/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

feature/main/src/main/java/com/twix/stats/StatsViewModel.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ class StatsViewModel(
4444
)
4545

4646
init {
47+
collectMonthChange()
48+
fetchInProgressStats(YearMonth.from(currentState.currentDate))
49+
fetchCompletedStats()
50+
collectEventBus()
51+
}
52+
53+
private fun collectMonthChange() {
4754
viewModelScope.launch {
4855
monthChangeFlow
4956
.distinctUntilChanged()
@@ -52,10 +59,6 @@ class StatsViewModel(
5259
fetchInProgressStats(yearMonth)
5360
}
5461
}
55-
56-
fetchInProgressStats(YearMonth.from(currentState.currentDate))
57-
fetchCompletedStats()
58-
collectEventBus()
5962
}
6063

6164
override suspend fun handleIntent(intent: StatsIntent) {

feature/main/src/main/java/com/twix/stats/component/EndStatsContent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fun EndStatsContent(
3838
)
3939
}
4040
} else {
41-
item { Spacer(Modifier.height(12.dp)) }
41+
item { Spacer(Modifier.height(20.dp)) }
4242

4343
items(
4444
items = statsGoals,

feature/photolog/capture/src/main/java/com/twix/photolog/capture/PhotologCaptureViewModel.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.twix.ui.image.ImageGenerator
2222
import com.twix.util.bus.GoalRefreshBus
2323
import com.twix.util.bus.PhotologRefreshBus
2424
import com.twix.util.bus.StatsDetailRefreshBus
25+
import com.twix.util.bus.StatsRefreshBus
2526
import kotlinx.coroutines.Dispatchers
2627
import kotlinx.coroutines.delay
2728
import kotlinx.coroutines.launch
@@ -34,6 +35,7 @@ class PhotologCaptureViewModel(
3435
private val detailRefreshBus: PhotologRefreshBus,
3536
private val goalRefreshBus: GoalRefreshBus,
3637
private val statsDetailRefreshBus: StatsDetailRefreshBus,
38+
private val statsRefreshBus: StatsRefreshBus,
3739
savedStateHandle: SavedStateHandle,
3840
) : BaseViewModel<PhotologCaptureUiState, PhotologCaptureIntent, PhotologCaptureSideEffect>(
3941
PhotologCaptureUiState(),
@@ -190,11 +192,16 @@ class PhotologCaptureViewModel(
190192

191193
private fun handleUploadPhotologSuccess() {
192194
when (navArgs.from) {
193-
NavRoutes.PhotologRoute.From.HOME ->
195+
NavRoutes.PhotologRoute.From.HOME -> {
194196
goalRefreshBus.notifyGoalListChanged()
197+
statsRefreshBus.notifyChanged(StatsRefreshBus.Target.All)
198+
}
195199

196-
NavRoutes.PhotologRoute.From.DETAIL ->
200+
NavRoutes.PhotologRoute.From.DETAIL -> {
197201
detailRefreshBus.notifyChanged(PhotologRefreshBus.Publisher.PHOTOLOG)
202+
statsDetailRefreshBus.notifyChanged()
203+
statsRefreshBus.notifyChanged(StatsRefreshBus.Target.All)
204+
}
198205

199206
NavRoutes.PhotologRoute.From.EDITOR -> Unit
200207
}

feature/stats/detail/src/main/java/com/twix/stats/detail/StatsDetailScreen.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ fun StatsDetailScreen(
125125
modifier =
126126
Modifier
127127
.fillMaxSize()
128+
.verticalScroll(scrollState)
128129
.background(GrayColor.C050),
129130
) {
130131
StatsDetailTopbar(
@@ -158,26 +159,25 @@ fun StatsDetailScreen(
158159
modifier =
159160
Modifier
160161
.fillMaxWidth()
161-
.verticalScroll(scrollState),
162+
.padding(top = 32.dp),
162163
) {
163164
Image(
164165
imageVector = ImageVector.vectorResource(R.drawable.ic_hug),
165166
contentDescription = null,
166167
modifier =
167168
Modifier
168169
.align(Alignment.TopStart)
169-
.padding(start = 20.dp, top = 30.dp),
170+
.padding(start = 20.dp),
170171
)
171172

172173
Column(
173174
modifier =
174175
Modifier
175176
.fillMaxWidth()
176-
.padding(horizontal = 20.dp),
177+
.padding(horizontal = 20.dp)
178+
.padding(top = 4.dp),
177179
horizontalAlignment = Alignment.CenterHorizontally,
178180
) {
179-
Spacer(Modifier.height(32.dp))
180-
181181
CalendarNavigator(
182182
currentDate = uiState.detail.currentDate,
183183
onPreviousMonth = onPreviousMonth,
@@ -210,7 +210,7 @@ fun StatsDetailScreen(
210210
modifier =
211211
Modifier
212212
.align(Alignment.TopEnd)
213-
.padding(end = 27.dp, top = 30.dp),
213+
.padding(end = 27.dp),
214214
)
215215
}
216216

feature/stats/detail/src/main/java/com/twix/stats/detail/component/SummaryContent.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fun SummaryContent(
105105
label = stringResource(R.string.word_start_date),
106106
value =
107107
stringResource(
108-
R.string.date_year_month_day,
108+
R.string.date_year_month_day_no_padding,
109109
statsSummary.startDate.year,
110110
statsSummary.startDate.monthValue,
111111
statsSummary.startDate.dayOfMonth,
@@ -116,7 +116,7 @@ fun SummaryContent(
116116
value =
117117
statsSummary.endDate?.let {
118118
stringResource(
119-
R.string.date_year_month_day,
119+
R.string.date_year_month_day_no_padding,
120120
it.year,
121121
it.monthValue,
122122
it.dayOfMonth,
@@ -170,7 +170,7 @@ private fun SummaryContentPreview() {
170170
partnerCompletedCount = 8,
171171
totalCount = 20,
172172
repeatCycle = RepeatCycle.DAILY,
173-
startDate = LocalDate.now(),
173+
startDate = LocalDate.of(2025, 11, 12),
174174
endDate = LocalDate.now(),
175175
),
176176
)

0 commit comments

Comments
 (0)