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
@@ -233,6 +233,7 @@
|
||||
4CFF8F6D29CD022E008DB934 /* WideEventView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6C29CD022E008DB934 /* WideEventView.swift */; };
|
||||
4FE60CDD295E1C5E00105A1F /* Wallet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FE60CDC295E1C5E00105A1F /* Wallet.swift */; };
|
||||
50A50A8D29A09E1C00C01BE7 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */; };
|
||||
5C42E78C29DB76D90086AAC1 /* EmptyUserSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */; };
|
||||
5C513FBA297F72980072348F /* CustomPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FB9297F72980072348F /* CustomPicker.swift */; };
|
||||
5C513FCC2984ACA60072348F /* QRCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FCB2984ACA60072348F /* QRCodeView.swift */; };
|
||||
5CF72FC229B9142F00124A13 /* ShareAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF72FC129B9142F00124A13 /* ShareAction.swift */; };
|
||||
@@ -626,6 +627,7 @@
|
||||
4CFF8F6C29CD022E008DB934 /* WideEventView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WideEventView.swift; sourceTree = "<group>"; };
|
||||
4FE60CDC295E1C5E00105A1F /* Wallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Wallet.swift; sourceTree = "<group>"; };
|
||||
50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestTests.swift; sourceTree = "<group>"; };
|
||||
5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyUserSearchView.swift; sourceTree = "<group>"; };
|
||||
5C513FB9297F72980072348F /* CustomPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPicker.swift; sourceTree = "<group>"; };
|
||||
5C513FCB2984ACA60072348F /* QRCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeView.swift; sourceTree = "<group>"; };
|
||||
5CF72FC129B9142F00124A13 /* ShareAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareAction.swift; sourceTree = "<group>"; };
|
||||
@@ -689,6 +691,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3169CAE5294E69C000EE4006 /* EmptyTimelineView.swift */,
|
||||
5C42E78B29DB76D90086AAC1 /* EmptyUserSearchView.swift */,
|
||||
);
|
||||
path = "Empty Views";
|
||||
sourceTree = "<group>";
|
||||
@@ -1569,6 +1572,7 @@
|
||||
5C513FCC2984ACA60072348F /* QRCodeView.swift in Sources */,
|
||||
4C3EA64F28FF59F200C48A62 /* tal.c in Sources */,
|
||||
4CB88393296F798300DC99E7 /* ReactionsModel.swift in Sources */,
|
||||
5C42E78C29DB76D90086AAC1 /* EmptyUserSearchView.swift in Sources */,
|
||||
4CB88396296F7F8B00DC99E7 /* ReactionView.swift in Sources */,
|
||||
4CFF8F6B29CD0079008DB934 /* RepostedEvent.swift in Sources */,
|
||||
4C8682872814DE470026224F /* ProfileView.swift in Sources */,
|
||||
|
||||
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