Skip to content
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 @@ -25,7 +25,7 @@ public extension DependencyValues {

extension ArticleAPIClient: DependencyKey {
public static var liveValue: ArticleAPIClient = .init(
_fetchArticles: { reqeust in
fetchArticles: { reqeust in
let api = ArticleAPI.fetchArticles(
.init(
categoryId: reqeust.category?.id,
Expand All @@ -40,7 +40,7 @@ extension ArticleAPIClient: DependencyKey {
)

public static var testValue: ArticleAPIClient = .init(
_fetchArticles: { _ in
fetchArticles: { _ in
return Article.mockArticles
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct CheckListBottomSheetView: View {
)

HStack {
Text("내용 변경")
Text("제목변경")
.notoSans(.body_3)
.foregroundStyle(Color.greyScale950)
Spacer()
Expand Down
19 changes: 14 additions & 5 deletions Projects/Feature/History/Sources/HistoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ public struct HistoryView: View {
NavigationStack(path: $store.scope(state: \.path, action: \.path)) {
VStack {
TopNavigation(centerTitle: "나의 기록")
content

if store.state.checkList.isEmpty {
emptyView
} else {
content
}
}
.onAppear {
store.send(.onAppear)
Expand Down Expand Up @@ -89,10 +94,14 @@ public struct HistoryView: View {
}

private var emptyView: some View {
Image.historyEmptyView
.resizable()
.scaledToFit()
.frame(width: 192, height: 186)
VStack {
Spacer()
Image.historyEmptyView
.resizable()
.scaledToFit()
.frame(width: 192, height: 186)
Spacer()
}
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public struct DetailChecklistStore {

@ObservableState
public struct State {
var index: Int
var card: Card
var isPresentDeleteCheckBoxAlert: Bool = false
var willDeleteCheckBox: CheckBox?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import ComposableArchitecture

struct DetailChecklistView: View {
@Bindable private var store: StoreOf<DetailChecklistStore>
private let colorType: ChecklistColorType

init(store: StoreOf<DetailChecklistStore>) {
self.store = store
self.colorType = ChecklistColorType(index: store.index)
}

var body: some View {
Expand Down Expand Up @@ -48,6 +50,7 @@ struct DetailChecklistView: View {
DetailColorChecklistCellView(
title: checkBox.label,
isSelected: checkBox.isCompleted,
colorType: colorType,
onToggle: {
store.send(.didTapChecklistCompleteButton(checkBox: checkBox))
},
Expand Down
6 changes: 4 additions & 2 deletions Projects/Feature/Home/Sources/Home/HomeStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public struct HomeStore {

// MARK: - Delegate Actions(parent)

case onNaviagteToDetailChecklist(card: Card)
case onNaviagteToDetailChecklist(card: Card, index: Int)
case onRouteToHistoryScreen

// MARK: - Scope Actions(child)
Expand Down Expand Up @@ -141,7 +141,9 @@ public struct HomeStore {
return .none

case .didTapNavigateToDetailChecklist(let card):
return .send(.onNaviagteToDetailChecklist(card: card))
guard let index = state.cards.firstIndex(of: card)
else { return .none }
return .send(.onNaviagteToDetailChecklist(card: card, index: index))

case .fetchData:
return .run { send in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@

import SwiftUI

import SharedDesignSystem

struct CardProgressView: View {
private let progress: CGFloat
private let isSelected: Bool
private let colorType: ChecklistColorType

init(
colorType: ChecklistColorType,
isSelected: Bool,
progress: CGFloat
) {
self.colorType = colorType
self.isSelected = isSelected
self.progress = progress
}
Expand All @@ -29,7 +34,7 @@ struct CardProgressView: View {
Circle()
.trim(from: 0, to: progress)
.stroke(
isSelected ? .primary800 : .greyScale400,
isSelected ? colorType.cardTintColor : .greyScale400,
style: StrokeStyle(lineWidth: 8, lineCap: .butt, lineJoin: .bevel)
)
.rotationEffect(.degrees(-90))
Expand All @@ -42,7 +47,7 @@ struct CardProgressView: View {
Text("%")
.notoSans(.subhead_2)
}
.foregroundStyle(isSelected ? .primary800 : .greyScale400)
.foregroundStyle(isSelected ? colorType.cardTintColor : .greyScale400)
}
}
}
Expand Down
37 changes: 34 additions & 3 deletions Projects/Feature/Home/Sources/Home/Views/Checklist/CardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@

import SwiftUI

import SharedDesignSystem

struct CardView: View {
private let title: String
private let isSelected: Bool
private let progress: CGFloat
private let onTap: () -> Void
private let colorType: ChecklistColorType

init(
colorType: ChecklistColorType,
title: String,
isSelected: Bool,
progress: CGFloat,
onTap: @escaping () -> Void
) {
self.colorType = colorType
self.title = title
self.isSelected = isSelected
self.progress = progress
Expand All @@ -31,21 +36,47 @@ struct CardView: View {
}) {
HStack(spacing: .zero) {
VStack(alignment: .leading, spacing: 10) {
CardProgressView(isSelected: isSelected, progress: progress)
CardProgressView(colorType: colorType, isSelected: isSelected, progress: progress)
.padding(.top, 14)

Text(title)
.notoSans(.subhead_3)
.foregroundStyle(isSelected ? .primary800 : .greyScale600)
.foregroundStyle(isSelected ? colorType.cardTintColor : .greyScale600)
}
Spacer()
}
}
.padding(.horizontal, 12)
.frame(width: 162, height: 120)
.background(isSelected ? .primary100 : .greyScale050)
.background(isSelected ? colorType.cardColor : .greyScale050)
.clipShape(
.rect(cornerRadius: 10)
)
}
}

extension ChecklistColorType {

// MARK: - 카드 색상
var cardColor: Color {
switch self {
case .blue:
return Color.primary100
case .green:
return Color(hex: "EFFAF3")
case .orange:
return Color(hex: "FBF1D2")
}
}

var cardTintColor: Color {
switch self {
case .blue:
return Color.primary800
case .green:
return Color(hex: "84E1AF")
case .orange:
return Color(hex: "F07603")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ import ComposableArchitecture
struct ChecklistList: View {
@Bindable private var store: StoreOf<HomeStore>
private let width: CGFloat
private let colorType: ChecklistColorType

init(store: StoreOf<HomeStore>, width: CGFloat) {
self.store = store
self.width = width

if let selected = store.selectedCard,
let index = store.cards.firstIndex(of: selected) {
self.colorType = ChecklistColorType(index: index)
} else {
self.colorType = .blue
}
}

var body: some View {
Expand All @@ -43,7 +51,8 @@ struct ChecklistList: View {
isSelected: checkBox.isCompleted,
onToggle: {
store.send(.didTapChecklistCompleteButton(checkBox: checkBox))
}
},
colorType: colorType
)
}
}
Expand Down
7 changes: 6 additions & 1 deletion Projects/Feature/Home/Sources/Home/Views/HeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import SwiftUI

import SharedDesignSystem

import ComposableArchitecture

struct HeaderView: View {
Expand Down Expand Up @@ -85,8 +87,11 @@ struct HeaderView: View {

ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 8) {
ForEach(store.cards) { card in
ForEach(0..<store.cards.count) { i in
let card = store.cards[i]
let colorType: ChecklistColorType = .init(index: i)
CardView(
colorType: colorType,
title: card.title,
isSelected: store.selectedCard == card,
progress: card.progress,
Expand Down
10 changes: 5 additions & 5 deletions Projects/Feature/Home/Sources/HomeRootStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public struct HomeRootStore {

// MARK: - Navigation

case navigateToDetailChecklist(card: Card)
case navigateToDetailChecklist(card: Card, index: Int)
}

@Reducer
Expand All @@ -61,8 +61,8 @@ public struct HomeRootStore {
case .onPresentChat:
return .send(.onPresentChat)

case .onNaviagteToDetailChecklist(let card):
return .send(.navigateToDetailChecklist(card: card))
case .onNaviagteToDetailChecklist(let card, let index):
return .send(.navigateToDetailChecklist(card: card, index: index))

default:
return .none
Expand All @@ -71,8 +71,8 @@ public struct HomeRootStore {
case .onAppendChecklist(let checklist):
return .send(.home(.onAppendNewChecklist(checklist: checklist)))

case .navigateToDetailChecklist(let card):
state.path.append(.detailChecklist(.init(card: card)))
case .navigateToDetailChecklist(let card, let index):
state.path.append(.detailChecklist(.init(index: index, card: card)))
return .none

default:
Expand Down
2 changes: 1 addition & 1 deletion Projects/Feature/Login/Sources/LoginStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public struct LoginStore {
}
},
catch: { error, send in
debugPrint(error)
// debugPrint(error)
await send(.setLoading(false))
await send(.loginFailure(error))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"images" : [
{
"filename" : "HomeBackground@1x.png",
"filename" : "background.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "HomeBackground@2x.png",
"filename" : "background@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "HomeBackground@3x.png",
"filename" : "background@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// ChecklistColorType.swift
// FeatureHome
//
// Created by 현수빈 on 10/15/25.
//

import SwiftUI

public enum ChecklistColorType: Int, CaseIterable {
case blue = 0
case green
case orange

public init(index: Int) {
self = ChecklistColorType(rawValue: index % ChecklistColorType.allCases.count ) ?? .blue
}

// MARK: - 체크리스트 색상
var checklistColor: Color {
switch self {
case .blue:
return Color.primary050
case .green:
return Color(hex: "EFFAF3")
case .orange:
return Color.sub050
}
}

var checklistTintColor: Color {
switch self {
case .blue:
return Color.primary500
case .green:
return Color(hex: "84E1AF")
case .orange:
return Color.sub500
}
}

// MARK: - 선택 시 체크리스 색상
var checklistSelectedColor: Color {
switch self {
case .blue:
return Color.primary100
case .green:
return Color(hex: "E5FBEC")
case .orange:
return Color.sub100
}
}

var checklistSelectedTintColor: Color {
switch self {
case .blue:
return Color.primary900
case .green:
return Color(hex: "489C6E")
case .orange:
return Color.sub600
}
}
}
Loading