Add an empty view when a tagged user isnt found
Changelog-Added: Show a custom view when tagged user isn't found
This commit is contained in:
committed by
William Casarin
parent
8fe8611527
commit
1701dbdfb9
37
damus/Views/Empty Views/EmptyUserSearchView.swift
Normal file
37
damus/Views/Empty Views/EmptyUserSearchView.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// EmptyUserSearchView.swift
|
||||
// damus
|
||||
//
|
||||
// Created by eric on 4/3/23.
|
||||
//
|
||||
|
||||
//
|
||||
// EmptyUserSearchView.swift
|
||||
// damus
|
||||
//
|
||||
// Created by eric on 4/3/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct EmptyUserSearchView: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
Image(systemName: "person.fill.questionmark")
|
||||
.font(.system(size: 35))
|
||||
.padding()
|
||||
Text("Could not find the user you're looking for", comment: "Indicates that there are no users found.")
|
||||
.multilineTextAlignment(.center)
|
||||
.font(.callout.weight(.medium))
|
||||
}
|
||||
.foregroundColor(.gray)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
struct EmptyUserSearchView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
EmptyUserSearchView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,11 +74,16 @@ struct UserSearch: View {
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
LazyVStack {
|
||||
ForEach(users) { user in
|
||||
UserView(damus_state: damus_state, pubkey: user.pubkey)
|
||||
.onTapGesture {
|
||||
on_user_tapped(user: user)
|
||||
}
|
||||
Divider()
|
||||
if users.count == 0 {
|
||||
EmptyUserSearchView()
|
||||
} else {
|
||||
ForEach(users) { user in
|
||||
UserView(damus_state: damus_state, pubkey: user.pubkey)
|
||||
.onTapGesture {
|
||||
on_user_tapped(user: user)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user