Skip to content

Commit 382a4d7

Browse files
feat(inbox): Put In flight states on the right, under the row menu
Co-Authored-By: David Cramer <[email protected]>
1 parent 27925f4 commit 382a4d7

4 files changed

Lines changed: 42 additions & 19 deletions

File tree

‎packages/junior-dashboard/e2e/inbox/in-flight.spec.ts‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { waitForOutlineRead } from "../harness";
22
import { mockInboxItems } from "./inbox-fixture";
3-
import { screenshot } from "../screenshot";
3+
import { desktop, screenshot } from "../screenshot";
44
import { expect, test } from "../test";
55

66
test.describe("new UI", () => {
@@ -30,6 +30,23 @@ test.describe("new UI", () => {
3030
name: /Roll out payments-v42/,
3131
});
3232
await expect(pinned).toBeVisible();
33+
// On hover, its `⋯` takes the place of its state on the right.
34+
const pinnedState = inFlight
35+
.getByRole("listitem")
36+
.filter({
37+
has: page.getByRole("link", { name: /Roll out payments-v42/ }),
38+
})
39+
.getByRole("img", { name: "Pinned" });
40+
await expect(pinnedState).toBeVisible();
41+
// The shot keeps the pointer only at its own size.
42+
await page.setViewportSize(desktop);
43+
await pinned.hover();
44+
await expect(pinnedState).toBeHidden();
45+
await screenshot(page, "inbox-in-flight-hover", {
46+
lightTheme: true,
47+
target: inFlight,
48+
view: "desktop",
49+
});
3350
// A right-click on an In flight row opens its Conversation menu.
3451
const menu = page.getByRole("menu");
3552
await pinned.click({ button: "right" });

‎packages/junior-dashboard/e2e/inbox/tree-state.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ test.describe("new UI", () => {
8888
await screenshot(page, "inbox-tree-state", { lightTheme: true });
8989

9090
// Each Conversation row shows the same one icon.
91-
const row = page
91+
const row = list
9292
.getByRole("listitem")
9393
.filter({
9494
has: page.getByRole("link", { name: /^Quarterly reliability review/ }),

‎packages/junior-dashboard/src/client/inbox/InboxNav.tsx‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
} from "../conversations/PinnedConversationOrder";
2525
import {
2626
ROW_ACTION_BUTTON_CLASS,
27-
ROW_ACTIONS_FADE_CLASS,
2827
ROW_ACTIONS_REVEAL_CLASS,
2928
} from "../conversations/sidebarRowActions";
3029
import { useInboxRowActions } from "../conversations/useInboxRowActions";
@@ -54,7 +53,7 @@ function InFlightRow(props: {
5453
<ContextMenuTrigger
5554
{...browserMenuOnLinks}
5655
className={cn(
57-
"group relative list-none [--row-actions-width:1.25rem]",
56+
"group relative list-none",
5857
drag?.dragging && "opacity-40",
5958
)}
6059
onKeyDown={drag?.onKeyDown}
@@ -66,7 +65,13 @@ function InFlightRow(props: {
6665
aria-current={props.selected ? "page" : undefined}
6766
aria-keyshortcuts={drag ? "Alt+ArrowUp Alt+ArrowDown" : undefined}
6867
className={cn(
69-
paneEntryClass(props.selected ? "page" : undefined, props.phone),
68+
// The state sits on the right, as on a Space row, so the title
69+
// takes the icon column.
70+
paneEntryClass(
71+
props.selected ? "page" : undefined,
72+
props.phone,
73+
false,
74+
),
7075
// Phones always show the `⋯`, so the title stops before it.
7176
"max-sm:pr-10",
7277
// The row shows which Conversation its open menu acts on.
@@ -79,23 +84,18 @@ function InFlightRow(props: {
7984
draggable={drag ? false : undefined}
8085
to={conversationPath(conversation.id)}
8186
>
82-
<ConversationStateIcon
83-
className="justify-self-center"
84-
state={conversationDisplayState(conversation)}
85-
/>
8687
<span
87-
className={cn(
88-
fadeOverflowClass,
89-
ROW_ACTIONS_FADE_CLASS,
90-
// The same fade while the `⋯` menu is open. Tailwind needs the
91-
// whole class written out.
92-
"sm:group-has-data-popup-open:[mask-image:linear-gradient(to_left,transparent_var(--row-actions-width),black_calc(var(--row-actions-width)+2rem))]",
93-
"text-dashboard-text",
94-
)}
88+
className={cn(fadeOverflowClass, "text-dashboard-text")}
9589
ref={fadeWhenOverflowing}
9690
>
9791
{conversation.displayTitle}
9892
</span>
93+
{/* The `⋯` takes the state's place while it shows. Phones show
94+
both. */}
95+
<ConversationStateIcon
96+
className="sm:group-focus-within:invisible sm:group-hover:invisible sm:group-has-data-popup-open:invisible"
97+
state={conversationDisplayState(conversation)}
98+
/>
9999
</Link>
100100
<DropdownMenu modal={false} onOpenChange={actions.onMenuOpenChange}>
101101
<DropdownMenuTrigger

‎packages/junior-dashboard/src/client/inbox/PaneDestinations.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@ const ICONS: Record<InboxView, LucideIcon> = {
3939
* list that opened the page keeps the accent text without the fill, so only
4040
* the page's own row is lit.
4141
*/
42-
export const paneEntryClass = (mark?: PaneRowMark, phone?: boolean) =>
42+
export const paneEntryClass = (
43+
mark?: PaneRowMark,
44+
phone?: boolean,
45+
/** False when the row has no leading icon, so its title takes that room. */
46+
icon = true,
47+
) =>
4348
cn(
4449
// A count adds its own column, so a row without one gives its title the
4550
// full width, with no gap left for a count.
46-
"grid min-w-0 grid-flow-col grid-cols-[1rem_minmax(0,1fr)] items-center gap-x-3 rounded-lg px-3 font-sans text-sm no-underline transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-dashboard-focus",
51+
icon ? "grid-cols-[1rem_minmax(0,1fr)]" : "grid-cols-[minmax(0,1fr)]",
52+
"grid min-w-0 grid-flow-col items-center gap-x-3 rounded-lg px-3 font-sans text-sm no-underline transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-dashboard-focus",
4753
phone ? "h-11" : "h-8",
4854
mark === "page"
4955
? "bg-dashboard-accent/[0.12]"

0 commit comments

Comments
 (0)