Skip to content

Commit d8496e5

Browse files
committed
[Feat] 일정추가 팝업 작성
1 parent e6117b6 commit d8496e5

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

TnT/Projects/Presentation/Sources/AddPTSession/TrainerAddPTSessionFeature.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,15 @@ public extension TrainerAddPTSessionFeature {
381381
}
382382
}
383383

384+
var primaryTitle: String {
385+
switch self {
386+
case .sessionAdded:
387+
return "확인"
388+
case .cancelSessionAdd:
389+
return "계속 수정"
390+
}
391+
}
392+
384393
var primaryAction: Action.View {
385394
return .tapPopUpPrimaryButton(popUp: self)
386395
}

TnT/Projects/Presentation/Sources/AddPTSession/TrainerAddPTSessionView.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ public struct TrainerAddPTSessionView: View {
9090
.autoSizingBottomSheet(presentationDragIndicator: .hidden)
9191
}
9292
}
93+
.tPopUp(isPresented: $store.view_isPopUpPresented) {
94+
PopUpView()
95+
}
9396
.onChange(of: store.view_bottomSheetItem) { oldValue, newValue in
9497
if oldValue != newValue {
9598
send(.setFocus(oldValue?.field, newValue?.field))
@@ -251,6 +254,29 @@ public struct TrainerAddPTSessionView: View {
251254
}
252255
.padding(.horizontal, 20)
253256
}
257+
258+
@ViewBuilder
259+
private func PopUpView() -> some View {
260+
if let popUp = store.view_popUp {
261+
let buttons: [TPopupAlertState.ButtonState] = [
262+
popUp.secondaryAction.map { action in
263+
.init(title: "취소", style: .secondary, action: .init(action: { send(action) }))
264+
},
265+
.init(title: popUp.primaryTitle, style: .primary, action: .init(action: { send(popUp.primaryAction) }))
266+
].compactMap { $0 }
267+
268+
TPopUpAlertView(
269+
alertState: .init(
270+
title: popUp.title,
271+
message: popUp.message,
272+
showAlertIcon: popUp.showAlertIcon,
273+
buttons: buttons
274+
)
275+
)
276+
} else {
277+
EmptyView()
278+
}
279+
}
254280
}
255281

256282
public extension TrainerAddPTSessionView {

0 commit comments

Comments
 (0)