mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 18:21:00 +00:00
Improve filter edit UX
This commit is contained in:
parent
21fd0b0541
commit
e7752feba0
1 changed files with 44 additions and 5 deletions
|
@ -67,6 +67,7 @@ struct EditFilterView: View {
|
||||||
.navigationTitle(filter?.title ?? NSLocalizedString("filter.new", comment: ""))
|
.navigationTitle(filter?.title ?? NSLocalizedString("filter.new", comment: ""))
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
|
.scrollDismissesKeyboard(.interactively)
|
||||||
.background(theme.secondaryBackgroundColor)
|
.background(theme.secondaryBackgroundColor)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
if filter == nil {
|
if filter == nil {
|
||||||
|
@ -103,6 +104,7 @@ struct EditFilterView: View {
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
private var titleSection: some View {
|
private var titleSection: some View {
|
||||||
Section("filter.edit.title") {
|
Section("filter.edit.title") {
|
||||||
TextField("filter.edit.title", text: $title)
|
TextField("filter.edit.title", text: $title)
|
||||||
|
@ -114,6 +116,27 @@ struct EditFilterView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
|
||||||
|
if filter == nil, !title.isEmpty {
|
||||||
|
Section {
|
||||||
|
Button {
|
||||||
|
Task {
|
||||||
|
await saveFilter()
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
if isSavingFilter {
|
||||||
|
ProgressView()
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
} else {
|
||||||
|
Text("action.save")
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.buttonStyle(.borderedProminent)
|
||||||
|
.transition(.opacity)
|
||||||
|
}
|
||||||
|
.listRowBackground(theme.secondaryBackgroundColor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var keywordsSection: some View {
|
private var keywordsSection: some View {
|
||||||
|
@ -140,6 +163,7 @@ struct EditFilterView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HStack {
|
||||||
TextField("filter.edit.keywords.add", text: $newKeyword, axis: .horizontal)
|
TextField("filter.edit.keywords.add", text: $newKeyword, axis: .horizontal)
|
||||||
.onSubmit {
|
.onSubmit {
|
||||||
Task {
|
Task {
|
||||||
|
@ -147,6 +171,21 @@ struct EditFilterView: View {
|
||||||
newKeyword = ""
|
newKeyword = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Spacer()
|
||||||
|
if !newKeyword.isEmpty {
|
||||||
|
Button {
|
||||||
|
Task {
|
||||||
|
Task {
|
||||||
|
await addKeyword(name: newKeyword)
|
||||||
|
newKeyword = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "checkmark.circle.fill")
|
||||||
|
.tint(.green)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue