Skip to content

Commit a033295

Browse files
committed
✨[feat]: 출석 현황 관련해서 구현 #38
* attandace check view로 뷰를 switch 할수 있게 구현
1 parent 0424487 commit a033295

File tree

10 files changed

+608
-401
lines changed

10 files changed

+608
-401
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
//
2+
// AttandanceCheck.swift
3+
// Presentation
4+
//
5+
// Created by Wonji Suh on 1/16/25.
6+
//
7+
8+
import Foundation
9+
import ComposableArchitecture
10+
11+
import Utill
12+
13+
@Reducer
14+
public struct AttandanceCheck {
15+
public init() {}
16+
17+
@ObservableState
18+
public struct State: Equatable {
19+
20+
public init() {}
21+
var selectAttandanceDate: Date = .now
22+
}
23+
24+
public enum Action: ViewAction, BindableAction, FeatureAction {
25+
case binding(BindingAction<State>)
26+
case view(View)
27+
case async(AsyncAction)
28+
case inner(InnerAction)
29+
case navigation(NavigationAction)
30+
31+
}
32+
33+
//MARK: - ViewAction
34+
@CasePathable
35+
public enum View {
36+
37+
}
38+
39+
40+
41+
//MARK: - AsyncAction 비동기 처리 액션
42+
public enum AsyncAction: Equatable {
43+
44+
}
45+
46+
//MARK: - 앱내에서 사용하는 액션
47+
public enum InnerAction: Equatable {
48+
}
49+
50+
//MARK: - NavigationAction
51+
public enum NavigationAction: Equatable {
52+
53+
54+
}
55+
56+
57+
public var body: some ReducerOf<Self> {
58+
BindingReducer()
59+
Reduce { state, action in
60+
switch action {
61+
case .binding(_):
62+
return .none
63+
64+
case .view(let viewAction):
65+
return handleViewAction(state: &state, action: viewAction)
66+
67+
case .async(let asyncAction):
68+
return handleAsyncAction(state: &state, action: asyncAction)
69+
70+
case .inner(let innerAction):
71+
return handleInnerAction(state: &state, action: innerAction)
72+
73+
case .navigation(let navigationAction):
74+
return handleNavigationAction(state: &state, action: navigationAction)
75+
}
76+
}
77+
}
78+
79+
private func handleViewAction(
80+
state: inout State,
81+
action: View
82+
) -> Effect<Action> {
83+
switch action {
84+
85+
}
86+
}
87+
88+
private func handleAsyncAction(
89+
state: inout State,
90+
action: AsyncAction
91+
) -> Effect<Action> {
92+
switch action {
93+
94+
}
95+
}
96+
97+
private func handleNavigationAction(
98+
state: inout State,
99+
action: NavigationAction
100+
) -> Effect<Action> {
101+
switch action {
102+
103+
}
104+
}
105+
106+
private func handleInnerAction(
107+
state: inout State,
108+
action: InnerAction
109+
) -> Effect<Action> {
110+
switch action {
111+
112+
}
113+
}
114+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// AttandanceCheckView.swift
3+
// Presentation
4+
//
5+
// Created by Wonji Suh on 1/16/25.
6+
//
7+
8+
import SwiftUI
9+
import Shareds
10+
import ComposableArchitecture
11+
12+
struct AttandanceCheckView: View {
13+
@Bindable var store: StoreOf<AttandanceCheck>
14+
15+
var body: some View{
16+
VStack {
17+
selectAttandanceDate()
18+
19+
attandanceStatusView()
20+
21+
22+
}
23+
}
24+
}
25+
26+
27+
extension AttandanceCheckView {
28+
29+
@ViewBuilder
30+
fileprivate func selectAttandanceDate() -> some View {
31+
LazyVStack {
32+
Spacer()
33+
.frame(height: 24)
34+
35+
HStack {
36+
Text("🗓️")
37+
.pretendardCustomFont(textStyle: .body1NormalMedium)
38+
39+
Spacer()
40+
.frame(width: 4)
41+
42+
Text("\(store.selectAttandanceDate.formattedDateTimeText(date: store.selectAttandanceDate))")
43+
.pretendardCustomFont(textStyle: .body1NormalMedium)
44+
.foregroundStyle(.staticWhite)
45+
46+
Spacer()
47+
}
48+
}
49+
.padding(.horizontal, 24)
50+
}
51+
52+
@ViewBuilder
53+
fileprivate func attandanceStatusView() -> some View {
54+
LazyVStack {
55+
Spacer()
56+
.frame(height: 14)
57+
58+
AttendanceCard(
59+
attendanceCount: 1,
60+
lateCount: 2,
61+
absentCount: 4,
62+
isManager: true)
63+
}
64+
.padding(.horizontal, 24)
65+
}
66+
}
67+

0 commit comments

Comments
 (0)