alpha
Login
or
Join now
atpota.to
/
flushes.app
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
fix
author
damedotblog
date
1 year ago
(Mar 9, 2025, 7:23 PM -0400)
commit
fb679543
fb679543a5620c917f32b690659f3de91a90f347
parent
5227ac8f
5227ac8f20694d02d3d30024b00e8fc8ef18b943
+9
-80
1 changed file
Expand all
Collapse all
Unified
Split
app
src
components
ProfileSearch.tsx
+9
-80
app/src/components/ProfileSearch.tsx
Reviewed
···
39
39
};
40
40
}, []);
41
41
42
42
-
// Fetch suggestions when query changes
42
42
+
// Suggestions fetch is disabled for now
43
43
useEffect(() => {
44
44
-
// Clear previous timer
44
44
+
// Clear previous timer if it exists
45
45
if (debounceTimerRef.current) {
46
46
clearTimeout(debounceTimerRef.current);
47
47
}
48
48
-
49
49
-
// Return early if query is too short
50
50
-
if (query.trim().length < 2) {
51
51
-
setSuggestions([]);
52
52
-
setShowSuggestions(false);
53
53
-
return;
54
54
-
}
55
55
-
56
56
-
// Set a new timer to fetch suggestions
57
57
-
debounceTimerRef.current = setTimeout(async () => {
58
58
-
setLoading(true);
59
59
-
try {
60
60
-
// Normalize query by removing @ if present
61
61
-
const searchTerm = query.trim().startsWith('@')
62
62
-
? query.trim().substring(1)
63
63
-
: query.trim();
64
64
-
65
65
-
console.log('Fetching suggestions for:', searchTerm);
66
66
-
const response = await fetch(`/api/bluesky/search?q=${encodeURIComponent(searchTerm)}`);
67
67
-
68
68
-
const data = await response.json();
69
69
-
70
70
-
if (response.ok) {
71
71
-
console.log('Search suggestions:', data.suggestions);
72
72
-
setSuggestions(data.suggestions);
73
73
-
setShowSuggestions(true);
74
74
-
} else {
75
75
-
console.error('Search API error:', data.error, data.message);
76
76
-
setSuggestions([]);
77
77
-
setShowSuggestions(true);
78
78
-
}
79
79
-
} catch (error) {
80
80
-
console.error('Failed to fetch suggestions:', error);
81
81
-
setSuggestions([]);
82
82
-
} finally {
83
83
-
setLoading(false);
84
84
-
}
85
85
-
}, 300); // 300ms debounce delay
86
86
-
48
48
+
49
49
+
// Always hide suggestions
50
50
+
setSuggestions([]);
51
51
+
setShowSuggestions(false);
52
52
+
87
53
return () => {
88
54
if (debounceTimerRef.current) {
89
55
clearTimeout(debounceTimerRef.current);
···
104
70
}
105
71
};
106
72
107
107
-
const handleSuggestionClick = (handle: string) => {
108
108
-
router.push(`/profile/${handle}`);
109
109
-
setQuery(`@${handle}`);
110
110
-
setShowSuggestions(false);
111
111
-
};
73
73
+
// Removed handleSuggestionClick as it's no longer needed
112
74
113
75
return (
114
76
<div className={styles.searchContainer}>
···
118
80
type="text"
119
81
value={query}
120
82
onChange={(e) => setQuery(e.target.value)}
121
121
-
onFocus={() => query.trim().length >= 2 && setShowSuggestions(true)}
122
83
placeholder="Search user @handle"
123
84
className={styles.searchInput}
124
85
aria-label="Search for a user profile"
···
130
91
</svg>
131
92
</button>
132
93
</form>
133
133
-
134
134
-
{showSuggestions && (
135
135
-
<div ref={suggestionsRef} className={styles.suggestionsContainer}>
136
136
-
{loading ? (
137
137
-
<div className={styles.loadingContainer}>
138
138
-
<span className={styles.loadingDot}></span>
139
139
-
<span className={styles.loadingDot}></span>
140
140
-
<span className={styles.loadingDot}></span>
141
141
-
</div>
142
142
-
) : suggestions.length > 0 ? (
143
143
-
<ul className={styles.suggestionsList}>
144
144
-
{suggestions.map((suggestion) => (
145
145
-
<li key={suggestion.did} className={styles.suggestionItem}>
146
146
-
<button
147
147
-
type="button"
148
148
-
onClick={() => handleSuggestionClick(suggestion.handle)}
149
149
-
className={styles.suggestionButton}
150
150
-
>
151
151
-
<div className={styles.suggestionInfo}>
152
152
-
{suggestion.displayName && (
153
153
-
<span className={styles.displayName}>{suggestion.displayName}</span>
154
154
-
)}
155
155
-
<span className={styles.handle}>@{suggestion.handle}</span>
156
156
-
</div>
157
157
-
</button>
158
158
-
</li>
159
159
-
))}
160
160
-
</ul>
161
161
-
) : (
162
162
-
<div className={styles.noResults}>No users found</div>
163
163
-
)}
164
164
-
</div>
165
165
-
)}
94
94
+
{/* Suggestions dropdown removed */}
166
95
</div>
167
96
);
168
97
}