Skip to content

Commit 148bb0f

Browse files
authored
Merge pull request #73 from sunny5875/bugfix/72-bug-010-1차-qa-ui-수정
Bugfix/72 bug 010 1차 qa UI 수정
2 parents 3b8104e + 4f5915d commit 148bb0f

File tree

23 files changed

+196
-40
lines changed

23 files changed

+196
-40
lines changed

Projects/Core/Network/Sources/Services/Article/ArticleAPIClient.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public extension DependencyValues {
2525

2626
extension ArticleAPIClient: DependencyKey {
2727
public static var liveValue: ArticleAPIClient = .init(
28-
_fetchArticles: { reqeust in
28+
fetchArticles: { reqeust in
2929
let api = ArticleAPI.fetchArticles(
3030
.init(
3131
categoryId: reqeust.category?.id,
@@ -40,7 +40,7 @@ extension ArticleAPIClient: DependencyKey {
4040
)
4141

4242
public static var testValue: ArticleAPIClient = .init(
43-
_fetchArticles: { _ in
43+
fetchArticles: { _ in
4444
return Article.mockArticles
4545
}
4646
)

Projects/Feature/History/Sources/Component/CheckListBottomSheetView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct CheckListBottomSheetView: View {
2929
)
3030

3131
HStack {
32-
Text("내용 변경")
32+
Text("제목변경")
3333
.notoSans(.body_3)
3434
.foregroundStyle(Color.greyScale950)
3535
Spacer()

Projects/Feature/History/Sources/HistoryView.swift

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ public struct HistoryView: View {
2626
NavigationStack(path: $store.scope(state: \.path, action: \.path)) {
2727
VStack {
2828
TopNavigation(centerTitle: "나의 기록")
29-
content
29+
30+
if store.state.checkList.isEmpty {
31+
emptyView
32+
} else {
33+
content
34+
}
3035
}
3136
.onAppear {
3237
store.send(.onAppear)
@@ -89,10 +94,14 @@ public struct HistoryView: View {
8994
}
9095

9196
private var emptyView: some View {
92-
Image.historyEmptyView
93-
.resizable()
94-
.scaledToFit()
95-
.frame(width: 192, height: 186)
97+
VStack {
98+
Spacer()
99+
Image.historyEmptyView
100+
.resizable()
101+
.scaledToFit()
102+
.frame(width: 192, height: 186)
103+
Spacer()
104+
}
96105
}
97106

98107
@ViewBuilder

Projects/Feature/Home/Sources/DetailChecklist/DetailChecklistStore.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public struct DetailChecklistStore {
1717

1818
@ObservableState
1919
public struct State {
20+
var index: Int
2021
var card: Card
2122
var isPresentDeleteCheckBoxAlert: Bool = false
2223
var willDeleteCheckBox: CheckBox?

Projects/Feature/Home/Sources/DetailChecklist/DetailChecklistView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ import ComposableArchitecture
1414

1515
struct DetailChecklistView: View {
1616
@Bindable private var store: StoreOf<DetailChecklistStore>
17+
private let colorType: ChecklistColorType
1718

1819
init(store: StoreOf<DetailChecklistStore>) {
1920
self.store = store
21+
self.colorType = ChecklistColorType(index: store.index)
2022
}
2123

2224
var body: some View {
@@ -48,6 +50,7 @@ struct DetailChecklistView: View {
4850
DetailColorChecklistCellView(
4951
title: checkBox.label,
5052
isSelected: checkBox.isCompleted,
53+
colorType: colorType,
5154
onToggle: {
5255
store.send(.didTapChecklistCompleteButton(checkBox: checkBox))
5356
},

Projects/Feature/Home/Sources/Home/HomeStore.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public struct HomeStore {
8383

8484
// MARK: - Delegate Actions(parent)
8585

86-
case onNaviagteToDetailChecklist(card: Card)
86+
case onNaviagteToDetailChecklist(card: Card, index: Int)
8787
case onRouteToHistoryScreen
8888

8989
// MARK: - Scope Actions(child)
@@ -141,7 +141,9 @@ public struct HomeStore {
141141
return .none
142142

143143
case .didTapNavigateToDetailChecklist(let card):
144-
return .send(.onNaviagteToDetailChecklist(card: card))
144+
guard let index = state.cards.firstIndex(of: card)
145+
else { return .none }
146+
return .send(.onNaviagteToDetailChecklist(card: card, index: index))
145147

146148
case .fetchData:
147149
return .run { send in

Projects/Feature/Home/Sources/Home/Views/Checklist/CardProgressView.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@
77

88
import SwiftUI
99

10+
import SharedDesignSystem
11+
1012
struct CardProgressView: View {
1113
private let progress: CGFloat
1214
private let isSelected: Bool
15+
private let colorType: ChecklistColorType
1316

1417
init(
18+
colorType: ChecklistColorType,
1519
isSelected: Bool,
1620
progress: CGFloat
1721
) {
22+
self.colorType = colorType
1823
self.isSelected = isSelected
1924
self.progress = progress
2025
}
@@ -29,7 +34,7 @@ struct CardProgressView: View {
2934
Circle()
3035
.trim(from: 0, to: progress)
3136
.stroke(
32-
isSelected ? .primary800 : .greyScale400,
37+
isSelected ? colorType.cardTintColor : .greyScale400,
3338
style: StrokeStyle(lineWidth: 8, lineCap: .butt, lineJoin: .bevel)
3439
)
3540
.rotationEffect(.degrees(-90))
@@ -42,7 +47,7 @@ struct CardProgressView: View {
4247
Text("%")
4348
.notoSans(.subhead_2)
4449
}
45-
.foregroundStyle(isSelected ? .primary800 : .greyScale400)
50+
.foregroundStyle(isSelected ? colorType.cardTintColor : .greyScale400)
4651
}
4752
}
4853
}

Projects/Feature/Home/Sources/Home/Views/Checklist/CardView.swift

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,23 @@
77

88
import SwiftUI
99

10+
import SharedDesignSystem
11+
1012
struct CardView: View {
1113
private let title: String
1214
private let isSelected: Bool
1315
private let progress: CGFloat
1416
private let onTap: () -> Void
17+
private let colorType: ChecklistColorType
1518

1619
init(
20+
colorType: ChecklistColorType,
1721
title: String,
1822
isSelected: Bool,
1923
progress: CGFloat,
2024
onTap: @escaping () -> Void
2125
) {
26+
self.colorType = colorType
2227
self.title = title
2328
self.isSelected = isSelected
2429
self.progress = progress
@@ -31,21 +36,47 @@ struct CardView: View {
3136
}) {
3237
HStack(spacing: .zero) {
3338
VStack(alignment: .leading, spacing: 10) {
34-
CardProgressView(isSelected: isSelected, progress: progress)
39+
CardProgressView(colorType: colorType, isSelected: isSelected, progress: progress)
3540
.padding(.top, 14)
3641

3742
Text(title)
3843
.notoSans(.subhead_3)
39-
.foregroundStyle(isSelected ? .primary800 : .greyScale600)
44+
.foregroundStyle(isSelected ? colorType.cardTintColor : .greyScale600)
4045
}
4146
Spacer()
4247
}
4348
}
4449
.padding(.horizontal, 12)
4550
.frame(width: 162, height: 120)
46-
.background(isSelected ? .primary100 : .greyScale050)
51+
.background(isSelected ? colorType.cardColor : .greyScale050)
4752
.clipShape(
4853
.rect(cornerRadius: 10)
4954
)
5055
}
5156
}
57+
58+
extension ChecklistColorType {
59+
60+
// MARK: - 카드 색상
61+
var cardColor: Color {
62+
switch self {
63+
case .blue:
64+
return Color.primary100
65+
case .green:
66+
return Color(hex: "EFFAF3")
67+
case .orange:
68+
return Color(hex: "FBF1D2")
69+
}
70+
}
71+
72+
var cardTintColor: Color {
73+
switch self {
74+
case .blue:
75+
return Color.primary800
76+
case .green:
77+
return Color(hex: "84E1AF")
78+
case .orange:
79+
return Color(hex: "F07603")
80+
}
81+
}
82+
}

Projects/Feature/Home/Sources/Home/Views/Checklist/ChecklistList.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ import ComposableArchitecture
1414
struct ChecklistList: View {
1515
@Bindable private var store: StoreOf<HomeStore>
1616
private let width: CGFloat
17+
private let colorType: ChecklistColorType
1718

1819
init(store: StoreOf<HomeStore>, width: CGFloat) {
1920
self.store = store
2021
self.width = width
22+
23+
if let selected = store.selectedCard,
24+
let index = store.cards.firstIndex(of: selected) {
25+
self.colorType = ChecklistColorType(index: index)
26+
} else {
27+
self.colorType = .blue
28+
}
2129
}
2230

2331
var body: some View {
@@ -43,7 +51,8 @@ struct ChecklistList: View {
4351
isSelected: checkBox.isCompleted,
4452
onToggle: {
4553
store.send(.didTapChecklistCompleteButton(checkBox: checkBox))
46-
}
54+
},
55+
colorType: colorType
4756
)
4857
}
4958
}

Projects/Feature/Home/Sources/Home/Views/HeaderView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import SwiftUI
99

10+
import SharedDesignSystem
11+
1012
import ComposableArchitecture
1113

1214
struct HeaderView: View {
@@ -85,8 +87,11 @@ struct HeaderView: View {
8587

8688
ScrollView(.horizontal, showsIndicators: false) {
8789
HStack(spacing: 8) {
88-
ForEach(store.cards) { card in
90+
ForEach(0..<store.cards.count) { i in
91+
let card = store.cards[i]
92+
let colorType: ChecklistColorType = .init(index: i)
8993
CardView(
94+
colorType: colorType,
9095
title: card.title,
9196
isSelected: store.selectedCard == card,
9297
progress: card.progress,

0 commit comments

Comments
 (0)