Skip to content

Commit

Permalink
[FEAT] #48 - 첫목표설정 결과화면 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
Seokki-Kwon committed Mar 3, 2025
1 parent 78da4a3 commit 262316a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ struct GoalCompleteView: View {

Image("appLogoImage")
.padding(.top, 112)
Text("올해까지 오픽 AL받기")
Text(store.goalInfo.goalTitle)
.headingStyle2()
.foregroundStyle(Color.gray900)
.padding(.top, 50)

Text("오픽노답 30페이지 스크립트 작성")
Text(store.goalInfo.planTitle)
.bodyLargeSemibold()
.foregroundStyle(Color.gray900)

Text("오늘 22:28 ~ 23:42")
Text(store.resultTimeStr)
.bodySmallRegular()
.foregroundStyle(Color.gray600)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct GoalView: View {
.foregroundStyle(Color.gray600)
Spacer()
HStack {
Text(store.startDateStr)
Text(store.startDateResultStr)
.bodyMediumMedium()
.foregroundStyle(Color.purple800)
Image(.iconUp)
Expand All @@ -76,7 +76,7 @@ struct GoalView: View {
.foregroundStyle(Color.gray600)
Spacer()
HStack {
Text(store.endDateStr)
Text(store.endDateResultStr)
.bodyMediumMedium()
.foregroundStyle(Color.purple800)
Image(.iconUp)
Expand Down
34 changes: 30 additions & 4 deletions dnd-12th-2-iOS/dnd-12th-2-iOS/Presentation/Goal/MakeGoal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ struct MakeGoal {
goalType != .firstGoal
}

// 텍스트필드 유효성 검사
var textFieldValidate: Bool {
goalType != .makePlan ? !goalInfo.planTitle.isEmpty : !goalInfo.goalTitle.isEmpty && !goalInfo.planTitle.isEmpty
}

// 시간설정 유효성 검사
var timePickerValidate: Bool {
goalInfo.startDate <= goalInfo.endDate
}
Expand All @@ -43,20 +45,44 @@ struct MakeGoal {
!textFieldValidate || !timePickerValidate
}

// 시작날짜 구분
var startDateTodayStr: String {
calendar.isDate(goalInfo.startDate, inSameDayAs: .now) ? "오늘" : "내일"
}

// 종료날짜 구분
var endDateTodayStr: String {
calendar.isDate(goalInfo.endDate, inSameDayAs: .now) ? "오늘" : "내일"
}

// 시작날짜 문자 HH:mm
var startDateStr: String {
startDateTodayStr + " " + goalInfo.startDate.formatted("HH:mm")
goalInfo.startDate.formatted("HH:mm")
}

// 종료날짜 문자 HH:mm
var endDateStr: String {
endDateTodayStr + " " + goalInfo.endDate.formatted("HH:mm")
goalInfo.endDate.formatted("HH:mm")
}

// 오전/오후 + 시작날짜
var startDateResultStr: String {
startDateTodayStr + " " + startDateStr
}

// 오전/오후 + 종료날짜
var endDateResultStr: String {
endDateTodayStr + " " + endDateStr
}

// 종료날짜 결과 날짜가 다른경우 + 내일
var endTimeResultStr: String {
calendar.isDate(goalInfo.endDate, inSameDayAs: goalInfo.startDate) ? endDateStr : "내일" + " " + endDateStr
}

// 최종적으료 표시되는 날짜
var resultTimeStr: String {
startDateResultStr + " ~ " + endTimeResultStr
}

// startPicker 숨김여부
Expand Down Expand Up @@ -90,7 +116,7 @@ struct MakeGoal {
case goToMainView

// 첫목표 설정 완료시
case goToCompleteView
case goToCompleteView(MakeGoal.State)

// 뒤로가기
case backButtonTapped
Expand All @@ -117,7 +143,7 @@ struct MakeGoal {
case .completeButtonTapped:
switch state.goalType {
case .firstGoal:
return .send(.goToCompleteView)
return .send(.goToCompleteView(state))
case .makeGoal:
return .send(.backButtonTapped)
case .makePlan:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ struct LoginNavigation {
return .none
case .element(id: _, action: .complete(.goToGoalView)):
state.path.append(.goal(.init(goalType: .firstGoal)))
return .none
case .element(id: _, action: .goal(.goToCompleteView)):
state.path.append(.goalComplete(.init()))
return .none
return .none
case let .element(id: id, action: .goalComplete(.backButtonTapped)):
state.path.pop(from: id)
return .none
case let .element(id: id, action: .complete(.backButtonTapped)):
state.path.pop(from: id)
return .none
case let .element(id: _, action: .goal(.goToCompleteView(makeGoal))):
state.path.append(.goalComplete(makeGoal))
return .none
default:
return .none
}
Expand Down

0 comments on commit 262316a

Please sign in to comment.