Skip to content

Commit 5aeddc4

Browse files
committed
refactor: 리스트에 보이는 타이틀과 메시지를 한 곳에서 수정하도록 개선
1 parent fffa8a0 commit 5aeddc4

1 file changed

Lines changed: 31 additions & 34 deletions

File tree

DevLog/UI/Today/TodayView.swift

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ struct TodayView: View {
127127
private var emptySection: some View {
128128
Section {
129129
VStack(spacing: 8) {
130-
Text(emptyStateTitle)
130+
Text(emptyStateContent.title)
131131
.foregroundStyle(.primary)
132-
Text(emptyStateMessage)
132+
Text(emptyStateContent.message)
133133
.font(.caption)
134134
.foregroundStyle(.secondary)
135135
.multilineTextAlignment(.center)
@@ -171,47 +171,44 @@ struct TodayView: View {
171171
}
172172
}
173173

174-
private enum Path: Hashable {
175-
case detail(String)
176-
}
177-
178-
private var emptyStateTitle: String {
179-
if viewModel.state.selectedSummaryScope == .all, viewModel.state.todos.isEmpty {
180-
return "남아 있는 Todo가 없습니다."
181-
}
182-
if viewModel.state.selectedSummaryScope == .all, viewModel.sections.isEmpty {
183-
return "선택한 보기 옵션에 맞는 Todo가 없습니다."
184-
}
185-
174+
private var emptyStateContent: EmptyStateContent {
186175
switch viewModel.state.selectedSummaryScope {
187176
case .all:
188-
return "남아 있는 Todo가 없습니다."
177+
if viewModel.state.todos.isEmpty {
178+
return EmptyStateContent(
179+
title: "남아 있는 Todo가 없습니다.",
180+
message: "완료되지 않은 일이 생기면 이곳에서 우선순위대로 볼 수 있습니다."
181+
)
182+
}
183+
return EmptyStateContent(
184+
title: "선택한 보기 옵션에 맞는 Todo가 없습니다.",
185+
message: "툴바에서 보기 범위를 조정하거나 전체 보기로 돌아가세요."
186+
)
189187
case .focused:
190-
return "집중할 일이 없습니다."
188+
return EmptyStateContent(
189+
title: "집중할 일이 없습니다.",
190+
message: "중요 표시한 Todo가 생기면 이곳에서 바로 볼 수 있습니다."
191+
)
191192
case .overdue:
192-
return "지난 마감 Todo가 없습니다."
193+
return EmptyStateContent(
194+
title: "지난 마감 Todo가 없습니다.",
195+
message: "지금은 기한이 지난 Todo가 없습니다."
196+
)
193197
case .dueSoon:
194-
return "7일 내 일정이 없습니다."
198+
return EmptyStateContent(
199+
title: "7일 내 일정이 없습니다.",
200+
message: "곧 마감되는 Todo가 생기면 이곳에서 먼저 볼 수 있습니다."
201+
)
195202
}
196203
}
197204

198-
private var emptyStateMessage: String {
199-
if viewModel.state.selectedSummaryScope == .all,
200-
!viewModel.state.todos.isEmpty,
201-
viewModel.sections.isEmpty {
202-
return "툴바에서 보기 범위를 조정하거나 전체 보기로 돌아가세요."
203-
}
205+
private struct EmptyStateContent {
206+
let title: String
207+
let message: String
208+
}
204209

205-
switch viewModel.state.selectedSummaryScope {
206-
case .all:
207-
return "완료되지 않은 일이 생기면 이곳에서 우선순위대로 볼 수 있습니다."
208-
case .focused:
209-
return "중요 표시한 Todo가 생기면 이곳에서 바로 볼 수 있습니다."
210-
case .overdue:
211-
return "지금은 기한이 지난 Todo가 없습니다."
212-
case .dueSoon:
213-
return "곧 마감되는 Todo가 생기면 이곳에서 먼저 볼 수 있습니다."
214-
}
210+
private enum Path: Hashable {
211+
case detail(String)
215212
}
216213
}
217214

0 commit comments

Comments
 (0)