0 ? dropdownWidth : undefined }}
+ className="animate-fade-in"
+ >
+
+ {error && (
+
{error}
+ )}
+
+ {allItems.length === 0 && !isSearching && query.trim().length === 0 && dmItems.length === 0 && (
+
+ Search for a user to start chatting
+
+ )}
+
+ {/* DM conversations section */}
+ {dmItems.length > 0 && (
+ <>
+ {query.trim().length >= 2 && (
+
+ Conversations
+
+ )}
+ {dmItems.map((item, i) => {
+ const globalIndex = i;
+ const isSelected = globalIndex === selectedIndex;
+ return (
+
selectItem(item)}
+ className={`flex items-center gap-2.5 px-2 py-1.5 mx-1 rounded cursor-pointer transition-colors ${
+ isSelected ? 'bg-interactive-selected' : 'hover:bg-interactive-hover'
+ }`}
+ >
+ {item.isGroup ? (
+
+ {item.otherMembers.slice(0, 2).map((m, idx) => (
+
+ ))}
+
+ ) : (
+
+ )}
+
{item.displayName}
+
+ );
+ })}
+ >
+ )}
+
+ {/* Users section */}
+ {(filteredUserResults.length > 0 || (isSearching && query.trim().length >= 2)) && (
+ <>
+
+ Users
+
+ {isSearching && filteredUserResults.length === 0 && (
+
Searching...
+ )}
+ {filteredUserResults.map((item, i) => {
+ const globalIndex = dmItems.length + i;
+ const isSelected = globalIndex === selectedIndex;
+ return (
+
selectItem(item)}
+ className={`flex items-center gap-2.5 px-2 py-1.5 mx-1 rounded cursor-pointer transition-colors ${
+ isSelected ? 'bg-interactive-selected' : 'hover:bg-interactive-hover'
+ }`}
+ >
+
+
+
+ {item.user.displayName ?? item.user.username}
+
+ {item.user.displayName && (
+
+ @{item.user.username}
+
+ )}
+
+
+ );
+ })}
+ >
+ )}
+
+ {/* No results */}
+ {!isSearching && query.trim().length >= 2 && allItems.length === 0 && (
+
No results found
+ )}
+