Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(desktop): plus button starts a task instead of a one-item menu (#83897)

Dylan Martin10585d05705d
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsFab.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsFab.tsx
index 203aaaef0a97..2fabfbb2694b 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsFab.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsFab.tsx
@@ -72,40 +72,62 @@ export function ChannelsFab({ channelId }: { channelId?: string }) {
</DropdownMenuItem>
);
+ // Inside a space on the layout, the menu held one item, so the button is that
+ // item: a click starts the task instead of asking which kind to start.
+ const newTaskOnly = channelsLayout && !!channelId;
+
+ const draftDot = channelsLayout && hasDraft && (
+ <span
+ aria-hidden
+ className="absolute top-0.5 right-0.5 size-2 rounded-full bg-current ring-(--primary) ring-2"
+ />
+ );
+
+ const label = newTaskOnly ? "New task" : "Create";
+
const trigger = (
<Button
variant="primary"
size="icon-lg"
- aria-label="Create"
+ aria-label={label}
className="absolute right-3 bottom-3 z-10 rounded-full"
+ onClick={newTaskOnly ? newTask : undefined}
>
<PlusIcon size={20} weight="bold" />
- {channelsLayout && hasDraft && (
- <span
- aria-hidden
- className="absolute top-0.5 right-0.5 size-2 rounded-full bg-current ring-(--primary) ring-2"
- />
- )}
+ {draftDot}
</Button>
);
+ const tooltip = (
+ <TooltipContent side="top" align="center">
+ {channelsLayout ? (
+ <>
+ {/* The draft dot needs saying out loud, and the button is where
+ the create shortcut is worth advertising. */}
+ {hasDraft ? `${label} — you have a draft` : label}
+ <Kbd className="ml-1.5">{formatHotkey(SHORTCUTS.NEW_TASK)}</Kbd>
+ </>
+ ) : (
+ "Create something new"
+ )}
+ </TooltipContent>
+ );
+
+ if (newTaskOnly) {
+ return (
+ <Tooltip>
+ <TooltipTrigger render={trigger} />
+ {tooltip}
+ </Tooltip>
+ );
+ }
+
return (
<>
<DropdownMenu>
<Tooltip>
<TooltipTrigger render={<DropdownMenuTrigger render={trigger} />} />
- <TooltipContent side="top" align="center">
- {channelsLayout ? (
- <>
- {/* The draft dot needs saying out loud, and the button is where
- the create shortcut is worth advertising. */}
- {hasDraft ? "Create — you have a draft" : "Create"}
- <Kbd className="ml-1.5">{formatHotkey(SHORTCUTS.NEW_TASK)}</Kbd>
- </>
- ) : (
- "Create something new"
- )}
- </TooltipContent>
+ {tooltip}
</Tooltip>
<DropdownMenuContent
align={channelId ? "end" : "center"}
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx
index e7bd49928b8b..6a83bf3f1439 100644
--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx
+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx
@@ -4,7 +4,6 @@ import {
CaretDownIcon,
CaretRightIcon,
DotsThreeIcon,
- FileTextIcon,
LinkIcon,
PencilSimpleIcon,
PlusIcon,
@@ -950,8 +949,6 @@ const ChannelSection = memo(
const isActive = pathname === base || pathname.startsWith(`${base}/`);
// Lifted so the hover button group stays visible while the menu is open.
const [menuOpen, setMenuOpen] = useState(false);
- // Keep the hover actions pinned while the create menu is open.
- const [newMenuOpen, setNewMenuOpen] = useState(false);
const { reveal, hoverProps, focusProps } = useOverflowTickerReveal();
const hasAttention = unreadSessions > 0 || blockedSessions > 0;
const prefetchSessions = usePrefetchSpaceTasks();
@@ -971,6 +968,15 @@ const ChannelSection = memo(
isDeleting,
} = useChannelActions(channel);
+ const newTask = () => {
+ track(ANALYTICS_EVENTS.CHANNEL_ACTION, {
+ action_type: "new_task_open",
+ surface: "sidebar",
+ channel_id: channel.id,
+ });
+ openTaskInput({ channelId: channel.id });
+ };
+
// A boolean rather than the value itself, so a keypress re-renders only the
// two rows whose answer changed. The row's autocomplete value is the space
// id, which is what the keyboard's highlight holds.
@@ -1129,55 +1135,30 @@ const ChannelSection = memo(
</ContextMenuContent>
</ContextMenu>
</SpaceHoverCard>
- {/* Hover actions stay visible while either menu is open. */}
+ {/* Hover actions stay visible while the menu is open. */}
<div className="absolute top-1 right-1">
<ButtonGroup>
- <DropdownMenu open={newMenuOpen} onOpenChange={setNewMenuOpen}>
- <Tooltip>
- <TooltipTrigger
- render={
- <DropdownMenuTrigger
- render={
- <Button
- variant="outline"
- size="icon-xs"
- aria-label={`New in ${channel.name}`}
- className={cn(
- "gap-1 transition-opacity group-hover:border-border",
- menuOpen || newMenuOpen
- ? "opacity-100"
- : "opacity-0 group-hover/chan:opacity-100",
- )}
- >
- <PlusIcon size={12} weight="bold" />
- </Button>
- }
- />
- }
- />
- <TooltipContent side="top">New…</TooltipContent>
- </Tooltip>
- <DropdownMenuContent
- align="start"
- side="bottom"
- sideOffset={4}
- className="w-auto min-w-fit"
- >
- <DropdownMenuItem
- onClick={() => {
- track(ANALYTICS_EVENTS.CHANNEL_ACTION, {
- action_type: "new_task_open",
- surface: "sidebar",
- channel_id: channel.id,
- });
- openTaskInput({ channelId: channel.id });
- }}
- >
- <FileTextIcon size={14} />
- New task
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Button
+ variant="outline"
+ size="icon-xs"
+ aria-label={`New task in ${channel.name}`}
+ className={cn(
+ "gap-1 transition-opacity group-hover:border-border",
+ menuOpen
+ ? "opacity-100"
+ : "opacity-0 group-hover/chan:opacity-100",
+ )}
+ onClick={newTask}
+ >
+ <PlusIcon size={12} weight="bold" />
+ </Button>
+ }
+ />
+ <TooltipContent side="top">New task</TooltipContent>
+ </Tooltip>
<ChannelMenu
channelName={channel.name}
actions={actions}
@@ -1361,8 +1342,6 @@ const PersonalChannelRow = memo(function PersonalChannelRow({
const pathname = useRouterState({ select: (s) => s.location.pathname });
const { channels } = useChannels();
const { ensureChannelId, openPersonalChannel } = useOpenPersonalChannel();
- // The create dropdown mirrors a shared channel row.
- const [newMenuOpen, setNewMenuOpen] = useState(false);
// Personal channels are provisioned lazily server-side when the channel list
// is fetched; `undefined` just means the list hasn't loaded it yet.
@@ -1446,43 +1425,22 @@ const PersonalChannelRow = memo(function PersonalChannelRow({
)}
</SpaceRowSurface>
<div className="absolute top-0 right-1">
- <DropdownMenu open={newMenuOpen} onOpenChange={setNewMenuOpen}>
- <Tooltip>
- <TooltipTrigger
- render={
- <DropdownMenuTrigger
- render={
- <Button
- variant="outline"
- size="icon-xs"
- aria-label={`New in ${PERSONAL_CHANNEL_LABEL}`}
- className={cn(
- "gap-1 transition-opacity group-hover:border-border",
- newMenuOpen
- ? "opacity-100"
- : "opacity-0 group-hover/chan:opacity-100",
- )}
- >
- <PlusIcon size={12} weight="bold" />
- </Button>
- }
- />
- }
- />
- <TooltipContent side="top">New…</TooltipContent>
- </Tooltip>
- <DropdownMenuContent
- align="start"
- side="bottom"
- sideOffset={4}
- className="w-auto min-w-fit"
- >
- <DropdownMenuItem onClick={newTask}>
- <FileTextIcon size={14} />
- New task
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Button
+ variant="outline"
+ size="icon-xs"
+ aria-label={`New task in ${PERSONAL_CHANNEL_LABEL}`}
+ className="gap-1 opacity-0 transition-opacity group-hover:border-border group-hover/chan:opacity-100"
+ onClick={newTask}
+ >
+ <PlusIcon size={12} weight="bold" />
+ </Button>
+ }
+ />
+ <TooltipContent side="top">New task</TooltipContent>
+ </Tooltip>
</div>
</Box>
{expanded && meChannel && (