Skip to content

Commit e27737c

Browse files
committed
[Feat] TraineeHomeView UI 수정 사항 반영
1 parent 0a87542 commit e27737c

File tree

9 files changed

+68
-79
lines changed

9 files changed

+68
-79
lines changed

TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_clock.imageset/Size=16, Type=clock.svg

Lines changed: 2 additions & 2 deletions
Loading

TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_start_empty.imageset/Contents.json renamed to TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_star.imageset/Contents.json

File renamed without changes.

TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_start_empty.imageset/Size=16, Type=star.svg renamed to TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_star.imageset/Size=16, Type=star.svg

Lines changed: 1 addition & 1 deletion
Loading

TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_star_smile.imageset/Contents.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,7 @@
22
"images" : [
33
{
44
"filename" : "Size=24, Type=smile.svg",
5-
"idiom" : "universal",
6-
"scale" : "1x"
7-
},
8-
{
9-
"idiom" : "universal",
10-
"scale" : "2x"
11-
},
12-
{
13-
"idiom" : "universal",
14-
"scale" : "3x"
5+
"idiom" : "universal"
156
}
167
],
178
"info" : {

TnT/Projects/DesignSystem/Resources/Assets.xcassets/Icons/icn_star_smile.imageset/Size=24, Type=smile.svg

Lines changed: 4 additions & 4 deletions
Loading

TnT/Projects/DesignSystem/Sources/Components/Card/TRecordCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public struct TRecordCard: View {
7676
case .success(let image):
7777
image
7878
.resizable()
79+
.aspectRatio(contentMode: .fill)
7980
.frame(width: 140, height: 140)
80-
.scaledToFill()
8181
.clipShape(.rect(cornerRadius: 16))
8282
.padding(.leading, 12)
8383
.padding(.vertical, 12)

TnT/Projects/DesignSystem/Sources/Components/Card/TWorkoutCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ private extension TWorkoutCard {
117117
case .success(let image):
118118
image
119119
.resizable()
120+
.aspectRatio(contentMode: .fill)
120121
.frame(width: 24, height: 24)
121-
.scaledToFill()
122122
.clipShape(Circle())
123123

124124
case .failure(let error):

TnT/Projects/DesignSystem/Sources/DesignSystem/Image+DesignSystem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public extension ImageResource {
4444
static let icnTriangleDown: ImageResource = DesignSystemAsset.icnTriangleDown.imageResource
4545
static let icnTriangleRight: ImageResource = DesignSystemAsset.icnTriangleRight.imageResource
4646
static let icnClock: ImageResource = DesignSystemAsset.icnClock.imageResource
47-
static let icnStar: ImageResource = DesignSystemAsset.icnStartEmpty.imageResource
47+
static let icnStar: ImageResource = DesignSystemAsset.icnStar.imageResource
4848
static let icnStarSmile: ImageResource = DesignSystemAsset.icnStarSmile.imageResource
4949
static let icnWriteBlackFilled: ImageResource = DesignSystemAsset.icnWriteBlackFilled.imageResource
5050
static let icnPlus: ImageResource = DesignSystemAsset.icnPlus.imageResource

TnT/Projects/Presentation/Sources/Home/Trainee/TraineeHomeView.swift

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,37 @@ import Domain
1313
import DesignSystem
1414

1515
/// 트레이니의 메인 홈 뷰입니다
16+
@ViewAction(for: TraineeHomeFeature.self)
1617
public struct TraineeHomeView: View {
1718

18-
// MARK: 임시 State
19-
@State var ispresented: Bool = false
20-
@State var selectedDate: Date = Date()
21-
@State var currentPage: Date = Date()
22-
@State var events: [Date: Int] = [:]
23-
@State var todaysSessionInfo: WorkoutListItemEntity? = .init(currentCount: 8, startDate: .now, endDate: .now, trainerProfileImageUrl: nil, trainerName: "김민수", hasRecord: true)
24-
@State var records: [RecordListItemEntity] = [
25-
.init(type: .meal(type: .lunch), date: .now, title: "자고싶다", hasFeedBack: true, imageUrl: nil),
26-
.init(type: .meal(type: .dinner), date: .now, title: "자고싶다", hasFeedBack: false, imageUrl: "https://images.genius.com/8e0b15e4847f8e59db7dfda22b4db4ec.1000x1000x1.png"),
27-
.init(type: .meal(type: .morning), date: .now, title: "자고싶다", hasFeedBack: true, imageUrl: nil)
28-
]
29-
@State var toggleMode: Bool = true
19+
@Bindable public var store: StoreOf<TraineeHomeFeature>
3020

31-
32-
public init() {}
21+
public init(store: StoreOf<TraineeHomeFeature>) {
22+
self.store = store
23+
}
3324

3425
public var body: some View {
3526
ScrollView {
3627
VStack(spacing: 0) {
3728
CalendarSection()
29+
.background(Color.common0)
3830

3931
RecordListSection()
32+
.frame(maxWidth: .infinity)
4033
.background(Color.neutral100)
41-
34+
4235
Spacer()
4336
}
4437
}
38+
.background(
39+
VStack {
40+
Color.common0
41+
Color.neutral100
42+
}
43+
)
4544
.overlay(alignment: .bottomTrailing) {
4645
Button(action: {
47-
// TODO: STORE
48-
ispresented = true
46+
send(.tapAddRecordButton)
4947
}, label: {
5048
Image(.icnPlus)
5149
.renderingMode(.template)
@@ -60,16 +58,10 @@ public struct TraineeHomeView: View {
6058
.padding(.trailing, 12)
6159
}
6260
.navigationBarBackButtonHidden()
63-
.sheet(isPresented: $ispresented) {
61+
.sheet(isPresented: $store.view_isBottomSheetPresented) {
6462
TraineeRecordStartView(itemContents: [
65-
("🏋🏻‍♀️", "개인 운동", {
66-
// TODO: Store 연결
67-
print("pop")
68-
}),
69-
("🥗", "식단", {
70-
// TODO: Store 연결
71-
print("pop")
72-
})
63+
("🏋🏻‍♀️", "개인 운동", { send(.tapAddWorkoutRecordButton) }),
64+
("🥗", "식단", { send(.tapAddMealRecordButton) })
7365
])
7466
.autoSizingBottomSheet()
7567
}
@@ -80,13 +72,11 @@ public struct TraineeHomeView: View {
8072
private func CalendarSection() -> some View {
8173
VStack(spacing: 16) {
8274
TCalendarHeader(
83-
currentPage: $currentPage,
75+
currentPage: $store.view_currentPage,
8476
formatter: { TDateFormatUtility.formatter(for: .yyyy년_MM월).string(from: $0) },
8577
rightView: {
8678
Button(action: {
87-
// TODO: Store 연결
88-
print("pop")
89-
toggleMode.toggle()
79+
send(.tapAlarmPageButton)
9080
}, label: {
9181
Image(.icnAlarm)
9282
.resizable()
@@ -99,23 +89,22 @@ public struct TraineeHomeView: View {
9989
// Calendar + 금일 수업 카드
10090
VStack(spacing: 12) {
10191
TCalendarView(
102-
selectedDate: $selectedDate,
103-
currentPage: $currentPage,
104-
events: events,
105-
isWeekMode: toggleMode
92+
selectedDate: $store.selectedDate,
93+
currentPage: $store.view_currentPage,
94+
events: store.events,
95+
isWeekMode: true
10696
)
10797
.padding(.horizontal, 20)
10898

109-
if let todaysSessionInfo {
99+
if let sessionInfo = store.sessionInfo {
110100
TWorkoutCard(
111-
chipUIInfo: RecordType.session(count: todaysSessionInfo.currentCount).chipInfo,
112-
timeText: "\(TDateFormatUtility.formatter(for: .a_HHmm).string(from: todaysSessionInfo.startDate)) ~ \(TDateFormatUtility.formatter(for: .a_HHmm).string(from: todaysSessionInfo.endDate))",
113-
title: "\(todaysSessionInfo.trainerName) 트레이너",
114-
imgURL: .init(string: todaysSessionInfo.trainerProfileImageUrl ?? ""),
115-
hasRecord: todaysSessionInfo.hasRecord,
101+
chipUIInfo: RecordType.session(count: sessionInfo.currentCount).chipInfo,
102+
timeText: store.view_sessionCardTimeString,
103+
title: "\(sessionInfo.trainerName) 트레이너",
104+
imgURL: .init(string: sessionInfo.trainerProfileImageUrl ?? ""),
105+
hasRecord: sessionInfo.hasRecord,
116106
footerTapAction: {
117-
// TODO: STORe
118-
print("얍ㅂ삐")
107+
send(.tapShowSessionRecordButton(id: sessionInfo.id))
119108
}
120109
)
121110
.padding(.horizontal, 20)
@@ -135,27 +124,36 @@ public struct TraineeHomeView: View {
135124
@ViewBuilder
136125
private func RecordListSection() -> some View {
137126
VStack(alignment: .leading, spacing: 0) {
138-
Text(TDateFormatUtility.formatter(for: .MM월_dd일_EEEE).string(from: selectedDate))
139-
.typographyStyle(.heading3, with: .neutral800)
140-
.padding(20)
127+
HStack {
128+
Text(store.view_recordTitleString)
129+
.typographyStyle(.heading3, with: .neutral800)
130+
.padding(20)
131+
Spacer()
132+
}
141133

142134
VStack(spacing: 12) {
143-
ForEach(records.indices, id: \.self) { index in
144-
let item = records[index]
145-
TRecordCard(
146-
chipUIInfo: item.type.chipInfo,
147-
timeText: TDateFormatUtility.formatter(for: .a_HHmm).string(from: item.date),
148-
title: "자고 싶어요 진짜로 ㄴㅇㅁㄹㅁㄴㅇ래ㅣㅑㅕㅗㅁㅈㄷ;ㅐㅓㅑㅗㅁㅈㄷ래ㅑ;ㅗㅓㅁㄷㄹㅈ;ㅐㅗㅕㅑㄷㄹㅁㅈ",
149-
imgURL: URL(string: item.imageUrl ?? ""),
150-
hasFeedback: item.hasFeedBack,
151-
footerTapAction: {
152-
// TODO: STORE
153-
print("pop\(index)")
154-
}
155-
)
135+
if !store.records.isEmpty {
136+
ForEach(store.records, id: \.id) { item in
137+
TRecordCard(
138+
chipUIInfo: item.type.chipInfo,
139+
timeText: TDateFormatUtility.formatter(for: .a_HHmm).string(from: item.date),
140+
title: item.title,
141+
imgURL: URL(string: item.imageUrl ?? ""),
142+
hasFeedback: item.hasFeedBack,
143+
footerTapAction: {
144+
send(.tapShowRecordFeedbackButton(id: item.id))
145+
}
146+
)
147+
}
148+
} else {
149+
RecordEmptyView()
150+
.padding(.top, 80)
151+
.padding(.bottom, 100)
156152
}
157153
}
158154
.padding(.horizontal, 16)
155+
156+
Spacer()
159157
}
160158
}
161159
}
@@ -175,7 +173,7 @@ private extension TraineeHomeView {
175173
struct RecordEmptyView: View {
176174
var body: some View {
177175
VStack(spacing: 4) {
178-
Text("추가 버튼을 눌러 식사와 운동을 기록해보세요")
176+
Text("아직 기록이 없어요")
179177
.typographyStyle(.body2Bold, with: .neutral600)
180178
.frame(maxWidth: .infinity)
181179

0 commit comments

Comments
 (0)