Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(sidebar): add context menu to channels widget, remove draggable (#2128)
Seamus56cb45d28b95
diff --git a/js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx b/js/app/packages/app/component/app-sidebar/channels-unread-widget.tsxindex 39e69b5c60..5ccd7e50f3 100644--- a/js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx+++ b/js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx@@ -19,6 +19,8 @@ import { Button } from '@app/component/next-soup/soup-view/filters-bar/button';import { useSplitLayout } from '@app/component/split-layout/layout';import { globalSplitManager } from '@app/signal/splitLayout';import { compareDateDesc } from '@core/util/date';+import { ContextMenuContent, MenuItem } from '@core/component/Menu';+import { ContextMenu } from '@kobalte/core/context-menu';function getChannelInfo(notification: UnifiedNotification): {channelName: string | null;@@ -115,59 +117,104 @@ function ChannelGroupItem(props: { group: ChannelGroup; animate?: boolean }) {: 'Unknown Channel';};+ const content = () =>+ ({+ type: 'channel',+ id: props.group.entityId,+ }) as const;++ const canOpenInNewSplit = () =>+ globalSplitManager()?.canAppendSplit() ?? false;++ const openInCurrentSplit = () =>+ layout.openWithSplit(content(), {+ referredFrom: 'sidebar',+ });++ const openInNewSplit = () => {+ if (!canOpenInNewSplit()) return;+ const manager = globalSplitManager()!;++ manager.createNewSplit({+ content: content(),+ activate: true,+ allowDuplicate: true,+ referredFrom: 'sidebar',+ });+ };++ const openFullscreen = () => {+ const split = openInCurrentSplit();+ split?.toggleSpotlight(true);+ };+return (- <Button- as={'a'}- href={`/channel/${props.group.entityId}`}- class="flex items-center justify-start gap-3 w-full cursor-default rounded-xs"- variant="ghost"- size="sm"- classList={{- 'opacity-0 -translate-y-2': !isVisible(),- 'opacity-100 translate-y-0': isVisible(),- }}- onClick={(e) => {- // Middle mouse handling- if (e.button === 1) return;-- e.preventDefault();- layout.openWithSplit(- {- type: 'channel',- id: props.group.entityId,- },- {- preferNewSplit: e.shiftKey,- }- );- }}- >- <div class="flex-shrink-0">- <Show- when={props.group.isDM && props.group.latestSenderId}- fallback={- <div class="size-4 text-ink-muted">- <ChannelIcon />- </div>- }+ <ContextMenu>+ <ContextMenu.Trigger class="w-full">+ <Button+ as={'a'}+ href={`/channel/${props.group.entityId}`}+ class="flex items-center justify-start gap-3 w-full cursor-default rounded-xs"+ draggable={false}+ variant="ghost"+ size="sm"+ classList={{+ 'opacity-0 -translate-y-2': !isVisible(),+ 'opacity-100 translate-y-0': isVisible(),+ }}+ onClick={(e) => {+ // Middle mouse handling+ if (e.button === 1) return;++ e.preventDefault();+ layout.openWithSplit(content(), {+ preferNewSplit: e.shiftKey,+ referredFrom: 'sidebar',+ });+ }}>- <UserIcon- id={props.group.latestSenderId!}- size="xs"- suppressClick- showTooltip={false}+ <div class="flex-shrink-0">+ <Show+ when={props.group.isDM && props.group.latestSenderId}+ fallback={+ <div class="size-4 text-ink-muted">+ <ChannelIcon />+ </div>+ }+ >+ <UserIcon+ id={props.group.latestSenderId!}+ size="xs"+ suppressClick+ showTooltip={false}+ />+ </Show>+ </div>++ <span class="text-sm font-medium text-ink truncate">+ {displayName()}+ </span>++ <Show when={count() > 0}>+ <span class="flex-shrink-0 min-w-5 h-5 px-1.5 flex items-center justify-center text-xs font-medium bg-accent/10 text-accent rounded ml-auto">+ {count()}+ </span>+ </Show>+ </Button>+ </ContextMenu.Trigger>++ <ContextMenu.Portal>+ <ContextMenuContent class="text-xs text-ink-muted">+ <MenuItem+ text="Open in new split"+ onClick={openInNewSplit}+ disabled={!canOpenInNewSplit()}/>- </Show>- </div>-- <span class="text-sm font-medium text-ink truncate">{displayName()}</span>-- <Show when={count() > 0}>- <span class="flex-shrink-0 min-w-5 h-5 px-1.5 flex items-center justify-center text-xs font-medium bg-accent/10 text-accent rounded ml-auto">- {count()}- </span>- </Show>- </Button>+ <MenuItem text="Open fullscreen" onClick={openFullscreen} />+ <MenuItem text="Open in current split" onClick={openInCurrentSplit} />+ </ContextMenuContent>+ </ContextMenu.Portal>+ </ContextMenu>);}