+ {/* Typed address → always the top result. */}
+ {addressCard}
+ {roomsToRender.map((roomId, index) => {
+ const room = getRoom(roomId);
+ if (!room) return null;
- const dm = mDirects.has(roomId);
- const dmUserId = dm ? getDmUserId(roomId, getRoom, myUserId) : undefined;
- const dmUsername = dmUserId ? getMxIdLocalPart(dmUserId) : undefined;
- const dmUserServer = dmUserId ? getMxIdServer(dmUserId) : undefined;
+ const dm = mDirects.has(roomId);
+ const dmUserId = dm ? getDmUserId(roomId, getRoom, myUserId) : undefined;
+ const dmUsername = dmUserId ? getMxIdLocalPart(dmUserId) : undefined;
+ const dmUserServer = dmUserId ? getMxIdServer(dmUserId) : undefined;
- const allParents = getAllParents(roomToParents, roomId);
- const orphanParents = allParents
- ? orphanSpaces.filter((o) => allParents.has(o))
- : undefined;
- const perfectOrphanParent =
- orphanParents && guessPerfectParent(mx, roomId, orphanParents);
+ const allParents = getAllParents(roomToParents, roomId);
+ const orphanParents = allParents
+ ? orphanSpaces.filter((o) => allParents.has(o))
+ : undefined;
+ const perfectOrphanParent =
+ orphanParents && guessPerfectParent(mx, roomId, orphanParents);
- const exactParents = roomToParents.get(roomId);
- const perfectParent =
- exactParents && guessPerfectParent(mx, roomId, Array.from(exactParents));
+ const exactParents = roomToParents.get(roomId);
+ const perfectParent =
+ exactParents && guessPerfectParent(mx, roomId, Array.from(exactParents));
- const unread = roomToUnread.get(roomId);
- const focused = listFocus.index === index;
+ const unread = roomToUnread.get(roomId);
+ const focusIndex = roomIndexBase + index;
+ const focused = listFocus.index === focusIndex;
- return (
-
- );
- })}
+
+ );
+ })}
- {/* ── People (homeserver user directory) ─────────── */}
- {peopleToRender.length > 0 && (
- <>
-
- {t('Search.people')}
-
- {peopleToRender.map((user, j) => {
- const index = roomCount + j;
- const focused = listFocus.index === index;
- const username = getMxIdLocalPart(user.userId) ?? user.userId;
- const server = getMxIdServer(user.userId);
- const name = user.displayName || username;
- const avatarSrc = user.avatarUrl
- ? mxcUrlToHttp(mx, user.avatarUrl, useAuthentication, 32, 32, 'crop') ??
- undefined
- : undefined;
- const creating = creatingUserId === user.userId;
+ {/* ── People (homeserver user directory) ─────────── */}
+ {peopleToRender.length > 0 && (
+ <>
+
+ {t('Search.people')}
+
+ {peopleToRender.map((user, j) => {
+ const index = roomIndexBase + roomCount + j;
+ const focused = listFocus.index === index;
+ const username = getMxIdLocalPart(user.userId) ?? user.userId;
+ const server = getMxIdServer(user.userId);
+ const name = user.displayName || username;
+ const avatarSrc = user.avatarUrl
+ ? mxcUrlToHttp(
+ mx,
+ user.avatarUrl,
+ useAuthentication,
+ 32,
+ 32,
+ 'crop'
+ ) ?? undefined
+ : undefined;
- return (
-
- ) : (
+ return (
+
+ requestDirect({
+ userId: user.userId,
+ displayName: user.displayName,
+ avatarUrl: user.avatarUrl,
+ })
+ }
+ variant="Surface"
+ aria-pressed={focused}
+ radii="300"
+ style={{
+ backgroundColor: focused
+ ? 'rgba(255, 255, 255, 0.06)'
+ : undefined,
+ }}
+ after={
server && (
)
- )
- }
- before={
-
- (
-
- {nameInitials(name)}
-
- )}
- />
-
- }
- >
-
-
- {name}
-
-
- @{username}
-
-
-
- );
- })}
- >
- )}
-
- {/* Reach someone on another server: the directory
- can't surface remote users you don't share a room
- with, so when a query finds no people we teach the
- by-address escape hatch (typing a full
- @user:server yields a tappable result above). */}
- {result && !directoryLoading && peopleToRender.length === 0 && (
-
- {t('Search.other_server_hint')}
-
- )}
-
-