Skip to content

Commit 5882116

Browse files
authored
Merge pull request #86 from YAPP-Github/TNT-213-TrainerTraineeList
[TNT-213] 트레이너 회원 목록 화면 연결
2 parents f1a1fa4 + 7874ba7 commit 5882116

File tree

15 files changed

+229
-98
lines changed

15 files changed

+229
-98
lines changed

TnT/Projects/Data/Sources/Network/Service/Trainer/TrainerRepositoryImpl.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ public struct TrainerRepositoryImpl: TrainerRepository {
5050
return try await networkService.request(TrainerTargetType.getMonthlyLessonList(year: year, month: month), decodingType: GetMonthlyLessonListResDTO.self)
5151
}
5252

53-
public func getMembersList() async throws -> GetMembersListDTO {
53+
public func getMembersList() async throws -> GetActiveTraineesListResDTO {
5454
return try await networkService.request(
5555
TrainerTargetType.getMemebersList,
56-
decodingType: GetMembersListDTO.self
56+
decodingType: GetActiveTraineesListResDTO.self
5757
)
5858
}
5959

TnT/Projects/DesignSystem/Sources/Navigation/TNavigation.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public struct TNavigation: View {
6666
.frame(width: 32, height: 32)
6767

6868
case .LTextRButtonTitle(let leftTitle, let pointText, _):
69-
HStack(spacing: 6){
69+
HStack(spacing: 6) {
7070
Text(leftTitle)
7171
.typographyStyle(.heading2, with: .neutral900)
7272
if let pointText = pointText {
@@ -88,7 +88,7 @@ public struct TNavigation: View {
8888
Text(centerTitle)
8989
.typographyStyle(.heading4, with: .neutral900)
9090
.frame(maxWidth: .infinity, alignment: .center)
91-
case .LButton, .LTextRButtonTitle(_, _, _):
91+
case .LButton, .LTextRButtonTitle:
9292
EmptyView()
9393
}
9494
}
@@ -120,9 +120,10 @@ public struct TNavigation: View {
120120
TButton(
121121
title: rightButton,
122122
config: .small,
123-
state: .disable(.gray(isEnabled: true))) {
123+
state: .disable(.primary(isEnabled: true))) {
124124
rightAction?()
125125
}
126+
.frame(width: 90)
126127
}
127128
}
128129
}

TnT/Projects/Domain/Sources/DTO/Trainer/TrainerResponseDTO.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,17 @@ public typealias PostLessonResDTO = EmptyResponse
4848

4949
/// PT 수업 완료 처리 응답 DTO
5050
public typealias PutCompleteLessonResDTO = EmptyResponse
51+
52+
public extension ActiveTraineeInfoResDTO {
53+
func dtoToEntity() -> ActiveTraineeInfoResEntity {
54+
return .init(
55+
id: self.id,
56+
name: self.name,
57+
profileImageUrl: self.profileImageUrl,
58+
finishedPtCount: self.finishedPtCount,
59+
totalPtCount: self.totalPtCount,
60+
memo: self.memo,
61+
ptGoals: self.ptGoals
62+
)
63+
}
64+
}

TnT/Projects/Domain/Sources/Entity/TraineeListItemEntity.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,19 @@ public struct TraineeListItemEntity: Equatable, Sendable {
2323
self.name = name
2424
}
2525
}
26+
27+
/// 관리 중인 회원 목록 응답 DTO
28+
public struct GetActiveTraineesListResEntity: Equatable {
29+
public let trainees: [ActiveTraineeInfoResEntity]
30+
}
31+
32+
/// 관리 중인 회원 정보 DTO
33+
public struct ActiveTraineeInfoResEntity: Sendable, Equatable {
34+
public let id: Int
35+
public let name: String
36+
public let profileImageUrl: String
37+
public let finishedPtCount: Int
38+
public let totalPtCount: Int
39+
public let memo: String
40+
public let ptGoals: [String]
41+
}

TnT/Projects/Domain/Sources/Repository/TrainerRepository.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public protocol TrainerRepository {
3030
func getMonthlyLessonList(year: Int, month: Int) async throws -> GetMonthlyLessonListResDTO
3131

3232
/// 회원 조희
33-
func getMembersList() async throws -> GetMembersListDTO
33+
func getMembersList() async throws -> GetActiveTraineesListResDTO
3434

3535
/// 연결 완료된 트레이니 정보 불러오기
3636
func getConnectedTraineeInfo(trainerId: Int, traineeId: Int) async throws -> GetConnectedTraineeInfoResponseDTO

TnT/Projects/Domain/Sources/UseCase/TrainerUseCase.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public struct DefaultTrainerUseCase: TrainerRepository {
3333
return try await trainerRepository.getDateSessionList(date: date)
3434
}
3535

36-
public func getMembersList() async throws -> GetMembersListDTO {
36+
public func getMembersList() async throws -> GetActiveTraineesListResDTO {
3737
return try await trainerRepository.getMembersList()
3838
}
3939

TnT/Projects/Presentation/Sources/Alarm/AlarmCheckView.swift

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,45 @@ public struct AlarmCheckView: View {
3131
leftAction: { send(.tapNavBackButton) }
3232
)
3333

34-
ScrollView {
34+
ScrollView(showsIndicators: false) {
3535
AlarmList()
3636
Spacer()
3737
}
3838
}
3939
.navigationBarBackButtonHidden(true)
40+
4041
}
4142

4243
// MARK: - Sections
4344
@ViewBuilder
4445
private func AlarmList() -> some View {
4546
VStack(spacing: 0) {
46-
ForEach(store.alarmList, id: \.alarmId) { item in
47-
AlarmListItem(
48-
alarmTypeText: item.alarmTypeText,
49-
alarmMainText: item.alarmMainText,
50-
alarmTimeText: item.alarmDate.timeAgoDisplay(),
51-
alarmSeenBefore: item.alarmSeenBefore
52-
)
47+
if store.alarmList.isEmpty {
48+
EmptyView()
49+
} else {
50+
ForEach(store.alarmList, id: \.alarmId) { item in
51+
AlarmListItem(
52+
alarmTypeText: item.alarmTypeText,
53+
alarmMainText: item.alarmMainText,
54+
alarmTimeText: item.alarmDate.timeAgoDisplay(),
55+
alarmSeenBefore: item.alarmSeenBefore
56+
)
57+
}
5358
}
5459
}
5560
}
61+
62+
@ViewBuilder
63+
private func EmptyView() -> some View {
64+
VStack {
65+
Spacer()
66+
Text("최근 받은 알림이 없어요")
67+
.typographyStyle(.label1Medium, with: Color.neutral400)
68+
.frame(maxWidth: .infinity, alignment: .center)
69+
Spacer()
70+
}
71+
.frame(minHeight: UIScreen.main.bounds.height - 104)
72+
}
5673
}
5774

5875
private extension AlarmCheckView {

TnT/Projects/Presentation/Sources/Coordinator/TrainerMainFlow/TrainerMainFlowFeature.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public struct TrainerMainFlowFeature {
5656

5757
/// 트레이너 회원목록
5858
case .trainerTraineeList:
59+
state.path.append(.trainerManagment(.init()))
5960
return .none
6061

6162
/// 트레이너 마이페이지
@@ -118,6 +119,8 @@ extension TrainerMainFlowFeature {
118119
case connectionComplete(ConnectionCompleteFeature)
119120
/// 연결된 트레이니 프로필
120121
case connectedTraineeProfile(ConnectedTraineeProfileFeature)
122+
/// 트레이너 회원 관리 페이지
123+
case trainerManagment(TrainerManagementFeature)
121124

122125
// MARK: MyPage
123126
/// 초대코드 발급

TnT/Projects/Presentation/Sources/Coordinator/TrainerMainFlow/TrainerMainFlowView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public struct TrainerMainFlowView: View {
2828
TrainerMainTabView(store: store)
2929
case .addPTSession(let store):
3030
TrainerAddPTSessionView(store: store)
31-
31+
3232
// MARK: Home
3333
case .alarmCheck(let store):
3434
AlarmCheckView(store: store)
@@ -40,6 +40,8 @@ public struct TrainerMainFlowView: View {
4040
// MARK: MyPage
4141
case .trainerMakeInvitationCodePage(let store):
4242
MakeInvitationCodeView(store: store)
43+
case .trainerManagment(let store):
44+
TrainerManagementView(store: store)
4345
}
4446
}
4547
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// GestureNavigation.swift
3+
// Presentation
4+
//
5+
// Created by 박서연 on 2/13/25.
6+
// Copyright © 2025 yapp25thTeamTnT. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import UIKit
11+
12+
extension UINavigationController: ObservableObject, UIGestureRecognizerDelegate {
13+
open override func viewDidLoad() {
14+
super.viewDidLoad()
15+
interactivePopGestureRecognizer?.delegate = self
16+
}
17+
18+
public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
19+
return viewControllers.count > 2
20+
}
21+
}

0 commit comments

Comments
 (0)