Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(sidebar): improve unread channels, call ui, create dropdown (#4412)

Seamus4b435aeb0ba7
diff --git a/js/app/packages/app/component/GlobalHotkeys.tsx b/js/app/packages/app/component/GlobalHotkeys.tsx
index 7792543506..46bad0524d 100644
--- a/js/app/packages/app/component/GlobalHotkeys.tsx
+++ b/js/app/packages/app/component/GlobalHotkeys.tsx
@@ -2,6 +2,7 @@ import { useAnalytics } from '@app/component/analytics-context';
import {
COMMAND_MENU_CATEGORY_LEADER_KEY,
COMMAND_MENU_CATEGORY_SCOPE,
+ CREATE_MENU_COMMAND_SCOPE,
} from '@app/constants/hotkeys';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useSubscribeToKeypress } from '@app/signal/hotkeyRoot';
@@ -143,7 +144,7 @@ export default function GlobalShortcuts() {
CommandState.toggle();
};
- const createScope = registerHotkey({
+ registerHotkey({
hotkeyToken: TOKENS.global.createCommand,
hotkey: 'c',
scopeId: 'global',
@@ -159,7 +160,7 @@ export default function GlobalShortcuts() {
return true;
},
displayPriority: 10,
- activateCommandScope: true,
+ activateCommandScopeId: CREATE_MENU_COMMAND_SCOPE,
surfaceNestedCommands: true,
keywords: ['new', 'make', 'add'],
icon: Plus,
@@ -169,7 +170,7 @@ export default function GlobalShortcuts() {
registerHotkey({
hotkeyToken: item.hotkeyToken,
hotkey: item.hotkey,
- scopeId: createScope.commandScopeId,
+ scopeId: CREATE_MENU_COMMAND_SCOPE,
description: item.description,
condition: () =>
(item.condition?.() ?? true) &&
@@ -180,10 +181,21 @@ export default function GlobalShortcuts() {
keywords: item.keywords,
hide: () => item.blockName === 'snippet' && !snippetsFlag().enabled,
runWithInputFocused: true,
- proxiedHotkey: true,
});
});
+ registerHotkey({
+ hotkey: ['c', 'escape'],
+ scopeId: CREATE_MENU_COMMAND_SCOPE,
+ description: 'Close Create',
+ condition: createMenuOpen,
+ keyDownHandler: () => {
+ setCreateMenuOpen(false);
+ return true;
+ },
+ runWithInputFocused: true,
+ });
+
registerHotkey({
hotkeyToken: TOKENS.global.commandMenu,
hotkey: 'cmd+k',
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.tsx
index 0914ec0649..fa8d1f889e 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
@@ -10,13 +10,15 @@ import { openNotification } from '@notifications';
import { isChannelNotification } from '@notifications/notification-helpers';
import { getChannelNotificationParams } from '@notifications/notification-navigation';
import type { UnifiedNotification } from '@notifications/types';
-import { Avatar, Button, cn, Tooltip } from '@ui';
+import { createElementSize } from '@solid-primitives/resize-observer';
+import { Avatar, cn, NavRow, Tooltip } from '@ui';
import {
createEffect,
createMemo,
createSignal,
For,
on,
+ onCleanup,
onMount,
Show,
} from 'solid-js';
@@ -69,7 +71,7 @@ function computeChannelLetters(groups: ChannelGroup[]): Map<string, string> {
return result;
}
-function ChannelLetterIcon(props: { letters: string }) {
+function ChannelLetterIcon(props: { letters: string; slim?: boolean }) {
return (
<Avatar size="md" class="bg-ink-extra-muted/15 text-ink-muted">
<Avatar.Fallback>{props.letters}</Avatar.Fallback>
@@ -186,16 +188,11 @@ function ChannelGroupItem(props: {
const isSlim = () => props.isSlim ?? false;
const ButtonContent = () => (
- <Button
+ <NavRow
class={cn(
- 'flex items-center cursor-default rounded-md text-ink-extra-muted not-disabled:hover:bg-ink/3',
- isSlim()
- ? 'justify-center size-8'
- : 'justify-start gap-2 w-full h-8 py-1'
+ 'transition-[opacity,transform] justify-start gap-2 w-full h-8 p-1.25'
)}
draggable={false}
- variant="ghost"
- size="sm"
classList={{
'opacity-0 -translate-y-2': !isVisible(),
'opacity-100 translate-y-0': isVisible(),
@@ -206,14 +203,21 @@ function ChannelGroupItem(props: {
navigateToLatestNotification(e.shiftKey);
}}
>
- <div class="relative flex items-center justify-center shrink-0 size-5">
+ <div
+ class={cn('relative flex items-center justify-center shrink-0 size-5')}
+ >
<Show
when={isDM() && senderId()}
- fallback={<ChannelLetterIcon letters={props.channelLetters ?? '?'} />}
+ fallback={
+ <ChannelLetterIcon
+ letters={props.channelLetters ?? '?'}
+ slim={isSlim()}
+ />
+ }
>
<UserIcon
id={senderId()!}
- size="md"
+ size={'md'}
suppressClick
showTooltip={false}
/>
@@ -232,12 +236,14 @@ function ChannelGroupItem(props: {
</span>
</Show>
</Show>
- </Button>
+ </NavRow>
);
return (
<ContextMenu>
- <ContextMenu.Trigger class="w-full">
+ <ContextMenu.Trigger
+ class={cn(isSlim() ? 'flex justify-center' : 'w-full')}
+ >
<Show
when={!isSlim()}
fallback={
@@ -319,13 +325,85 @@ export const ChannelsUnreadWidget = (props: { sidebarState: SidebarState }) => {
const SLIM_MAX = 4;
const slimVisible = () => channelGroups().slice(0, SLIM_MAX);
const slimOverflow = () => Math.max(0, channelGroups().length - SLIM_MAX);
+ const [hasOverflowTop, setHasOverflowTop] = createSignal(false);
+ const [hasOverflowBottom, setHasOverflowBottom] = createSignal(false);
+ const [scrollRef, setScrollRef] = createSignal<HTMLDivElement>();
+ const [scrollFrameRef, setScrollFrameRef] = createSignal<HTMLDivElement>();
+ const scrollSize = createElementSize(scrollRef);
+ const scrollFrameSize = createElementSize(scrollFrameRef);
+ let scrollShadowFrame: number | undefined;
+ let detachScrollShadowObservers: VoidFunction | undefined;
+
+ const updateScrollShadows = () => {
+ const el = scrollRef();
+ if (!el) return;
+ const maxScrollTop = el.scrollHeight - el.clientHeight;
+ setHasOverflowTop(el.scrollTop > 1);
+ setHasOverflowBottom(maxScrollTop - el.scrollTop > 1);
+ };
+
+ const scheduleScrollShadowUpdate = () => {
+ if (scrollShadowFrame !== undefined) {
+ cancelAnimationFrame(scrollShadowFrame);
+ }
+ scrollShadowFrame = requestAnimationFrame(() => {
+ scrollShadowFrame = undefined;
+ updateScrollShadows();
+ });
+ };
+
+ const detachScrollObservers = () => {
+ detachScrollShadowObservers?.();
+ detachScrollShadowObservers = undefined;
+ };
+
+ const attachScrollEl = (el: HTMLDivElement) => {
+ detachScrollObservers();
+ setScrollRef(el);
+
+ const mutationObserver = new MutationObserver(scheduleScrollShadowUpdate);
+ const sidebarRoot = el.closest('[data-expanded]');
+
+ mutationObserver.observe(sidebarRoot ?? el, {
+ childList: true,
+ subtree: true,
+ characterData: true,
+ });
+
+ scheduleScrollShadowUpdate();
+
+ detachScrollShadowObservers = () => {
+ mutationObserver.disconnect();
+ };
+ };
+
+ onCleanup(() => {
+ detachScrollObservers();
+ if (scrollShadowFrame !== undefined) {
+ cancelAnimationFrame(scrollShadowFrame);
+ }
+ });
+
+ createEffect(
+ on(channelGroups, () => {
+ scheduleScrollShadowUpdate();
+ })
+ );
+
+ createEffect(() => {
+ scrollSize.width;
+ scrollSize.height;
+ scrollFrameSize.width;
+ scrollFrameSize.height;
+ scheduleScrollShadowUpdate();
+ });
return (
<Show when={channelGroups().length > 0}>
<Show
when={!isSlim()}
fallback={
- <section class="w-full p-2 flex flex-col items-center">
+ <section class="w-full py-1.5 flex flex-col items-start gap-0.5">
<For each={slimVisible()}>
{(group) => (
<ChannelGroupItem
@@ -337,28 +415,46 @@ export const ChannelsUnreadWidget = (props: { sidebarState: SidebarState }) => {
)}
</For>
<Show when={slimOverflow() > 0}>
- <span class="text-xxs text-ink-muted mt-1">
+ <span class="w-full text-center text-xxs text-ink-muted mt-1">
+{slimOverflow()}
</span>
</Show>
</section>
}
>
- <section class="size-full flex flex-col justify-center px-2 py-1.5">
- <header class="text-xs font-medium text-ink-muted ml-2 mb-1">
+ <section class="size-full min-h-0 flex flex-col px-0 py-1.5">
+ <header class="shrink-0 text-xs font-medium text-ink-extra-muted/50 my-1 px-1">
<h1>Unread</h1>
</header>
- <div class="flex-1">
- <For each={channelGroups()}>
- {(group) => (
- <ChannelGroupItem
- group={group}
- animate={false}
- channelLetters={channelLettersMap().get(group.entityId)}
- />
+ <div ref={setScrollFrameRef} class="relative min-h-0 flex-1">
+ <div
+ ref={attachScrollEl}
+ onScroll={updateScrollShadows}
+ class="size-full overflow-y-auto overscroll-contain flex flex-col gap-0.5 pr-1 -mr-1"
+ >
+ <For each={channelGroups()}>
+ {(group) => (
+ <ChannelGroupItem
+ group={group}
+ animate={false}
+ channelLetters={channelLettersMap().get(group.entityId)}
+ />
+ )}
+ </For>
+ </div>
+ <div
+ class={cn(
+ 'pointer-events-none absolute inset-x-0 top-0 h-3 transition-opacity bg-gradient-to-b from-surface to-transparent',
+ hasOverflowTop() ? 'opacity-100' : 'opacity-0'
)}
- </For>
+ />
+ <div
+ class={cn(
+ 'pointer-events-none absolute inset-x-0 bottom-0 h-3 transition-opacity bg-gradient-to-t from-surface to-transparent',
+ hasOverflowBottom() ? 'opacity-100' : 'opacity-0'
+ )}
+ />
</div>
</section>
</Show>
diff --git a/js/app/packages/app/component/app-sidebar/sidebar-create-menu.tsx b/js/app/packages/app/component/app-sidebar/sidebar-create-menu.tsx
new file mode 100644
index 0000000000..098101774e
--- /dev/null
+++ b/js/app/packages/app/component/app-sidebar/sidebar-create-menu.tsx
@@ -0,0 +1,146 @@
+import { useAnalytics } from '@app/component/analytics-context';
+import { CREATABLE_BLOCKS } from '@app/component/Launcher';
+import { CREATE_MENU_COMMAND_SCOPE } from '@app/constants/hotkeys';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { useHotkeyInterceptor } from '@app/signal/hotkeyRoot';
+import { getIconConfig } from '@core/component/EntityIcon';
+import {
+ ENABLE_SNIPPETS_FLAG,
+ ENABLE_SNIPPETS_OVERRIDE,
+} from '@core/constant/featureFlags';
+import { setActiveScope } from '@core/hotkey/state';
+import { TOKENS } from '@core/hotkey/tokens';
+import { activateClosestDOMScope } from '@core/hotkey/utils';
+import PlusIcon from '@phosphor/plus.svg';
+import { cn, Dropdown, Hotkey, NavRow } from '@ui';
+import { createMemo, createSignal, For, Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+
+export const SidebarCreateMenu = (props: { isSlim: () => boolean }) => {
+ const analytics = useAnalytics();
+ const [open, setOpen] = createSignal(false);
+ const [focusedIndex, setFocusedIndex] = createSignal(-1);
+ const snippetsFlag = useFeatureFlag(ENABLE_SNIPPETS_FLAG, {
+ enabledOverride: ENABLE_SNIPPETS_OVERRIDE,
+ });
+
+ const blocks = createMemo(() =>
+ CREATABLE_BLOCKS.filter(
+ (block) => block.blockName !== 'snippet' || snippetsFlag().enabled
+ )
+ );
+
+ const handleOpenChange = (nextOpen: boolean) => {
+ if (nextOpen && !open()) {
+ analytics.track('create_menu_open', { from: 'sidebar' });
+ }
+ setOpen(nextOpen);
+ if (nextOpen) {
+ setActiveScope(CREATE_MENU_COMMAND_SCOPE);
+ } else {
+ activateClosestDOMScope();
+ }
+ };
+
+ useHotkeyInterceptor((context) => {
+ if (!open() || context.eventType !== 'keydown') return false;
+
+ if (
+ context.pressedKeysString === 'c' ||
+ context.pressedKeysString === 'escape'
+ ) {
+ setOpen(false);
+ activateClosestDOMScope();
+ return true;
+ }
+
+ const matchingBlock = blocks().find((block) => {
+ const shiftedHotkey = `shift+${block.hotkey}`;
+ return (
+ context.pressedKeysString === block.hotkey ||
+ context.pressedKeysString === shiftedHotkey
+ );
+ });
+
+ if (!matchingBlock) return false;
+
+ setOpen(false);
+ matchingBlock.keyDownHandler?.(context.event);
+ activateClosestDOMScope();
+ return true;
+ });
+
+ return (
+ <Dropdown
+ open={open()}
+ onOpenChange={handleOpenChange}
+ placement="right-start"
+ gutter={8}
+ >
+ <Dropdown.Trigger
+ as={NavRow}
+ class="center h-8 bg-ink/2 ring ring-edge-muted/40"
+ fullWidth
+ tooltipPlacement="right"
+ tooltipDisabled={!props.isSlim()}
+ label="Create"
+ hotkey={TOKENS.global.createCommand}
+ onMouseDown={(e: MouseEvent) => {
+ if (e.button !== 0) return;
+ e.preventDefault();
+ }}
+ >
+ <div class="size-4 shrink-0">
+ <PlusIcon class="size-4" />
+ </div>
+ <span class="whitespace-nowrap group-data-[slim=true]/sidebar:hidden">
+ Create
+ </span>
+ <Show when={open()}>
+ <div class="text-xxs text-ink-extra-muted/50 rounded-sm ml-auto border border-ink/5 px-1.5 py-px -my-1 group-data-[slim=true]/sidebar:hidden">
+ <Hotkey token={TOKENS.global.createCommand} class="flex gap-1" />
+ </div>
+ </Show>
+ </Dropdown.Trigger>
+ <Dropdown.Content class="min-w-52">
+ <Dropdown.Group>
+ <For each={blocks()}>
+ {(block, index) => {
+ const iconConfig = getIconConfig(block.blockName);
+
+ return (
+ <Dropdown.Item
+ class="min-h-9 gap-2 px-2.5"
+ onFocus={() => setFocusedIndex(index())}
+ onMouseEnter={() => setFocusedIndex(index())}
+ onSelect={() => {
+ setOpen(false);
+ block.keyDownHandler();
+ }}
+ >
+ <div
+ class={cn(
+ 'size-4 shrink-0 flex items-center rounded-sm [&_svg]:size-4',
+ iconConfig.foreground
+ )}
+ >
+ <Dynamic
+ component={block.animatedIcon ?? block.icon}
+ triggerAnimation={focusedIndex() === index()}
+ />
+ </div>
+ <span class="flex-1 text-ink">{block.label}</span>
+ <Hotkey
+ token={block.hotkeyToken}
+ theme="subtle"
+ class="ml-6"
+ />
+ </Dropdown.Item>
+ );
+ }}
+ </For>
+ </Dropdown.Group>
+ </Dropdown.Content>
+ </Dropdown>
+ );
+};
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index c2b7c5ea1d..b452c448de 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -5,12 +5,12 @@ import {
InviteModal,
setInviteModalOpen,
} from '@app/component/app-sidebar/invite-modal';
+import { SidebarCreateMenu } from '@app/component/app-sidebar/sidebar-create-menu';
import {
SidebarPromoCard,
SidebarPromoHint,
} from '@app/component/app-sidebar/sidebar-promo';
import { InteractiveOnboardingModal } from '@app/component/interactive-onboarding/InteractiveOnboardingModal';
-import { createMenuOpen, setCreateMenuOpen } from '@app/component/Launcher';
import { buildDocumentTypeQuery } from '@app/component/next-soup/filters/configs/document-type-query';
import { getDocumentsFilterSplit } from '@app/component/next-soup/soup-view/documents-filter-controllers';
import {
@@ -74,7 +74,6 @@ import CaretDownIcon from '@phosphor/caret-down.svg';
import CaretUpIcon from '@phosphor/caret-up.svg';
import HomeIcon from '@phosphor/house.svg';
import PlayIcon from '@phosphor/play.svg';
-import PlusIcon from '@phosphor/plus.svg';
import SignOutIcon from '@phosphor/sign-out.svg';
import { useEmailLinksQuery } from '@queries/email/link';
import { debounce } from '@solid-primitives/scheduled';
@@ -200,7 +199,7 @@ const SIDEBAR_LINKS = [
export type SidebarState = 'hidden' | 'expanded' | 'slim';
/** Root sidebar `max-width` transition (see `SIDEBAR_MAX_WIDTH_TRANSITION_STYLE`). */
-const SIDEBAR_MAX_WIDTH_TRANSITION_MS = 100;
+const SIDEBAR_MAX_WIDTH_TRANSITION_MS = 120;
const SIDEBAR_MAX_WIDTH_TRANSITION_STYLE = `max-width ease-in-out ${SIDEBAR_MAX_WIDTH_TRANSITION_MS}ms`;
/**
@@ -491,15 +490,6 @@ const registerSidebarHotkeys = ({
/** Session-only signal so a hint shows after dismissal until the user acknowledges or the timer expires. */
const [premiumHintVisible, setPremiumHintVisible] = createSignal(false);
-type SidebarActionButtonProps = {
- icon: Component<{ triggerAnimation?: boolean; class?: string }>;
- onClick: (event?: MouseEvent) => void;
- disabled?: boolean | (() => boolean);
- hotkeyToken?: HotkeyToken;
- isSlim: () => boolean;
- label: string;
-};
-
type SidebarShortcutLinkProps = {
label: string;
icon: Component<{ triggerAnimation?: boolean; class?: string }>;
@@ -536,54 +526,6 @@ const SidebarShortcutLink = (props: SidebarShortcutLinkProps) => {
);
};
-/**
- * A normalised action button for the sidebar footer area.
- *
- * Mirrors the tooltip behaviour of `SidebarLink`:
- * - slim → show tooltip (label + hotkey)
- * - expanded → no tooltip (label and hotkey badge are visible inline)
- */
-const SidebarActionButton = (props: SidebarActionButtonProps) => {
- const [hovering, setHovering] = createSignal(false);
-
- const isDisabled = () =>
- typeof props.disabled === 'function'
- ? props.disabled()
- : (props.disabled ?? false);
-
- return (
- <NavRow
- class="center h-8"
- fullWidth
- tooltipPlacement="right"
- label={props.label}
- hotkey={props.hotkeyToken}
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- }}
- onClick={(event: MouseEvent) => props.onClick(event)}
- disabled={isDisabled()}
- onMouseEnter={() => setHovering(true)}
- onMouseLeave={() => setHovering(false)}
- >
- <div class="size-4 shrink-0">
- <Dynamic component={props.icon} triggerAnimation={hovering()} />
- </div>
- <span class="whitespace-nowrap group-data-[slim=true]/sidebar:hidden">
- {props.label}
- </span>
- <Show when={hovering() && props.hotkeyToken}>
- {(token) => (
- <div class="text-xxs text-ink-extra-muted/50 rounded-sm ml-auto border border-ink/5 px-1.5 py-px -my-1 group-data-[slim=true]/sidebar:hidden">
- <Hotkey token={token()} class="flex gap-1" />
- </div>
- )}
- </Show>
- </NavRow>
- );
-};
-
/**
* Compact icon-only button for the sidebar header row. Encapsulates the hover
* signal so animated icons play on hover, mirroring `SidebarActionButton`.
@@ -742,7 +684,6 @@ const DASHBOARD_LINK: SidebarItem = {
const PROMOTED_SETTINGS_TABS: SettingsTab[] = ['Mobile App', 'Agent', 'Team'];
export const AppSidebar = (props: AppSidebarProps) => {
- const analytics = useAnalytics();
const layout = useSplitLayout();
const { openSettings, setActiveTabId, settingsOpen } = useSettingsState();
const isTabAvailable = useSettingsTabAvailable();
@@ -805,14 +746,6 @@ export const AppSidebar = (props: AppSidebarProps) => {
activateClosestDOMScope();
};
- const handleCreateClick = () => {
- const willOpen = !createMenuOpen();
- if (willOpen) {
- analytics.track('create_menu_open', { from: 'sidebar' });
- }
- setCreateMenuOpen((p) => !p);
- };
-
const openSettingsTab = (tab: SettingsTab) => {
if (!isTabAvailable(tab)) return;
if (settingsOpen()) {
@@ -850,7 +783,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
class={cn(
'group/sidebar h-full p-3 flex flex-col gap-0 mobile:absolute mobile:z-modal-content overflow-hidden',
isExpanded() &&
- 'max-w-48 w-full mobile:max-w-2/3 translate-x-0 opacity-100',
+ 'max-w-52 w-full mobile:max-w-2/3 translate-x-0 opacity-100',
props.sidebarState === 'hidden' &&
'-translate-x-full overflow-hidden opacity-0',
@@ -860,36 +793,27 @@ export const AppSidebar = (props: AppSidebarProps) => {
data-slim={isSlim()}
style={{ transition: SIDEBAR_MAX_WIDTH_TRANSITION_STYLE }}
>
- <div class="flex items-center justify-between relative">
- <div class="flex items-center group/logo-area w-full group-data-[slim=true]/sidebar:justify-end">
- <div class="text-accent group-data-[slim=true]/sidebar:opacity-0 group-data-[slim=true]/sidebar:max-w-0 min-w-0 pl-1 group-data-[slim=true]/sidebar:pl-0 transition-opacity">
- <LogoIcon class="size-6" />
- </div>
- <div class="grow shrink-10 min-w-0 group-data-[slim=true]/sidebar:hidden" />
- <SidebarHeaderIconButton
- label={isExpanded() ? 'Shrink Sidebar' : 'Expand Sidebar'}
- hotkey={TOKENS.global.toggleSidebar}
- onMouseDown={(e) => {
- if (e.button !== 0) return;
- e.preventDefault();
- }}
- onClick={() => {
- handleSidebarOpenChange(!isExpanded());
- globalSplitManager()?.returnFocus();
- }}
- icon={AnimatedSquareSidebarIcon}
- />
+ <div class="flex items-center justify-between w-full relative group/logo-area">
+ <div class="text-accent group-data-[slim=true]/sidebar:opacity-0 group-data-[slim=true]/sidebar:max-w-0 min-w-0 pl-1 group-data-[slim=true]/sidebar:pl-0 transition-[opacity,padding]">
+ <LogoIcon class="size-6 translate-x-1" />
</div>
+ <SidebarHeaderIconButton
+ label={isExpanded() ? 'Shrink Sidebar' : 'Expand Sidebar'}
+ hotkey={TOKENS.global.toggleSidebar}
+ onMouseDown={(e) => {
+ if (e.button !== 0) return;
+ e.preventDefault();
+ }}
+ onClick={() => {
+ handleSidebarOpenChange(!isExpanded());
+ globalSplitManager()?.returnFocus();
+ }}
+ icon={AnimatedSquareSidebarIcon}
+ />
</div>
- <div class="w-full mb-2">
- <SidebarActionButton
- label="Create"
- hotkeyToken={TOKENS.global.createCommand}
- isSlim={isSlim}
- onClick={handleCreateClick}
- icon={() => <PlusIcon class="size-4" />}
- />
+ <div class="w-full my-2.5">
+ <SidebarCreateMenu isSlim={isSlim} />
</div>
<nav>
@@ -913,7 +837,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
<hr class="border-transparent my-2" />
</div>
- <div class="block max-h-[clamp(10%,60%,20rem)]">
+ <div class="min-h-0 flex-1 overflow-hidden">
<ChannelsUnreadWidget sidebarState={props.sidebarState ?? 'expanded'} />
</div>
@@ -927,7 +851,7 @@ export const AppSidebar = (props: AppSidebarProps) => {
</Show>
<Show when={callCtx?.isInCall()}>
- <div class="px-2 mb-2" data-ui="in-call-panel">
+ <div class="my-3" data-ui="in-call-panel">
<InCallPanel isSlim={panelIsSlim} />
</div>
</Show>
@@ -1337,12 +1261,12 @@ const SidebarMailLink = (props: SidebarLinkProps) => {
class="grid w-full transition-[grid-template-rows] duration-200 ease-out"
style={{ 'grid-template-rows': expanded() ? '1fr' : '0fr' }}
>
- <ul class="min-h-0 overflow-hidden flex flex-col gap-1">
+ <ul class="min-h-0 overflow-hidden flex flex-col gap-0.5">
<For each={links()}>
{(link, index) => (
<li
class={cn(
- 'flex items-center justify-center first:mt-1 transition-[opacity,transform] duration-200 ease-out',
+ 'flex items-center justify-center first:mt-0.5 transition-[opacity,transform] duration-200 ease-out',
expanded()
? 'opacity-100 translate-y-0'
: 'opacity-0 -translate-y-2'
@@ -1353,17 +1277,13 @@ const SidebarMailLink = (props: SidebarLinkProps) => {
: '0ms',
}}
>
- <Button
+ <NavRow
draggable={false}
- variant="ghost"
disabled={!expanded()}
data-sidebar-mail-account={link.email_address}
data-active={onlySelectedId() === link.id ? '' : undefined}
- class={cn(
- 'flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-md py-1 pl-6 text-ink-extra-muted not-disabled:hover:bg-ink/3',
- onlySelectedId() === link.id &&
- 'bg-ink/6 not-disabled:hover:bg-ink/6 text-ink'
- )}
+ active={onlySelectedId() === link.id}
+ class="h-8 pl-6 pr-2"
onMouseDown={(e) => {
if (e.button !== 0) return;
e.preventDefault();
@@ -1378,7 +1298,7 @@ const SidebarMailLink = (props: SidebarLinkProps) => {
showTooltip={false}
/>
<span class="truncate">{link.email_address}</span>
- </Button>
+ </NavRow>
</li>
)}
</For>
diff --git a/js/app/packages/app/constants/hotkeys.ts b/js/app/packages/app/constants/hotkeys.ts
index e844dc1b56..5396276a83 100644
--- a/js/app/packages/app/constants/hotkeys.ts
+++ b/js/app/packages/app/constants/hotkeys.ts
@@ -14,6 +14,9 @@ export const COMMAND_MENU_CATEGORY_LEADER_KEY: ValidHotkey = 'o';
export const COMMAND_MENU_CATEGORY_SCOPE =
'command-scope-command-menu-category';
+/** Command scope for create-menu item shortcuts */
+export const CREATE_MENU_COMMAND_SCOPE = 'command-scope-create-menu';
+
// Register the global GO_TO command scope
registerScope({
parentScopeId: 'global',
@@ -28,3 +31,10 @@ registerScope({
type: 'command',
activationKeys: [COMMAND_MENU_CATEGORY_LEADER_KEY],
});
+
+registerScope({
+ parentScopeId: 'global',
+ scopeId: CREATE_MENU_COMMAND_SCOPE,
+ type: 'command',
+ activationKeys: ['c'],
+});