Fix broken npub searching
This commit is contained in:
@@ -46,32 +46,7 @@ struct SearchingEventView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
func handle_search(_ evid: String) {
|
||||||
Group {
|
|
||||||
switch search_state {
|
|
||||||
case .searching:
|
|
||||||
HStack(spacing: 10) {
|
|
||||||
Text("Looking for \(search_name)...", comment: "Label that appears when searching for note or profile")
|
|
||||||
ProgressView()
|
|
||||||
.progressViewStyle(.circular)
|
|
||||||
}
|
|
||||||
case .found(let ev):
|
|
||||||
NavigationLink(destination: ThreadView(state: state, thread: ThreadModel(event: ev, damus_state: state))) {
|
|
||||||
|
|
||||||
EventView(damus: state, event: ev)
|
|
||||||
}
|
|
||||||
.buttonStyle(PlainButtonStyle())
|
|
||||||
case .found_profile(let pk):
|
|
||||||
NavigationLink(destination: ProfileView(damus_state: state, pubkey: pk)) {
|
|
||||||
|
|
||||||
FollowUserView(target: .pubkey(pk), damus_state: state)
|
|
||||||
}
|
|
||||||
.buttonStyle(PlainButtonStyle())
|
|
||||||
case .not_found:
|
|
||||||
Text("\(search_name.capitalized) not found", comment: "When a note or profile is not found when searching for it via its note id")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onChange(of: evid, debounceTime: 0.5) { evid in
|
|
||||||
self.search_state = .searching
|
self.search_state = .searching
|
||||||
|
|
||||||
switch search_type {
|
switch search_type {
|
||||||
@@ -127,6 +102,38 @@ struct SearchingEventView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Group {
|
||||||
|
switch search_state {
|
||||||
|
case .searching:
|
||||||
|
HStack(spacing: 10) {
|
||||||
|
Text("Looking for \(search_name)...", comment: "Label that appears when searching for note or profile")
|
||||||
|
ProgressView()
|
||||||
|
.progressViewStyle(.circular)
|
||||||
|
}
|
||||||
|
case .found(let ev):
|
||||||
|
NavigationLink(destination: ThreadView(state: state, thread: ThreadModel(event: ev, damus_state: state))) {
|
||||||
|
|
||||||
|
EventView(damus: state, event: ev)
|
||||||
|
}
|
||||||
|
.buttonStyle(PlainButtonStyle())
|
||||||
|
case .found_profile(let pk):
|
||||||
|
NavigationLink(destination: ProfileView(damus_state: state, pubkey: pk)) {
|
||||||
|
|
||||||
|
FollowUserView(target: .pubkey(pk), damus_state: state)
|
||||||
|
}
|
||||||
|
.buttonStyle(PlainButtonStyle())
|
||||||
|
case .not_found:
|
||||||
|
Text("\(search_name.capitalized) not found", comment: "When a note or profile is not found when searching for it via its note id")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onChange(of: evid, debounceTime: 0.5) { evid in
|
||||||
|
handle_search(evid)
|
||||||
|
}
|
||||||
|
.onAppear {
|
||||||
|
handle_search(evid)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user