Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TNT-213] 트레이너 회원 목록 화면 연결 #86

Merged
merged 4 commits into from
Feb 13, 2025
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 @@ -50,10 +50,10 @@ public struct TrainerRepositoryImpl: TrainerRepository {
return try await networkService.request(TrainerTargetType.getMonthlyLessonList(year: year, month: month), decodingType: GetMonthlyLessonListResDTO.self)
}

public func getMembersList() async throws -> GetMembersListDTO {
public func getMembersList() async throws -> GetActiveTraineesListResDTO {
return try await networkService.request(
TrainerTargetType.getMemebersList,
decodingType: GetMembersListDTO.self
decodingType: GetActiveTraineesListResDTO.self
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public struct TNavigation: View {
.frame(width: 32, height: 32)

case .LTextRButtonTitle(let leftTitle, let pointText, _):
HStack(spacing: 6){
HStack(spacing: 6) {
Text(leftTitle)
.typographyStyle(.heading2, with: .neutral900)
if let pointText = pointText {
Expand All @@ -88,7 +88,7 @@ public struct TNavigation: View {
Text(centerTitle)
.typographyStyle(.heading4, with: .neutral900)
.frame(maxWidth: .infinity, alignment: .center)
case .LButton, .LTextRButtonTitle(_, _, _):
case .LButton, .LTextRButtonTitle:
EmptyView()
}
}
Expand Down Expand Up @@ -120,9 +120,10 @@ public struct TNavigation: View {
TButton(
title: rightButton,
config: .small,
state: .disable(.gray(isEnabled: true))) {
state: .disable(.primary(isEnabled: true))) {
rightAction?()
}
.frame(width: 90)
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions TnT/Projects/Domain/Sources/DTO/Trainer/TrainerResponseDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,17 @@ public typealias PostLessonResDTO = EmptyResponse

/// PT 수업 완료 처리 응답 DTO
public typealias PutCompleteLessonResDTO = EmptyResponse

public extension ActiveTraineeInfoResDTO {
func dtoToEntity() -> ActiveTraineeInfoResEntity {
return .init(
id: self.id,
name: self.name,
profileImageUrl: self.profileImageUrl,
finishedPtCount: self.finishedPtCount,
totalPtCount: self.totalPtCount,
memo: self.memo,
ptGoals: self.ptGoals
)
}
}
16 changes: 16 additions & 0 deletions TnT/Projects/Domain/Sources/Entity/TraineeListItemEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ public struct TraineeListItemEntity: Equatable, Sendable {
self.name = name
}
}

/// 관리 중인 회원 목록 응답 DTO
public struct GetActiveTraineesListResEntity: Equatable {
public let trainees: [ActiveTraineeInfoResEntity]
}

/// 관리 중인 회원 정보 DTO
public struct ActiveTraineeInfoResEntity: Sendable, Equatable {
public let id: Int
public let name: String
public let profileImageUrl: String
public let finishedPtCount: Int
public let totalPtCount: Int
public let memo: String
public let ptGoals: [String]
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public protocol TrainerRepository {
func getMonthlyLessonList(year: Int, month: Int) async throws -> GetMonthlyLessonListResDTO

/// 회원 조희
func getMembersList() async throws -> GetMembersListDTO
func getMembersList() async throws -> GetActiveTraineesListResDTO

/// 연결 완료된 트레이니 정보 불러오기
func getConnectedTraineeInfo(trainerId: Int, traineeId: Int) async throws -> GetConnectedTraineeInfoResponseDTO
Expand Down
2 changes: 1 addition & 1 deletion TnT/Projects/Domain/Sources/UseCase/TrainerUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public struct DefaultTrainerUseCase: TrainerRepository {
return try await trainerRepository.getDateSessionList(date: date)
}

public func getMembersList() async throws -> GetMembersListDTO {
public func getMembersList() async throws -> GetActiveTraineesListResDTO {
return try await trainerRepository.getMembersList()
}

Expand Down
33 changes: 25 additions & 8 deletions TnT/Projects/Presentation/Sources/Alarm/AlarmCheckView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,45 @@ public struct AlarmCheckView: View {
leftAction: { send(.tapNavBackButton) }
)

ScrollView {
ScrollView(showsIndicators: false) {
AlarmList()
Spacer()
}
}
.navigationBarBackButtonHidden(true)

}

// MARK: - Sections
@ViewBuilder
private func AlarmList() -> some View {
VStack(spacing: 0) {
ForEach(store.alarmList, id: \.alarmId) { item in
AlarmListItem(
alarmTypeText: item.alarmTypeText,
alarmMainText: item.alarmMainText,
alarmTimeText: item.alarmDate.timeAgoDisplay(),
alarmSeenBefore: item.alarmSeenBefore
)
if store.alarmList.isEmpty {
EmptyView()
} else {
ForEach(store.alarmList, id: \.alarmId) { item in
AlarmListItem(
alarmTypeText: item.alarmTypeText,
alarmMainText: item.alarmMainText,
alarmTimeText: item.alarmDate.timeAgoDisplay(),
alarmSeenBefore: item.alarmSeenBefore
)
}
}
}
}

@ViewBuilder
private func EmptyView() -> some View {
VStack {
Spacer()
Text("최근 받은 알림이 없어요")
.typographyStyle(.label1Medium, with: Color.neutral400)
.frame(maxWidth: .infinity, alignment: .center)
Spacer()
}
.frame(minHeight: UIScreen.main.bounds.height - 104)
}
}

private extension AlarmCheckView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public struct TrainerMainFlowFeature {

/// 트레이너 회원목록
case .trainerTraineeList:
state.path.append(.trainerManagment(.init()))
return .none

/// 트레이너 마이페이지
Expand Down Expand Up @@ -118,6 +119,8 @@ extension TrainerMainFlowFeature {
case connectionComplete(ConnectionCompleteFeature)
/// 연결된 트레이니 프로필
case connectedTraineeProfile(ConnectedTraineeProfileFeature)
/// 트레이너 회원 관리 페이지
case trainerManagment(TrainerManagementFeature)

// MARK: MyPage
/// 초대코드 발급
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct TrainerMainFlowView: View {
TrainerMainTabView(store: store)
case .addPTSession(let store):
TrainerAddPTSessionView(store: store)

// MARK: Home
case .alarmCheck(let store):
AlarmCheckView(store: store)
Expand All @@ -40,6 +40,8 @@ public struct TrainerMainFlowView: View {
// MARK: MyPage
case .trainerMakeInvitationCodePage(let store):
MakeInvitationCodeView(store: store)
case .trainerManagment(let store):
TrainerManagementView(store: store)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// GestureNavigation.swift
// Presentation
//
// Created by 박서연 on 2/13/25.
// Copyright © 2025 yapp25thTeamTnT. All rights reserved.
//

import Foundation
import UIKit

extension UINavigationController: ObservableObject, UIGestureRecognizerDelegate {
open override func viewDidLoad() {
super.viewDidLoad()
interactivePopGestureRecognizer?.delegate = self
}

public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
return viewControllers.count > 2
}
Comment on lines +12 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥹👍🥹👍🥹👍🥹👍🥹

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct TrainerMainTabFeature {
public enum State: Equatable {
case home(TrainerHomeFeature.State)
// case feedback
case traineeList
case traineeList(TrainerManagementFeature.State)
case myPage(TrainerMypageFeature.State)

/// state case와 tabinfo 연결
Expand Down Expand Up @@ -69,7 +69,7 @@ public struct TrainerMainTabFeature {
// /// 피드백 화면에서 발생하는 액션 처리
// case feedbackAction
/// 회원 목록 화면에서 발생하는 액션 처리
case traineeListAction
case traineeListAction(TrainerManagementFeature.Action)
/// 마이페이지 화면에서 발생하는 액션 처리
case myPageAction(TrainerMypageFeature.Action)
}
Expand All @@ -92,8 +92,7 @@ public struct TrainerMainTabFeature {
// state = .feedback
// return .none
case .traineeList:
// TODO: traineeList Feature 작성 후 추가해주세요
state = .traineeList
state = .traineeList(.init())
return .none
case .mypage:
state = .myPage(.init())
Expand Down Expand Up @@ -134,7 +133,7 @@ extension TrainerMainTabFeature {
// /// 트레이너 피드백
// case trainerFeedback
/// 트레이너 회원 목록
case trainerTraineeList
case trainerTraineeList(TrainerManagementFeature.RoutingScreen)
/// 트레이너 마이페이지
case trainerMyPage(TrainerMypageFeature.RoutingScreen)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public struct TrainerMainTabView: View {
// }
case .traineeList:
if let store = store.scope(state: \.traineeList, action: \.subFeature.traineeListAction) {
Color.clear
.frame(maxWidth: .infinity, maxHeight: .infinity)
TrainerManagementView(store: store)
}
case .myPage:
if let store = store.scope(state: \.myPage, action: \.subFeature.myPageAction) {
Expand Down

This file was deleted.

Loading