Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Show Slack sender avatars with a source badge in Inbox (#2194)

Eve Bouffard79843c8cb856
diff --git a/plugins/web-ui/src/inbox.ts b/plugins/web-ui/src/inbox.ts
index 3a2f2e987..35ce1a261 100644
--- a/plugins/web-ui/src/inbox.ts
+++ b/plugins/web-ui/src/inbox.ts
@@ -49,7 +49,7 @@ import { listBackLink } from "./list-page";
import { registerPaneKind } from "./pane-kinds";
import { exitSplitIfActive, notifyPanesChanged } from "./split";
import { tip } from "./tooltip";
-import { brandName, fieldSelect, menuSelect, icon, initials, relTime, sheenLabel, workingWave } from "./ui";
+import { brandName, fieldSelect, menuSelect, icon, initials, relTime, sheenLabel, slackMark, workingWave } from "./ui";
import { assistantSidebar, assistantMessage } from "./assistant-sidebar";
import { inboxChat } from "./inbox-chat";
@@ -1669,6 +1669,12 @@ function itemRowTpl(surface: InboxSurface, item: InboxItem, groupSize = 1): Temp
const expandedAttr = inlineDetail ? String(open) : nothing;
const handled = item.status !== "open";
const gmail = item.source === "gmail";
+ const slack = item.source === "slack";
+ const senderId = item.slack?.userId ?? item.participants?.[0]?.key;
+ const sender = item.participants?.find((person) => person.key === senderId) ?? {
+ key: senderId ?? participantKey(item.from),
+ name: participantName(item.from) || "Slack",
+ };
const heading = gmail ? item.from || item.title : (item.slack?.channelLabel ?? item.title);
const sub = gmail ? item.title : item.from || inboxViewName(item.loopId);
return html`
@@ -1690,7 +1696,17 @@ function itemRowTpl(surface: InboxSurface, item: InboxItem, groupSize = 1): Temp
drawAll();
}}
>
- <span class="inbox-item-glyph">${sourceGlyph(item)}</span>
+ <span class="inbox-item-glyph ${slack ? "inbox-sender-avatar" : ""}">
+ ${
+ slack
+ ? html`${participantsOf(item).length > 1 ? participantsTpl(item) : avatarTpl(sender)}<span
+ class="inbox-sender-badge"
+ aria-hidden="true"
+ >${slackMark(10)}</span
+ >`
+ : sourceGlyph(item)
+ }
+ </span>
<span class="inbox-item-main">
<span class="inbox-item-top">
${groupSize > 1 ? html`<span class="inbox-group-count">${groupSize} similar ·</span>` : nothing}
@@ -1700,7 +1716,7 @@ function itemRowTpl(surface: InboxSurface, item: InboxItem, groupSize = 1): Temp
<span class="inbox-item-snippet">${slackTextTpl(item, item.snippet, { links: false })}</span>
</span>
<span class="inbox-item-side">
- ${participantsTpl(item)} ${priorityMarkTpl(item)} ${itemSideMark(item, handled)}
+ ${slack ? nothing : participantsTpl(item)} ${priorityMarkTpl(item)} ${itemSideMark(item, handled)}
<span class="inbox-item-time" title=${fmtClock(item.receivedAt)}>${relTime(item.receivedAt)}</span>
${icon(expanded ? ChevronDown : ChevronRight, 13)}
</span>
diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.css
index 116727466..3cda44d83 100644
--- a/plugins/web-ui/src/shell.css
+++ b/plugins/web-ui/src/shell.css
@@ -9723,6 +9723,68 @@ h3.ambient-field-label {
justify-content: center;
color: var(--muted-foreground);
}
+.inbox-item-glyph.inbox-sender-avatar {
+ position: relative;
+ width: 40px;
+ height: 40px;
+ align-self: center;
+ margin-top: 0;
+}
+.inbox-sender-avatar > .inbox-avatar {
+ width: 40px;
+ height: 40px;
+ border-radius: 8px;
+ font-size: 14px;
+}
+.inbox-sender-avatar > .inbox-avatars {
+ display: grid;
+ grid-template-columns: repeat(2, 19px);
+ align-content: center;
+ gap: 2px;
+ width: 40px;
+ height: 40px;
+}
+.inbox-sender-avatar .inbox-avatars > .inbox-avatar {
+ width: 19px;
+ height: 19px;
+ border-radius: 5px;
+ font-size: 8px;
+}
+.inbox-sender-avatar > .inbox-avatars:has(> :nth-child(2):last-child) {
+ position: relative;
+}
+.inbox-sender-avatar .inbox-avatars > .inbox-avatar:first-child:has(+ :last-child),
+.inbox-sender-avatar .inbox-avatars > .inbox-avatar:nth-child(2):last-child {
+ position: absolute;
+ width: 24px;
+ height: 24px;
+}
+.inbox-sender-avatar .inbox-avatars > .inbox-avatar:first-child:has(+ :last-child) {
+ top: 0;
+ left: 0;
+}
+.inbox-sender-avatar .inbox-avatars > .inbox-avatar:nth-child(2):last-child {
+ right: 0;
+ bottom: 0;
+ outline: 2px solid var(--background);
+}
+.inbox-sender-avatar .inbox-avatars > .inbox-avatar:nth-child(3):last-child {
+ grid-column: span 2;
+ justify-self: center;
+}
+.inbox-sender-badge {
+ position: absolute;
+ right: -6px;
+ bottom: -6px;
+ display: grid;
+ place-items: center;
+ width: 14px;
+ height: 14px;
+ border: 2px solid var(--background);
+ border-radius: 4px;
+ box-sizing: border-box;
+ background: var(--background);
+}
.src-gmail .inbox-item-glyph {
color: var(--cta);
}