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.

style(md/task): properties sidepanel (#3281)

Seamus14580d8b14ae
diff --git a/js/app/packages/app/component/side-panel/SidePanel.tsx b/js/app/packages/app/component/side-panel/SidePanel.tsx
index 43a0acc68b..7fafc18dcd 100644
--- a/js/app/packages/app/component/side-panel/SidePanel.tsx
+++ b/js/app/packages/app/component/side-panel/SidePanel.tsx
@@ -2,10 +2,11 @@ import { Resize, ResizeZoneContext } from '@core/component/Resize/Resize';
import { isMobile } from '@core/mobile/isMobile';
import CaretRight from '@icon/fill/caret-right-fill.svg';
import { Accordion } from '@kobalte/core/accordion';
-import { Panel, Scroll } from '@ui';
+import { cn, Layer, Panel, Scroll } from '@ui';
import {
type Accessor,
children,
+ createEffect,
createMemo,
createSignal,
For,
@@ -13,6 +14,7 @@ import {
onCleanup,
onMount,
type ParentProps,
+ type Setter,
Show,
Suspense,
useContext,
@@ -25,29 +27,42 @@ import {
const NARROW_THRESHOLD_PX = 720;
const SIDE_MIN_PX = 320;
-const SIDE_MAX_PX = 480;
+const SIDE_MAX_PX = 440;
const MAIN_MIN_PX = 320;
/**
* Layout root for a block that opts in to a right-side panel.
*
- * Wraps `props.children` in a horizontal Resize.Zone with two panels:
- * a main panel (the children) and a right side panel that hosts any
- * `<SidePanel.Section>` descendants registered via context.
+ * Wraps `props.children` in a horizontal Resize.Zone with a main panel
+ * (the children) and a side panel that hosts any `<SidePanel.Section>`
+ * descendants registered via context.
*
- * The side panel is hidden when:
- * - on mobile (`isMobile()`),
- * - the layout root is narrower than NARROW_THRESHOLD_PX,
- * - no sections are currently registered, OR
- * - the user has toggled it closed via `ctx.setIsOpen(false)`.
+ * Two rendering modes based on available width:
+ * - Wide (>= NARROW_THRESHOLD_PX, non-mobile): side panel renders as a
+ * resizable split next to the main content. Defaults to open.
+ * - Narrow (mobile or narrower than threshold): side panel renders as a
+ * full-screen overlay covering the main content. Defaults to closed;
+ * the main content stays mounted underneath.
+ *
+ * The side panel is suppressed entirely when no sections are registered.
*
* Sections are rendered as a Kobalte Accordion in JSX-declared order.
*/
function Layout(props: ParentProps) {
const [sections, setSections] = createSignal<SidePanelSectionEntry[]>([]);
const [openIds, setOpenIds] = createSignal<string[]>([]);
- const [isOpen, setIsOpen] = createSignal(true);
+ // Independent open state per mode so wide and narrow can have different
+ // defaults (and the user's preference in one mode doesn't bleed into the
+ // other after a resize).
+ const [isWideOpen, setIsWideOpen] = createSignal(true);
+ const [isNarrowOpen, setIsNarrowOpen] = createSignal(false);
+ const [isNarrow, setIsNarrow] = createSignal(isMobile());
+ const isOpen = () => (isNarrow() ? isNarrowOpen() : isWideOpen());
+ const setIsOpen = (next: boolean | ((prev: boolean) => boolean)) => {
+ const setter = isNarrow() ? setIsNarrowOpen : setIsWideOpen;
+ setter(typeof next === 'function' ? next : () => next);
+ };
const toggle = () => setIsOpen((prev) => !prev);
const register = (entry: SidePanelSectionEntry) => {
@@ -68,23 +83,28 @@ function Layout(props: ParentProps) {
setOpenIds((prev) => prev.filter((v) => v !== id));
};
+ const hasSections = createMemo(() => sections().length > 0);
+
const ctx: SidePanelContextType = {
register,
unregister,
sections,
+ hasSections,
isOpen,
setIsOpen,
toggle,
+ isNarrow,
};
return (
<SidePanelContext.Provider value={ctx}>
- <Resize.Zone direction="horizontal" gutter={0}>
+ <Resize.Zone direction="horizontal" gutter={0} resizable={false}>
<SidePanelLayoutInner
sections={sections}
openIds={openIds}
setOpenIds={setOpenIds}
isOpen={isOpen}
+ setIsNarrow={setIsNarrow}
>
{props.children}
</SidePanelLayoutInner>
@@ -99,20 +119,28 @@ function SidePanelLayoutInner(
openIds: Accessor<string[]>;
setOpenIds: (ids: string[]) => void;
isOpen: Accessor<boolean>;
+ setIsNarrow: Setter<boolean>;
}>
) {
const resolved = children(() => props.children);
const zoneCtx = useContext(ResizeZoneContext);
+
if (!zoneCtx) {
throw new Error('SidePanelLayoutInner must be rendered inside Resize.Zone');
}
- const isNarrow = createMemo(() => zoneCtx.size() < NARROW_THRESHOLD_PX);
+ const isNarrow = createMemo(
+ () => isMobile() || zoneCtx.size() < NARROW_THRESHOLD_PX
+ );
const hasSections = createMemo(() => props.sections().length > 0);
- // Panel should be hidden if: mobile, narrow, no sections, OR user toggled it closed
- const shouldHide = createMemo(
- () => isMobile() || isNarrow() || !hasSections() || !props.isOpen()
+ createEffect(() => props.setIsNarrow(isNarrow()));
+
+ const showSplit = createMemo(
+ () => !isNarrow() && hasSections() && props.isOpen()
+ );
+ const showOverlay = createMemo(
+ () => isNarrow() && hasSections() && props.isOpen()
);
return (
@@ -120,7 +148,7 @@ function SidePanelLayoutInner(
<Resize.Panel id="side-panel-main" minSize={MAIN_MIN_PX} index={0}>
{resolved()}
</Resize.Panel>
- <Show when={!shouldHide()}>
+ <Show when={showSplit()}>
<Resize.Panel
id="side-panel-side"
minSize={SIDE_MIN_PX}
@@ -134,6 +162,15 @@ function SidePanelLayoutInner(
/>
</Resize.Panel>
</Show>
+ <Show when={showOverlay()}>
+ <div class="absolute inset-0 z-10 flex flex-col bg-surface">
+ <SidePanelOutlet
+ sections={props.sections}
+ openIds={props.openIds}
+ setOpenIds={props.setOpenIds}
+ />
+ </div>
+ </Show>
</>
);
}
@@ -143,6 +180,16 @@ function SidePanelOutlet(props: {
openIds: Accessor<string[]>;
setOpenIds: (ids: string[]) => void;
}) {
+ // Sort by `order` ascending; sections without an explicit order go after
+ // ordered ones, preserving registration order via the stable sort.
+ const sortedSections = createMemo(() =>
+ [...props.sections()].sort((a, b) => {
+ const ao = a.order ?? Number.MAX_SAFE_INTEGER;
+ const bo = b.order ?? Number.MAX_SAFE_INTEGER;
+ return ao - bo;
+ })
+ );
+
return (
<Scroll class="flex flex-col min-h-0">
<Accordion
@@ -152,7 +199,7 @@ function SidePanelOutlet(props: {
onChange={(value) => props.setOpenIds(value as string[])}
class="p-2 flex flex-col gap-2 min-h-0"
>
- <For each={props.sections()}>{(section) => section.component()}</For>
+ <For each={sortedSections()}>{(section) => section.component()}</For>
</Accordion>
</Scroll>
);
@@ -170,8 +217,10 @@ function SidePanelOutlet(props: {
function Section(
props: ParentProps<{
id: string;
- title: string;
+ title: JSX.Element;
defaultOpen?: boolean;
+ /** Render order — lower numbers appear first. */
+ order?: number;
}>
) {
const ctx = useContext(SidePanelContext);
@@ -184,6 +233,7 @@ function Section(
id: props.id,
title: props.title,
defaultOpen: props.defaultOpen ?? false,
+ order: props.order,
component: () => (
<Accordion.Item value={props.id}>
<Panel
@@ -223,9 +273,61 @@ function useSidePanel() {
isOpen: ctx.isOpen,
setIsOpen: ctx.setIsOpen,
toggle: ctx.toggle,
+ isNarrow: ctx.isNarrow,
+ hasSections: ctx.hasSections,
};
}
+/**
+ * Pill-style tabs that switch between the main content and the side panel
+ * overlay in narrow mode. Renders nothing when the layout is wide or when no
+ * sections are registered, so it's safe to mount unconditionally.
+ */
+function NarrowTabs(props: { contentLabel?: string; infoLabel?: string }) {
+ const ctx = useContext(SidePanelContext);
+ if (!ctx) return null;
+ return (
+ <Show when={ctx.isNarrow() && ctx.hasSections()}>
+ <Layer depth={0}>
+ <div class="flex items-center shrink-0 bg-edge-muted p-0.5 rounded-sm">
+ <Layer depth={3}>
+ <NarrowTab
+ active={!ctx.isOpen()}
+ label={props.contentLabel ?? 'Content'}
+ onClick={() => ctx.setIsOpen(false)}
+ />
+ <NarrowTab
+ active={ctx.isOpen()}
+ label={props.infoLabel ?? 'Info'}
+ onClick={() => ctx.setIsOpen(true)}
+ />
+ </Layer>
+ </div>
+ </Layer>
+ </Show>
+ );
+}
+
+function NarrowTab(props: {
+ active: boolean;
+ label: string;
+ onClick: () => void;
+}) {
+ return (
+ <button
+ type="button"
+ aria-pressed={props.active}
+ onClick={props.onClick}
+ class={cn(
+ 'text-xs px-2.5 py-0.5 rounded-xs transition-colors',
+ props.active ? 'bg-surface text-ink' : 'text-ink-muted hover:text-ink'
+ )}
+ >
+ {props.label}
+ </button>
+ );
+}
+
/** Indicates whether the current subtree has a SidePanel.Layout ancestor. */
function useHasSidePanel(): boolean {
return useContext(SidePanelContext) !== undefined;
@@ -244,5 +346,5 @@ function Row(props: ParentProps<{ label: JSX.Element }>) {
);
}
-export const SidePanel = { Layout, Section, Row };
+export const SidePanel = { Layout, Section, Row, NarrowTabs };
export { useHasSidePanel, useSidePanel };
diff --git a/js/app/packages/app/component/side-panel/context.ts b/js/app/packages/app/component/side-panel/context.ts
index c2f6afe45a..0346120086 100644
--- a/js/app/packages/app/component/side-panel/context.ts
+++ b/js/app/packages/app/component/side-panel/context.ts
@@ -1,9 +1,14 @@
-import { type Accessor, createContext, type JSX, type Setter } from 'solid-js';
+import { type Accessor, createContext, type JSX } from 'solid-js';
export type SidePanelSectionEntry = {
id: string;
- title: string;
+ title: JSX.Element;
defaultOpen: boolean;
+ /**
+ * Render order — lower numbers appear first. Sections without an explicit
+ * order render after ordered ones, in their registration order.
+ */
+ order?: number;
component: () => JSX.Element;
};
@@ -11,12 +16,23 @@ export type SidePanelContextType = {
register: (entry: SidePanelSectionEntry) => void;
unregister: (id: string) => void;
sections: Accessor<SidePanelSectionEntry[]>;
- /** Whether the side panel is open (user-toggled state) */
+ /** True when at least one section is registered. */
+ hasSections: Accessor<boolean>;
+ /**
+ * Whether the side panel is open for the current layout mode.
+ * In wide mode this controls the split; in narrow mode it controls the overlay.
+ */
isOpen: Accessor<boolean>;
- /** Set the open state of the side panel */
- setIsOpen: Setter<boolean>;
- /** Toggle the side panel open/closed */
+ /** Set the open state for the current layout mode. */
+ setIsOpen: (next: boolean | ((prev: boolean) => boolean)) => void;
+ /** Toggle the open state for the current layout mode. */
toggle: () => void;
+ /**
+ * True when the layout is mobile or narrower than the split threshold.
+ * In this mode the side panel renders as a full-screen overlay rather than
+ * a side-by-side split.
+ */
+ isNarrow: Accessor<boolean>;
};
export const SidePanelContext = createContext<SidePanelContextType>();
diff --git a/js/app/packages/app/component/split-layout/components/SplitFileMenu.tsx b/js/app/packages/app/component/split-layout/components/SplitFileMenu.tsx
index 397cb3eecf..ef208be99b 100644
--- a/js/app/packages/app/component/split-layout/components/SplitFileMenu.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitFileMenu.tsx
@@ -199,7 +199,7 @@ export function SplitFileMenu(props: {
</ResponsiveDropdown.Trigger>
<ResponsiveDropdown.Portal>
<Layer depth={2}>
- <ResponsiveDropdown.Content class="bg-surface w-fit p-1 border border-edge-muted rounded-xs shadow">
+ <ResponsiveDropdown.Content class="bg-surface w-fit p-1 border border-edge-muted rounded shadow">
<For each={ops()}>
{(op, i) => (
<>
diff --git a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
index 1d1abc44ec..046add1362 100644
--- a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx
@@ -6,7 +6,6 @@ import {
} from '@core/constant/featureFlags';
import { TOKENS } from '@core/hotkey/tokens';
import { isMobile } from '@core/mobile/isMobile';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
import CollapseIcon from '@icon/regular/arrows-in.svg';
import ExpandIcon from '@icon/regular/arrows-out.svg';
import CaretLeft from '@icon/regular/caret-left.svg';
@@ -60,7 +59,7 @@ function SplitForwardButton() {
);
}
-function SplitSpotlightButton() {
+function _SplitSpotlightButton() {
const context = useContext(SplitPanelContext);
const layout = useContext(SplitLayoutContext);
if (!context || !layout) return '';
@@ -158,10 +157,6 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
const panel = useContext(SplitPanelContext);
if (!panel)
throw new Error('<SplitHeader> must be used within a <SplitLayout>');
- const layout = useContext(SplitLayoutContext);
-
- const shouldShowRightmost = () =>
- !isTouchDevice() && layout && canSpotlight(layout.manager);
return (
<div
@@ -170,7 +165,7 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
ref={props.ref}
>
<div class="absolute inset-0 flex justify-start items-center bg-surface">
- <div class="z-annotation-layer relative flex items-center bg-surface pl-2 mobile:pl-0 h-full">
+ <div class="relative flex items-center pl-2 mobile:pl-0 h-full">
<div class="mobile:hidden">
<SplitCloseButton />
</div>
@@ -179,6 +174,7 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
<SplitForwardButton />
</Show>
</div>
+
<div
class="relative min-w-0 h-full shrink pl-2 flex items-center gap-0.5"
ref={(ref) => {
@@ -186,7 +182,7 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
}}
/>
- <Show when={shouldShowRightmost()}>
+ {/*<Show when={shouldShowRightmost()}>
<div
class={
'pl-2 z-annotation-layer relative flex items-center gap-0.5 h-full'
@@ -194,10 +190,10 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {
>
<SplitSpotlightButton />
</div>
- </Show>
+ </Show>*/}
<div
- class="min-w-4 h-full grow shrink flex items-center justify-end gap-0.5 pl-2 pr-2"
+ class="min-w-4 h-full grow shrink flex items-center justify-end gap-0.5 px-2"
ref={(ref) => {
panel.layoutRefs.headerRight = ref;
}}
diff --git a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
index ee6addce94..779883656b 100644
--- a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
+++ b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx
@@ -172,7 +172,7 @@ export function BlockItemSplitLabel(props: {
});
return (
- <div class="ph-no-capture z-page-overlay relative flex items-center gap-2 w-screen max-w-full h-full shrink">
+ <div class="ph-no-capture z-page-overlay relative flex items-center gap-2 min-w-0 max-w-full h-full shrink">
<EntityIcon class="shrink-0" targetType={targetType()} size="xs" />
<Show when={props.badges}>{props.badges}</Show>
<SplitLabel
diff --git a/js/app/packages/block-md/comments/CommentMargin.tsx b/js/app/packages/block-md/comments/CommentMargin.tsx
index 8bef360691..7a090e013a 100644
--- a/js/app/packages/block-md/comments/CommentMargin.tsx
+++ b/js/app/packages/block-md/comments/CommentMargin.tsx
@@ -4,7 +4,6 @@ import {
commentWidthSignal,
highlightedCommentIdSignal,
highlightedCommentThreadsSignal,
- showCommentsPreference,
threadStore,
} from '@block-md/comments/commentStore';
import { useBlockId } from '@core/block';
@@ -116,9 +115,7 @@ export const CommentMargin = () => {
const commentsContext = useCommentsContext();
- const isMinimized = createMemo(() => {
- return !(wideEnoughForComments() && showCommentsPreference());
- });
+ const isMinimized = createMemo(() => !wideEnoughForComments());
return (
<CommentsContext.Provider value={commentsContext}>
diff --git a/js/app/packages/block-md/comments/commentStore.ts b/js/app/packages/block-md/comments/commentStore.ts
index 83b14a1685..227f2487b4 100644
--- a/js/app/packages/block-md/comments/commentStore.ts
+++ b/js/app/packages/block-md/comments/commentStore.ts
@@ -1,7 +1,5 @@
import { createBlockSignal, createBlockStore } from '@core/block';
-import { makePersisted } from '@solid-primitives/storage';
import type { NodeKey } from 'lexical';
-import { createSignal } from 'solid-js';
import type { CommentStore, MarkStore, ThreadStore } from './commentType';
interface PendingComment {
@@ -31,6 +29,3 @@ export const highlightedCommentThreadsSignal = createBlockSignal<number[]>([]);
export const pendingCommentSignal = createBlockSignal<PendingComment[]>([]);
export const commentWidthSignal = createBlockSignal(true);
-
-export const [showCommentsPreference, setShowCommentsPreference] =
- makePersisted(createSignal(true), { name: 'showMdCommentsPreference' });
diff --git a/js/app/packages/block-md/component/DispatchAgentMenu.tsx b/js/app/packages/block-md/component/DispatchAgentMenu.tsx
index 249b9ea818..52c4586bda 100644
--- a/js/app/packages/block-md/component/DispatchAgentMenu.tsx
+++ b/js/app/packages/block-md/component/DispatchAgentMenu.tsx
@@ -3,11 +3,14 @@ import { useBlockId } from '@core/block';
import { editorStateAsMarkdown } from '@core/component/LexicalMarkdown/utils';
import { DropdownMenuContent, MenuItem } from '@core/component/Menu';
import { toast } from '@core/component/Toast/Toast';
+import { TOKENS } from '@core/hotkey/tokens';
import { macroIdToEmail, tryMacroId } from '@core/user';
+import { copyBranchNameToClipboard } from '@core/util/branchName';
import { useBlockDocumentName } from '@core/util/currentBlockDocumentName';
import { isOk } from '@core/util/maybeResult';
import CaretDown from '@icon/regular/caret-down.svg';
import CopyIcon from '@icon/regular/copy.svg';
+import GitBranch from '@icon/regular/git-branch.svg';
import PlugIcon from '@icon/regular/plug.svg';
import TerminalWindowIcon from '@icon/regular/terminal-window.svg';
import { DropdownMenu } from '@kobalte/core/dropdown-menu';
@@ -219,6 +222,15 @@ export function DispatchAgentButton() {
icon={COPY_ACTION.icon}
onClick={() => executeAction(COPY_ACTION)}
/>
+ <MenuItem
+ text="Copy branch name"
+ icon={GitBranch}
+ hotkeyToken={TOKENS.entity.action.copyBranchName}
+ onClick={() => {
+ copyBranchNameToClipboard(blockId);
+ setOpen(false);
+ }}
+ />
<MenuItem
text="MCP setup instructions"
icon={PlugIcon}
diff --git a/js/app/packages/block-md/component/Notebook.tsx b/js/app/packages/block-md/component/Notebook.tsx
index 3d838cf194..7ef4db09cb 100644
--- a/js/app/packages/block-md/component/Notebook.tsx
+++ b/js/app/packages/block-md/component/Notebook.tsx
@@ -3,7 +3,6 @@ import { CommentMargin } from '@block-md/comments/CommentMargin';
import {
commentsStore,
commentWidthSignal,
- showCommentsPreference,
} from '@block-md/comments/commentStore';
import { useGoToTempRedirect } from '@block-md/signal/location';
import { mdStore } from '@block-md/signal/markdownBlockData';
@@ -105,12 +104,7 @@ export function Notebook() {
const observeCallback = () => {
const { width, left } = notebookRef.getBoundingClientRect();
setWidth(width);
- let mode = widthToMode(width);
- if (!hasComment()) {
- mode = CommentLayoutMode.none;
- } else if (!showCommentsPreference() && width > BreaksPoints.md) {
- mode = CommentLayoutMode.sm;
- }
+ const mode = hasComment() ? widthToMode(width) : CommentLayoutMode.none;
setLayoutMode(mode);
const leftFloat =
contentRef.getBoundingClientRect().right - left + GapTargetWidth;
@@ -146,18 +140,6 @@ export function Notebook() {
}
});
- createEffect(() => {
- if (showCommentsPreference()) {
- setLayoutMode(widthToMode(untrack(width)));
- } else {
- if (untrack(width) >= BreaksPoints.sm) {
- setLayoutMode(CommentLayoutMode.sm);
- } else {
- setLayoutMode(CommentLayoutMode.xs);
- }
- }
- });
-
createEffect(() => {
if (!scopeId()) return;
untrack(() =>
diff --git a/js/app/packages/block-md/component/TopBar.tsx b/js/app/packages/block-md/component/TopBar.tsx
index 19314a4114..926362a00b 100644
--- a/js/app/packages/block-md/component/TopBar.tsx
+++ b/js/app/packages/block-md/component/TopBar.tsx
@@ -1,17 +1,15 @@
-import { useAnalytics } from '@app/component/analytics-context';
import {
ChatWithAgentButton,
ChatWithAgentIcon,
openChatWithAgent,
} from '@app/component/ChatWithAgentButton';
-import { useGlobalNotificationSource } from '@app/component/GlobalAppState';
import {
type BlockTool,
ResponsiveBlockToolbar,
ResponsivePermissionsBadge,
ToolButton,
} from '@app/component/ResponsiveBlockToolbar';
-import { useSidePanel } from '@app/component/side-panel';
+import { SidePanel, useSidePanel } from '@app/component/side-panel';
import { useDrawerControl } from '@app/component/split-layout/components/SplitDrawerContext';
import type { FileOperation } from '@app/component/split-layout/components/SplitFileMenu';
import {
@@ -22,23 +20,11 @@ import {
BlockItemSplitLabel,
StaticSplitLabel,
} from '@app/component/split-layout/components/SplitLabel';
-import {
- setShowCommentsPreference,
- showCommentsPreference,
-} from '@block-md/comments/commentStore';
+import { SplitToolbarLeft } from '@app/component/split-layout/components/SplitToolbar';
+import { useSplitPanel } from '@app/component/split-layout/layoutUtils';
import { useDownloadDocumentAsMarkdownText } from '@block-md/signal/save';
-import { useIsAuthenticated } from '@core/auth';
import { useBlockAliasedName, useBlockId, useBlockName } from '@core/block';
-import { DETAILS_DRAWER_ID } from '@core/component/DetailsDrawer';
import { BlockLiveIndicators } from '@core/component/LiveIndicators';
-import {
- NOTIFICATIONS_DRAWER_ID,
- NotificationsButton,
-} from '@core/component/NotificationsModal';
-import {
- REFERENCES_DRAWER_ID,
- ReferencesButton,
-} from '@core/component/ReferencesModal';
import { toast } from '@core/component/Toast/Toast';
import {
getShareDrawerRecipientInput,
@@ -49,48 +35,34 @@ import {
ENABLE_HISTORY_COMPONENT,
ENABLE_MARKDOWN_LIVE_COLLABORATION,
ENABLE_MARKDOWN_SIDE_PANEL,
- ENABLE_REFERENCES_MODAL,
} from '@core/constant/featureFlags';
import { registerHotkey } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
import { isMobile } from '@core/mobile/isMobile';
import { blockHotkeyScopeSignal } from '@core/signal/blockElement';
import { useCanEdit } from '@core/signal/permissions';
-import type { EntityType } from '@core/types';
import { copyBranchNameToClipboard } from '@core/util/branchName';
import { useBlockDocumentName } from '@core/util/currentBlockDocumentName';
import { buildSimpleEntityUrl } from '@core/util/url';
import SidePanelIcon from '@icon/fill/square-half-fill.svg';
-import Bell from '@icon/regular/bell.svg';
-import ShowComments from '@icon/regular/chat-circle-dots.svg';
-import HideComments from '@icon/regular/chat-circle-slash.svg';
import ClockIcon from '@icon/regular/clock-counter-clockwise.svg';
import Download from '@icon/regular/download.svg';
import GitBranch from '@icon/regular/git-branch.svg';
-import Info from '@icon/regular/info.svg';
import IconLink from '@icon/regular/link.svg';
-import Quotes from '@icon/regular/quotes.svg';
-import TagIcon from '@icon/regular/tag.svg';
import TerminalWindowIcon from '@icon/regular/terminal-window.svg';
import IconShared from '@macro-icons/wide/share.svg';
import { blockNameToItemType } from '@service-storage/client';
import { Button, cn } from '@ui';
-import { createEffect, For, type JSX, on, Show } from 'solid-js';
+import { createEffect, For, on, onCleanup, Show } from 'solid-js';
import { DispatchAgentButton } from './DispatchAgentMenu';
import { HISTORY_DRAWER_ID } from './History';
-import { DRAWER_ID as PROPERTIES_DRAWER_ID } from './MarkdownPropertiesModal';
export function TopBar() {
- const analytics = useAnalytics();
-
- const isAuth = useIsAuthenticated();
-
const canEdit = useCanEdit();
const blockName = useBlockName();
const blockId = useBlockId();
const scopeId = blockHotkeyScopeSignal.get;
const name = useBlockDocumentName();
- const notificationSource = useGlobalNotificationSource();
const itemType = blockNameToItemType(blockName);
if (!itemType)
throw new Error('Using functionality in an unknown item type.');
@@ -98,10 +70,6 @@ export function TopBar() {
const downloadAsMarkdownText = useDownloadDocumentAsMarkdownText();
const historyControl = useDrawerControl(HISTORY_DRAWER_ID);
- const notificationsControl = useDrawerControl(NOTIFICATIONS_DRAWER_ID);
- const referencesControl = useDrawerControl(REFERENCES_DRAWER_ID);
- const propertiesControl = useDrawerControl(PROPERTIES_DRAWER_ID);
- const detailsControl = useDrawerControl(DETAILS_DRAWER_ID);
const shareCtx = useShareDialogContext();
const blockAliasedName = useBlockAliasedName();
const isTask = blockAliasedName === 'task';
@@ -139,11 +107,6 @@ export function TopBar() {
}
const ops: FileOperation[] = [
- {
- label: 'Details',
- icon: Info,
- action: detailsControl.toggle,
- },
{ op: 'copy', divideAbove: true },
{ op: 'rename' },
{ op: 'moveToProject' },
@@ -166,6 +129,26 @@ export function TopBar() {
];
const sidePanel = useSidePanel();
+ const splitPanel = useSplitPanel();
+
+ // Register at the split scope so `]` works from anywhere in the split
+ // (header, toolbar, drawer), but tie disposal to this TopBar so the
+ // registration disappears with the block.
+ if (splitPanel?.splitHotkeyScope) {
+ const reg = registerHotkey({
+ hotkey: ']',
+ scopeId: splitPanel.splitHotkeyScope,
+ hotkeyToken: TOKENS.block.toggleSidePanel,
+ description: 'Toggle Side Panel',
+ keyDownHandler: () => {
+ if (!sidePanel) return false;
+ if (!sidePanel.hasSections()) return false;
+ sidePanel.toggle();
+ return true;
+ },
+ });
+ onCleanup(() => reg.dispose());
+ }
const tools: BlockTool[] = [
{
@@ -178,65 +161,13 @@ export function TopBar() {
ENABLE_HISTORY_COMPONENT &&
canEdit(),
},
- {
- label: 'Notifications',
- icon: Bell,
- action: notificationsControl.toggle,
- condition: () => !!isAuth(),
- buttonComponent: () => (
- <NotificationsButton
- entity={{ id: blockId, type: itemType as EntityType }}
- notificationSource={notificationSource}
- onOpenChange={(open) =>
- open &&
- analytics.track('notifications_panel_open', { blockType: 'md' })
- }
- />
- ),
- },
- {
- label: 'References',
- icon: Quotes,
- action: referencesControl.toggle,
- condition: () => !!isAuth() && ENABLE_REFERENCES_MODAL,
- buttonComponent: () => (
- <ReferencesButton
- documentId={blockId}
- documentName={name()}
- buttonSize="sm"
- onOpenChange={(open) =>
- open &&
- analytics.track('references_panel_open', { blockType: 'md' })
- }
- />
- ),
- },
- {
- label: () =>
- showCommentsPreference() ? 'Hide Comments' : 'Show Comments',
- icon: (props: JSX.SvgSVGAttributes<SVGSVGElement>) => (
- <Show
- when={showCommentsPreference()}
- fallback={<ShowComments {...props} />}
- >
- <HideComments {...props} />
- </Show>
- ),
- action: () => setShowCommentsPreference(!showCommentsPreference()),
- },
- {
- label: 'Copy Branch Name',
- icon: GitBranch,
- action: copyBranchName,
- condition: () => isTask,
- hotkeyToken: TOKENS.entity.action.copyBranchName,
- },
- {
- label: 'Properties',
- icon: TagIcon,
- action: propertiesControl.toggle,
- isActive: propertiesControl.isOpen,
- },
+ // {
+ // label: 'Copy Branch Name',
+ // icon: GitBranch,
+ // action: copyBranchName,
+ // condition: () => isTask,
+ // hotkeyToken: TOKENS.entity.action.copyBranchName,
+ // },
{
label: 'Dispatch to Agent',
icon: TerminalWindowIcon,
@@ -285,7 +216,8 @@ export function TopBar() {
icon: SidePanelIcon,
action: () => sidePanel?.toggle(),
isActive: () => sidePanel?.isOpen() ?? false,
- condition: () => ENABLE_MARKDOWN_SIDE_PANEL && !isMobile(),
+ condition: () =>
+ ENABLE_MARKDOWN_SIDE_PANEL && !(sidePanel?.isNarrow() ?? isMobile()),
buttonComponent: () => (
<Show when={sidePanel}>
{(panel) => (
@@ -299,6 +231,7 @@ export function TopBar() {
tooltip={
sidePanel?.isOpen() ? 'Hide Side Panel' : 'Show Side Panel'
}
+ hotkey={TOKENS.block.toggleSidePanel}
onClick={() => {
panel().toggle();
}}
@@ -332,6 +265,9 @@ export function TopBar() {
itemType={itemType}
name={name()}
/>
+ <SplitToolbarLeft>
+ <SidePanel.NarrowTabs />
+ </SplitToolbarLeft>
</>
);
}
diff --git a/js/app/packages/block-md/component/sidepanel/MarkdownSidePanelSections.tsx b/js/app/packages/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
index 133a2ac394..e5864dfe73 100644
--- a/js/app/packages/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
+++ b/js/app/packages/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
@@ -44,7 +44,6 @@ import {
createMemo,
createResource,
createSignal,
- For,
onCleanup,
Show,
Suspense,
@@ -75,25 +74,27 @@ export function MarkdownSidePanelSections(
return (
<>
- <SidePanel.Section id="details" title="Details" defaultOpen>
+ <SidePanel.Section id="details" title="Details" defaultOpen order={10}>
<DetailsSectionContent />
</SidePanel.Section>
- <SidePanel.Section id="properties" title="Properties" defaultOpen>
+ <SidePanel.Section
+ id="properties"
+ title="Properties"
+ defaultOpen
+ order={20}
+ >
<PropertiesSectionContent
canEdit={props.canEdit}
documentName={props.documentName}
/>
</SidePanel.Section>
<Show when={!isTask()}>
- <SidePanel.Section id="stats" title="Stats">
+ <SidePanel.Section id="stats" title="Stats" order={30}>
<StatsSectionContent />
</SidePanel.Section>
</Show>
<NotificationsSectionConditional entity={entity()} />
<ReferencesSectionConditional documentId={blockId} />
- <SidePanel.Section id="debug" title="Debug (Scroll Test)">
- <DebugSectionContent />
- </SidePanel.Section>
</>
);
}
@@ -469,14 +470,19 @@ function NotificationsSectionConditional(props: { entity: Entity }) {
() => notifications().filter((n) => !n.viewed_at).length
);
- const title = createMemo(() => {
- const unread = unreadCount();
- return unread > 0 ? `Notifications (${unread})` : 'Notifications';
- });
+ const title = () => (
+ <>
+ Notifications
+ <Show when={unreadCount() > 0}>
+ {' '}
+ <span class="text-ink-extra-muted">({unreadCount()})</span>
+ </Show>
+ </>
+ );
return (
<Show when={count() > 0}>
- <SidePanel.Section id="notifications" title={title()}>
+ <SidePanel.Section id="notifications" title={title()} order={40}>
<Suspense
fallback={
<div class="flex justify-center py-8">
@@ -518,14 +524,19 @@ function ReferencesSectionConditional(props: { documentId: string }) {
const count = createMemo(() => references()?.length ?? 0);
- const title = createMemo(() => {
- const c = count();
- return c > 0 ? `References (${c})` : 'References';
- });
+ const title = () => (
+ <>
+ References
+ <Show when={count() > 0}>
+ {' '}
+ <span class="text-ink-extra-muted">({count()})</span>
+ </Show>
+ </>
+ );
return (
<Show when={count() > 0}>
- <SidePanel.Section id="references" title={title()}>
+ <SidePanel.Section id="references" title={title()} order={50}>
<Suspense
fallback={
<div class="flex justify-center py-8">
@@ -539,18 +550,3 @@ function ReferencesSectionConditional(props: { documentId: string }) {
</Show>
);
}
-
-// ─────────────────────────────────────────────────────────────────────────────
-// Debug Section (for scroll testing)
-// ─────────────────────────────────────────────────────────────────────────────
-
-function DebugSectionContent() {
- const items = Array.from({ length: 50 }, (_, i) => i + 1);
- return (
- <div class="flex flex-col gap-2 text-xs text-ink-muted">
- <For each={items}>
- {(i) => <div class="p-2 bg-surface-muted rounded">Debug item {i}</div>}
- </For>
- </div>
- );
-}
diff --git a/js/app/packages/core/component/Resize/Resize.tsx b/js/app/packages/core/component/Resize/Resize.tsx
index 7533a07cd7..41760f0cb0 100644
--- a/js/app/packages/core/component/Resize/Resize.tsx
+++ b/js/app/packages/core/component/Resize/Resize.tsx
@@ -30,6 +30,7 @@ export const ResizeZoneContext = createContext<ResizeZoneCtx>();
* @property minSize - The zone-wide min size for a panel (in px). Individual panels can override.
* @property class - Optional class name for the Zone.
* @property id - Optional id for the Zone.
+ * @property resizable - Optional boolean indicating whether the zone is resizable. Defaults to true.
*/
type ZoneProps = {
direction: 'horizontal' | 'vertical';
@@ -38,6 +39,7 @@ type ZoneProps = {
class?: string;
id?: string;
captureResizeCtx?: (ctx: ResizeZoneCtx) => void;
+ resizable?: boolean;
};
/**
@@ -142,6 +144,8 @@ function Zone(props: ParentProps<ZoneProps>) {
props.captureResizeCtx?.(ctx);
});
+ const gutterEnabled = () => Boolean(props.resizable ?? true);
+
return (
<div
class={props.class ?? ''}
@@ -155,7 +159,7 @@ function Zone(props: ParentProps<ZoneProps>) {
>
<ResizeZoneContext.Provider value={ctx}>
{props.children}
- <Show when={visibleLayouts().length > 1}>
+ <Show when={gutterEnabled() && visibleLayouts().length > 1}>
<Index each={visibleLayouts()}>
{(panel, visibleIndex) => {
const actualIndex = solver.order().indexOf(panel().id);
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index e944f444be..f1df0a5543 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -347,5 +347,5 @@ export const ENABLE_CALLKIT = resolveFeatureFlag('ENABLE_CALLKIT', false);
export const ENABLE_MARKDOWN_SIDE_PANEL = resolveFeatureFlag(
'ENABLE_MARKDOWN_SIDE_PANEL',
- false
+ true
);
diff --git a/js/app/packages/core/hotkey/tokens.ts b/js/app/packages/core/hotkey/tokens.ts
index 57f59cb551..ae1f2e7969 100644
--- a/js/app/packages/core/hotkey/tokens.ts
+++ b/js/app/packages/core/hotkey/tokens.ts
@@ -249,6 +249,7 @@ export const TOKENS = {
block: {
share: 'block.share',
focus: 'block.focus',
+ toggleSidePanel: 'block.toggleSidePanel',
},
// channel