mirror of
https://github.com/block/buzz.git
synced 2026-11-16 06:11:34 +00:00
fix(desktop): keep sidebar within size limit
Signed-off-by: Cea Stapleton Cordasco <261786559+cea-block@users.noreply.github.com>
This commit is contained in:
@@ -26,6 +26,19 @@ export function formatVerifiedUserLabel(
|
||||
return chosen || verified || null;
|
||||
}
|
||||
|
||||
export function formatVerifiedProfileLabel(
|
||||
profile:
|
||||
| Pick<Profile, "displayName" | "verifiedName" | "verifiedNameExpiresAt">
|
||||
| null
|
||||
| undefined,
|
||||
): string | null {
|
||||
return formatVerifiedUserLabel(
|
||||
profile?.displayName,
|
||||
profile?.verifiedName,
|
||||
profile?.verifiedNameExpiresAt,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deep-equal two profile lookups by value. Used to stabilise the merged
|
||||
* `messageProfiles` reference at the ChannelScreen boundary: the underlying
|
||||
|
||||
@@ -52,7 +52,7 @@ import type {
|
||||
} from "@/features/sidebar/ui/AppSidebar.types";
|
||||
import { SidebarRelayConnectionCard } from "@/features/sidebar/ui/SidebarRelayConnectionCard";
|
||||
import type { useSidebarRelayConnectionCard } from "@/features/sidebar/ui/useSidebarRelayConnectionCard";
|
||||
import { formatVerifiedUserLabel } from "@/features/profile/lib/identity";
|
||||
import { formatVerifiedProfileLabel } from "@/features/profile/lib/identity";
|
||||
import {
|
||||
SidebarLoadingContent,
|
||||
useSidebarLoadingShape,
|
||||
@@ -479,18 +479,13 @@ export function AppSidebar({
|
||||
immediate: isSelectedDirectMessage,
|
||||
timeoutMs: 400,
|
||||
});
|
||||
const resolvedProfileDisplayName = formatVerifiedUserLabel(
|
||||
profile?.displayName,
|
||||
profile?.verifiedName,
|
||||
profile?.verifiedNameExpiresAt,
|
||||
);
|
||||
const { dmChannelLabels, dmParticipantsByChannelId, dmPresenceByChannelId } =
|
||||
useDmSidebarMetadata({
|
||||
currentPubkey,
|
||||
directMessages,
|
||||
enabled: shouldLoadDmMetadata,
|
||||
fallbackDisplayName,
|
||||
profileDisplayName: resolvedProfileDisplayName,
|
||||
profileDisplayName: formatVerifiedProfileLabel(profile),
|
||||
});
|
||||
const sortedDirectMessages = React.useMemo(
|
||||
() =>
|
||||
@@ -510,7 +505,7 @@ export function AppSidebar({
|
||||
streamChannels,
|
||||
});
|
||||
const resolvedDisplayName =
|
||||
resolvedProfileDisplayName ||
|
||||
formatVerifiedProfileLabel(profile) ||
|
||||
fallbackDisplayName?.trim() ||
|
||||
"Current identity";
|
||||
const isCreatingAny =
|
||||
|
||||
Reference in New Issue
Block a user