Repository navigation
Commit 4f554b6
feat(sidebar): prioritize unread DMs in overflow navigation (block#6842)
**Category:** improvement
**User Impact:** Users can see which unread direct messages are waiting
offscreen and jump to the most relevant one first.
**Problem:** The sidebar overflow control treated every offscreen unread
conversation alike, so an unread DM could be hidden behind channel
activity with no visible clue about who was waiting.
**Solution:** Prioritize the first offscreen unread DM, preview up to
three senders with avatars, and keep the arrow, avatars, separator, and
message count intact while only the trailing phrase truncates in narrow
sidebars.
<details>
<summary>File changes</summary>
**desktop/src/features/sidebar/lib/useUnreadOverflow.ts**
Adds ordered DM preview data to unread-overflow calculations while
preserving the sidebar's existing visibility and direction rules.
**desktop/src/features/sidebar/lib/useUnreadOverflow.test.mjs**
Covers DM prioritization, ordering, offscreen filtering, and
channel-only fallback behavior.
**desktop/src/features/sidebar/ui/AppSidebar.tsx**
Passes unread DM previews into the lower overflow control and navigates
to the preferred DM before the next unread channel.
**desktop/src/features/sidebar/ui/MoreUnreadButton.tsx**
Renders the frontmost-first avatar stack, accessible DM target label,
middot separator, and message-count treatment.
**desktop/src/features/sidebar/ui/MoreUnreadButton.test.mjs**
Locks the three-avatar cap, stacking order, preferred target, fallback,
accessible copy, and truncation structure.
**desktop/src/shared/ui/UnreadPill.tsx**
Contains the primary pill and allows only its trailing label to
ellipsize under width pressure.
**desktop/src/shared/ui/UserAvatar.tsx**
Allows the sidebar preview stack to identify each rendered avatar in
regression coverage.
</details>
## Reproduction steps
1. Open enough sidebar conversations that unread items fall below the
visible area.
2. Leave one or more offscreen DMs unread, along with unread channels.
3. Confirm the bottom overflow pill shows up to three overlapping DM
avatars followed by a middot and the total new-message count.
4. Select the pill and confirm it navigates to the first offscreen
unread DM rather than the nearest unread channel.
5. Resize the sidebar from 420px through 300px to 220px and confirm the
arrow, avatars, middot, and full numeric count remain visible; only `new
messages` may ellipsize.
6. Repeat with channel-only unread overflow and confirm the control
keeps its channel fallback behavior without avatars.
## Screenshots
Built-UI matrix with 100px of visible space beyond the sidebar edge. All
images are hosted through `pr-screenshots`.
| State | 220px min | 300px default | 420px max | Result |
| --- | --- | --- | --- | --- |
| Channel-only · 13 | 
| 
| 
| Full label throughout. |
| Channel-only · 999 | 
| 
| 
| Full label throughout. |
| One DM only · 1 | 
| 
| 
| Full label throughout. |
| One DM + channels · 99 | 
| 
| 
| Full label throughout. |
| Two DMs only · 2 | 
| 
| 
| Full label throughout. |
| Two DMs + channels · 47 | 
| 
| 
| Full label throughout. |
| Three DMs + channels · 128 | 
| 
| 
| 220px: `128 new messa…`; full at 300/420. |
| Three DMs + channels · 999 | 
| 
| 
| 220px: `999 new mess…`; full at 300/420. |
| Three DMs + channels · 9,999 | 
| 
| 
| 220px: `9,999 new mes…`; full at 300/420. |
**Matrix result:** 27/27 states remain contained. Exactly 3/27 states
ellipsize—all are three-avatar cases at 220px. The arrow, all avatars,
middot, and complete numeric value remain visible; only the trailing
`new messages` phrase yields.
## Validation
- Desktop unit suite: 5,517 passed
- TypeScript: passed
- Biome on all seven changed files: passed
- Pre-push desktop checks, typecheck, tests, file-size, and branch-skew
gates: passed
- 27-state built-UI matrix capture: 27/27 contained; only the three
220px three-avatar states truncate, and only the trailing phrase
- `git diff --check`: passed
---------
Signed-off-by: Taylor Ho <[email protected]>
Co-authored-by: Carl <acda9e433d19dcd0e6b6840f7f4b98f3a56f1fab98049d444c087019e6d36560@users.noreply.github.com>
Co-authored-by: Rizz <302abe414ca6e3134763d2539bfcf145aea2a63fe5f8455204ed602fd40cf381@buzz.block.builderlab.xyz>1 parent de188eb commit 4f554b6
9 files changed
Lines changed: 473 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
74 | | - | |
75 | | - | |
| 78 | + | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | | - | |
79 | | - | |
80 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | | - | |
84 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
85 | 94 | | |
86 | | - | |
| 95 | + | |
87 | 96 | | |
88 | 97 | | |
89 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
90 | 102 | | |
91 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
92 | 107 | | |
93 | 108 | | |
94 | 109 | | |
95 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
96 | 130 | | |
97 | 131 | | |
98 | 132 | | |
99 | 133 | | |
100 | 134 | | |
101 | 135 | | |
| 136 | + | |
102 | 137 | | |
103 | 138 | | |
104 | 139 | | |
| |||
117 | 152 | | |
118 | 153 | | |
119 | 154 | | |
120 | | - | |
| 155 | + | |
121 | 156 | | |
122 | 157 | | |
123 | | - | |
| 158 | + | |
124 | 159 | | |
125 | 160 | | |
126 | 161 | | |
127 | 162 | | |
128 | | - | |
| 163 | + | |
129 | 164 | | |
130 | 165 | | |
131 | 166 | | |
| |||
135 | 170 | | |
136 | 171 | | |
137 | 172 | | |
138 | | - | |
139 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
140 | 176 | | |
141 | 177 | | |
142 | 178 | | |
| |||
150 | 186 | | |
151 | 187 | | |
152 | 188 | | |
153 | | - | |
| 189 | + | |
154 | 190 | | |
155 | 191 | | |
156 | 192 | | |
| |||
192 | 228 | | |
193 | 229 | | |
194 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
195 | 242 | | |
196 | 243 | | |
| 244 | + | |
197 | 245 | | |
198 | 246 | | |
199 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
| |||
148 | 153 | | |
149 | 154 | | |
150 | 155 | | |
151 | | - | |
| 156 | + | |
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
| |||
390 | 395 | | |
391 | 396 | | |
392 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
393 | 440 | | |
394 | 441 | | |
395 | 442 | | |
| |||
487 | 534 | | |
488 | 535 | | |
489 | 536 | | |
490 | | - | |
| 537 | + | |
491 | 538 | | |
492 | 539 | | |
493 | 540 | | |
| |||
760 | 807 | | |
761 | 808 | | |
762 | 809 | | |
763 | | - | |
764 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
765 | 817 | | |
| 818 | + | |
766 | 819 | | |
767 | 820 | | |
768 | 821 | | |
| |||
0 commit comments