Skip to content
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
2 changes: 1 addition & 1 deletion DevLog/Domain/Entity/PushNotificationQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct PushNotificationQuery: Equatable {
case oldest
}

enum TimeFilter: Equatable {
enum TimeFilter: Equatable, Hashable {
case none
case hours(Int)
case days(Int)
Expand Down
75 changes: 24 additions & 51 deletions DevLog/UI/Home/TodoListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,33 +311,24 @@ struct TodoListView: View {

private var sortMenu: some View {
Menu {
Section {
Picker(selection: Binding(
get: { viewModel.state.query.sortTarget },
set: { viewModel.send(.setSortTarget($0)) }
)) {
ForEach([TodoQuery.SortTarget.createdAt, .updatedAt], id: \.self) { option in
Button {
viewModel.send(.setSortTarget(option))
} label: {
selectionLabel(
title: option.title,
isSelected: viewModel.state.query.sortTarget == option
)
}
Text(option.title).tag(option)
}
} header: {
} label: {
Text("정렬 기준")
}

Section {
Picker(selection: Binding(
get: { viewModel.state.query.sortOrder },
set: { viewModel.send(.setSortOrder($0)) }
)) {
ForEach([TodoQuery.SortOrder.latest, .oldest], id: \.self) { option in
Button {
viewModel.send(.setSortOrder(option))
} label: {
selectionLabel(
title: option.title,
isSelected: viewModel.state.query.sortOrder == option
)
}
Text(option.title).tag(option)
}
} header: {
} label: {
Text("정렬 순서")
}
} label: {
Expand All @@ -353,27 +344,21 @@ struct TodoListView: View {

private var filterMenu: some View {
Menu {
Button {
viewModel.send(.togglePinnedOnly)
} label: {
selectionLabel(
title: "중요 표시",
isSelected: viewModel.state.query.isPinned == true
)
Toggle(isOn: Binding(
get: { viewModel.state.query.isPinned == true },
set: { _ in viewModel.send(.togglePinnedOnly) }
)) {
Text("중요 표시")
}

Section {
Picker(selection: Binding(
get: { viewModel.state.query.completionFilter },
set: { viewModel.send(.setCompletionFilter($0)) }
)) {
ForEach([TodoQuery.CompletionFilter.all, .incomplete, .completed], id: \.self) { option in
Button {
viewModel.send(.setCompletionFilter(option))
} label: {
selectionLabel(
title: option.title,
isSelected: viewModel.state.query.completionFilter == option
)
}
Text(option.title).tag(option)
}
} header: {
} label: {
Text("완료 상태")
}
Comment on lines +354 to 363
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

일관성을 위해 sortMenuPicker들과 마찬가지로 이 Picker에도 .tint(.blue)를 적용하는 것이 좋겠습니다. 이전 구현에서도 선택된 항목에 파란색 체크마크가 표시되었습니다.

Suggested change
Picker(selection: Binding(
get: { viewModel.state.query.completionFilter },
set: { viewModel.send(.setCompletionFilter($0)) }
)) {
ForEach([TodoQuery.CompletionFilter.all, .incomplete, .completed], id: \.self) { option in
Button {
viewModel.send(.setCompletionFilter(option))
} label: {
selectionLabel(
title: option.title,
isSelected: viewModel.state.query.completionFilter == option
)
}
Text(option.title).tag(option)
}
} header: {
} label: {
Text("완료 상태")
}
Picker(selection: Binding(
get: { viewModel.state.query.completionFilter },
set: { viewModel.send(.setCompletionFilter($0)) }
)) {
ForEach([TodoQuery.CompletionFilter.all, .incomplete, .completed], id: \.self) { option in
Text(option.title).tag(option)
}
} label: {
Text("완료 상태")
}
.tint(.blue)

} label: {
Expand Down Expand Up @@ -402,19 +387,7 @@ struct TodoListView: View {
.background(Circle().fill(backgroundColor))
}

private func selectionLabel(title: String, isSelected: Bool) -> some View {
HStack {
Text(title)
Spacer()
if isSelected {
Image(systemName: "checkmark")
.tint(.blue)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
}

private enum Path: Hashable {
private enum Path: Hashable {
case detail(String)
}
}
21 changes: 8 additions & 13 deletions DevLog/UI/PushNotification/PushNotificationListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,20 +168,15 @@ struct PushNotificationListView: View {
}

Menu {
ForEach(PushNotificationQuery.TimeFilter.availableOptions, id: \.id) { option in
Button {
viewModel.send(.setTimeFilter(option))
} label: {
HStack {
Text(option.title)
Spacer()
if viewModel.state.query.timeFilter == option {
Image(systemName: "checkmark")
.tint(.blue)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
Picker(selection: Binding(
get: { viewModel.state.query.timeFilter },
set: { viewModel.send(.setTimeFilter($0)) }
)) {
ForEach(PushNotificationQuery.TimeFilter.availableOptions, id: \.self) { option in
Text(option.title).tag(option)
}
} label: {
Text("기간")
}
Comment on lines +171 to 180
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

일관성을 위해 이 Picker에도 .tint(.blue)를 적용하는 것이 좋겠습니다. 이전 구현에서도 선택된 항목에 파란색 체크마크가 표시되었고, TodoListView의 다른 Picker들에도 적용되어 있습니다.

Suggested change
Picker(selection: Binding(
get: { viewModel.state.query.timeFilter },
set: { viewModel.send(.setTimeFilter($0)) }
)) {
ForEach(PushNotificationQuery.TimeFilter.availableOptions, id: \.self) { option in
Text(option.title).tag(option)
}
} label: {
Text("기간")
}
Picker(selection: Binding(
get: { viewModel.state.query.timeFilter },
set: { viewModel.send(.setTimeFilter($0)) }
)) {
ForEach(PushNotificationQuery.TimeFilter.availableOptions, id: \.self) { option in
Text(option.title).tag(option)
}
} label: {
Text("기간")
}
.tint(.blue)

} label: {
let condition = viewModel.state.query.timeFilter == .none
Expand Down