Skip to content

Commit 9de8f6e

Browse files
author
Carl
committed
Merge latest main before workflow controls handoff
Signed-off-by: Carl <32a2e2c9d428ee08902cab75d956da2c1d235a22d4766b0dd4138bf6e2e5db1d@buzz.block.builderlab.xyz>
2 parents 7516673 + 96f0743 commit 9de8f6e

5 files changed

Lines changed: 439 additions & 26 deletions

File tree

‎src/bundled/channels/ChannelSidebarItem.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import { ChannelSidebarItem } from "./ChannelSidebarItem";
1717

1818
afterEach(cleanup);
1919

20+
const noTyping = Object.freeze([]);
21+
2022
function owner(profiles = new Map<string, Profile>()) {
2123
const listeners = new Set<() => void>();
2224
let snapshot: UnreadSnapshot = {
@@ -40,6 +42,7 @@ function owner(profiles = new Map<string, Profile>()) {
4042
snapshot: () => profiles,
4143
subscribe: () => () => {},
4244
},
45+
typing: { snapshot: () => noTyping, subscribe: () => () => {} },
4346
unread: {
4447
snapshot: () => snapshot,
4548
subscribe: (_target: unknown, listener: () => void) => {

‎src/bundled/channels/ChannelSidebarItem.tsx‎

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ChatCircleIcon } from "../../shared/design-system/icons/index";
1212
import { channelIcon } from "../../features/channels/channel-icon";
1313
import { ChannelActivityPopover } from "./ChannelActivityPopover";
1414
import { ChannelSidebarRow } from "./ChannelSidebarRow";
15+
import { DmTypingBadge } from "./DmTypingBadge";
1516
import { usePresenceStatus } from "../../features/presence/react";
1617
import { UnreadBadge } from "./UnreadBadge";
1718
import styles from "./Channels.module.css";
@@ -91,32 +92,37 @@ export const ChannelSidebarItem = memo(function ChannelSidebarItem({
9192
channel={channel}
9293
dmVisualSpacing={channel.channelType === "dm"}
9394
icon={
94-
channel.channelType === "dm" && channel.participants?.length === 1 ? (
95-
<span className={styles.dmAvatar} data-dm-identity="">
96-
<Avatar
97-
src={
98-
profile?.picture
99-
? session.media(profile.picture, "small")
100-
: undefined
101-
}
102-
alt=""
103-
fallback={channel.name}
104-
size="fill"
105-
shape={profile?.isAgent ? "squircle" : "circle"}
106-
statusBadge={presence === "unknown" ? undefined : presence}
107-
/>
108-
</span>
109-
) : channel.channelType === "dm" &&
110-
(channel.participants?.length ?? 0) > 1 ? (
111-
<span
112-
className={styles.dmCount}
113-
data-dm-identity=""
114-
data-dm-participant-count=""
115-
title={`${channel.participants?.length} other participants`}
116-
aria-hidden="true"
117-
>
118-
{channel.participants?.length}
119-
</span>
95+
channel.channelType === "dm" ? (
96+
<DmTypingBadge session={session} channelId={channel.id}>
97+
{channel.participants?.length === 1 ? (
98+
<span className={styles.dmAvatar} data-dm-identity="">
99+
<Avatar
100+
src={
101+
profile?.picture
102+
? session.media(profile.picture, "small")
103+
: undefined
104+
}
105+
alt=""
106+
fallback={channel.name}
107+
size="fill"
108+
shape={profile?.isAgent ? "squircle" : "circle"}
109+
statusBadge={presence === "unknown" ? undefined : presence}
110+
/>
111+
</span>
112+
) : (channel.participants?.length ?? 0) > 1 ? (
113+
<span
114+
className={styles.dmCount}
115+
data-dm-identity=""
116+
data-dm-participant-count=""
117+
title={`${channel.participants?.length} other participants`}
118+
aria-hidden="true"
119+
>
120+
{channel.participants?.length}
121+
</span>
122+
) : (
123+
<Icon size={16} />
124+
)}
125+
</DmTypingBadge>
120126
) : (
121127
<Icon size={16} />
122128
)

‎src/bundled/channels/Channels.module.css‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,42 @@
736736
background: var(--affordance-accent-prominent);
737737
}
738738

739+
/* Occupies the DM identity box while it replaces the avatar or count; shares
740+
the participant-count chip's subtle roles. */
741+
.typing {
742+
display: inline-flex;
743+
width: 22px;
744+
height: 22px;
745+
flex: 0 0 22px;
746+
align-items: center;
747+
justify-content: center;
748+
gap: var(--space-half);
749+
border-radius: var(--radius-pill);
750+
background: var(--affordance-subtle);
751+
}
752+
.typing > span {
753+
width: 4px;
754+
height: 4px;
755+
border-radius: 50%;
756+
background: var(--text-subtle);
757+
}
758+
@keyframes typing-pulse {
759+
50% {
760+
opacity: 0.35;
761+
}
762+
}
763+
@media (prefers-reduced-motion: no-preference) {
764+
.typing > span {
765+
animation: typing-pulse 1.4s ease-in-out infinite;
766+
}
767+
.typing > span:nth-child(2) {
768+
animation-delay: 0.2s;
769+
}
770+
.typing > span:nth-child(3) {
771+
animation-delay: 0.4s;
772+
}
773+
}
774+
739775
/* Match the adjacent small avatars without creating image/profile demand. */
740776
.dmAvatar {
741777
display: inline-grid;

0 commit comments

Comments
 (0)