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-254] 실시간 QA 반영 #97

Merged
merged 4 commits into from
Feb 15, 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 @@ -93,6 +93,8 @@ public struct TraineeAddDietRecordFeature {
case api(APIAction)
/// 선택된 이미지 데이터 저장
case imagePicked(Data?)
/// 팝업 상태 설정
case setPopUp(PopUp?)
/// 네비게이션 여부 설정
case setNavigating

Expand Down Expand Up @@ -239,13 +241,16 @@ public struct TraineeAddDietRecordFeature {
),
imgData: state.dietImageData
)
await send(.setNavigating)
await send(.setPopUp(.dietAdded))
}
}

case .imagePicked(let imgData):
state.dietImageData = imgData
return self.validateAllFields(&state)

case .setPopUp(let popUp):
return setPopUpStatus(&state, status: popUp)

case .setNavigating:
return .none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public struct TrainerAddPTSessionFeature {
case api(APIAction)
/// 현재 관리 회원 목록 설정
case setTraineeList([TraineeListItemEntity])
/// 팝업 상태 설정
case setPopUp(PopUp?)
/// 네비게이션 여부 설정
case setNavigating

Expand Down Expand Up @@ -273,7 +275,7 @@ public struct TrainerAddPTSessionFeature {
traineeId: traineeId
)
)
await send(.setNavigating)
await send(.setPopUp(.sessionAdded))
} catch {
NotificationCenter.default.post(toast: .init(presentType: .text(""), message: "이미 예약된 시간대입니다"))
}
Expand All @@ -284,6 +286,9 @@ public struct TrainerAddPTSessionFeature {
state.traineeList = trainees
return .none

case .setPopUp(let popUp):
return setPopUpStatus(&state, status: popUp)

case .setNavigating:
return .none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public struct TrainerHomeFeature {
// MARK: Data related state
/// 3일 동안 보지 않기 시작 날짜
@Shared(.appStorage(AppStorage.hideHomePopupUntil)) var hidePopupUntil: Date?
/// 트레이너 연결 여부
@Shared(.appStorage(AppStorage.isConnected)) var isConnected: Bool = false
/// 선택된 날짜
var selectedDate: Date
/// 캘린더 이벤트
Expand All @@ -34,8 +36,6 @@ public struct TrainerHomeFeature {
var tappedsessionInfo: GetDateSessionListEntity?
/// 3일 동안 보지 않기 선택되었는지 여부
var isHideUntilSelected: Bool
/// 트레이니 연결 여부
var isConnected: Bool
/// 팝업 관련 Flag
var popUpFlag: Bool

Expand All @@ -56,7 +56,6 @@ public struct TrainerHomeFeature {
sessionInfo: WorkoutListItemEntity? = nil,
records: [RecordListItemEntity] = [],
isHideUntilSelected: Bool = false,
isConnected: Bool = false,
view_currentPage: Date = .now,
tappedsessionInfo: GetDateSessionListEntity? = nil,
view_isPopUpPresented: Bool = false,
Expand All @@ -68,7 +67,6 @@ public struct TrainerHomeFeature {
self.sessionInfo = sessionInfo
self.records = records
self.isHideUntilSelected = isHideUntilSelected
self.isConnected = isConnected
self.view_currentPage = view_currentPage
self.tappedsessionInfo = tappedsessionInfo
self.view_isPopUpPresented = view_isPopUpPresented
Expand Down Expand Up @@ -193,12 +191,17 @@ public struct TrainerHomeFeature {
let year: Int = Calendar.current.component(.year, from: state.selectedDate)
let month: Int = Calendar.current.component(.month, from: state.selectedDate)

if let hideUntil = state.hidePopupUntil, hideUntil > Date() {
state.view_isPopUpPresented = false
} else {
state.popUpFlag = true
state.view_isPopUpPresented = true
}
let hideUntil = state.hidePopupUntil ?? Date()
let hidePopUp = state.isConnected || hideUntil > Date()
state.view_isPopUpPresented = !hidePopUp
state.popUpFlag = !hidePopUp

// if let hideUntil = state.hidePopupUntil, hideUntil > Date() {
// state.view_isPopUpPresented = false
// } else {
// state.popUpFlag = true
// state.view_isPopUpPresented = true
// }

return .concatenate(
.send(.view(.fetchMonthlyLessons(year: month == 1 ? year-1 : year, month: month == 1 ? 12 : month-1))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ extension TrainerHomeView {
/// 수업 완료 버튼 탭
onTapComplete()
}
.disabled(session.isCompleted)

VStack(spacing: 12) {
HStack(spacing: 4) {
Expand All @@ -256,7 +257,8 @@ extension TrainerHomeView {
.frame(maxWidth: .infinity, alignment: .leading)
}

if session.isCompleted {
if false {
// if session.isCompleted {
Button {
onTap?()
} label: {
Expand Down