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(app): kill bento side panels, fix topbar spacings, add more tag editors to enitites (#7382)

Seamus04e63cca4182
diff --git a/apps/web/src/components/app/HeaderActionButton.tsx b/apps/web/src/components/app/HeaderActionButton.tsx
new file mode 100644
index 0000000000..6dd8378371
--- /dev/null
+++ b/apps/web/src/components/app/HeaderActionButton.tsx
@@ -0,0 +1,37 @@
+import { Button, cn } from '@ui';
+import type { JSX, Ref } from 'solid-js';
+
+/** Shared geometry for labeled actions in a block's header. */
+export function HeaderActionButton(props: {
+ ref?: Ref<HTMLButtonElement>;
+ label: string;
+ icon: JSX.Element;
+ onClick: () => void;
+ tooltip?: string;
+ disabled?: boolean;
+ busy?: boolean;
+ class?: string;
+}) {
+ return (
+ <Button
+ ref={props.ref}
+ variant="ghost"
+ size="md"
+ data-header-action
+ aria-label={props.label}
+ tooltip={props.tooltip}
+ onClick={props.onClick}
+ disabled={props.disabled}
+ aria-busy={props.busy}
+ class={cn(
+ '@max-[600px]/split-header:w-8 @max-[600px]/split-header:p-0',
+ props.class
+ )}
+ >
+ {props.icon}
+ <span data-header-action-label class="@max-[600px]/split-header:hidden">
+ {props.label}
+ </span>
+ </Button>
+ );
+}
diff --git a/apps/web/src/components/app/ResponsiveBlockToolbar.tsx b/apps/web/src/components/app/ResponsiveBlockToolbar.tsx
index 74380f49f7..3f62eb4eb5 100644
--- a/apps/web/src/components/app/ResponsiveBlockToolbar.tsx
+++ b/apps/web/src/components/app/ResponsiveBlockToolbar.tsx
@@ -6,6 +6,7 @@ import type { ItemType } from '@service-storage/client';
import { Button, cn } from '@ui';
import { type Component, For, type JSX, Show } from 'solid-js';
import { Dynamic } from 'solid-js/web';
+import { SidePanel } from './side-panel';
import { HeaderIsland } from './split-layout/components/HeaderIsland';
import {
BlockSplitFileMenu,
@@ -143,6 +144,7 @@ export function ResponsiveBlockToolbar(props: BlockToolbarProps) {
<>
<SplitHeaderRight>
<div class="order-[1000] flex items-center gap-1">
+ <SidePanel.HeaderActionsOutlet />
<For each={headerTools()}>
{(tool) => (
<Show when={!tool.condition || tool.condition()}>
@@ -187,6 +189,11 @@ export function ResponsiveBlockToolbar(props: BlockToolbarProps) {
</>
}
>
+ <SplitHeaderRight>
+ <HeaderIsland class="has-[[data-side-panel-header-actions]:empty]:hidden">
+ <SidePanel.HeaderActionsOutlet />
+ </HeaderIsland>
+ </SplitHeaderRight>
<SplitTitleFileMenu>
<BlockSplitFileMenu
id={props.id}
diff --git a/apps/web/src/components/app/side-panel/EntityDetailsGrid.tsx b/apps/web/src/components/app/side-panel/EntityDetailsGrid.tsx
deleted file mode 100644
index b6f068ec5a..0000000000
--- a/apps/web/src/components/app/side-panel/EntityDetailsGrid.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { type DateValue, formatDate } from '@core/util/date';
-import { OwnerLabel } from '@entity/owner/owner-display';
-import ClockIcon from '@phosphor/clock.svg';
-import { type ParentProps, Show } from 'solid-js';
-import { SidePanel } from './SidePanel';
-
-/** Shared owner and timestamps presentation for task and project details. */
-export function EntityDetailsGrid(
- props: ParentProps<{
- ownerId?: string;
- createdAt?: DateValue | null;
- updatedAt?: DateValue | null;
- }>
-) {
- return (
- <SidePanel.Grid>
- <Show when={props.ownerId}>
- {(owner) => (
- <SidePanel.Row label="Owner">
- <SidePanel.Pill>
- <OwnerLabel ownerId={owner()} suppressClick />
- </SidePanel.Pill>
- </SidePanel.Row>
- )}
- </Show>
- {props.children}
- <Show when={props.createdAt}>
- {(created) => (
- <SidePanel.Row label="Created">
- <DateValueDisplay value={created()} />
- </SidePanel.Row>
- )}
- </Show>
- <Show when={props.updatedAt}>
- {(updated) => (
- <SidePanel.Row label="Last updated">
- <DateValueDisplay value={updated()} />
- </SidePanel.Row>
- )}
- </Show>
- </SidePanel.Grid>
- );
-}
-
-function DateValueDisplay(props: { value: DateValue }) {
- return (
- <SidePanel.Pill>
- <ClockIcon class="size-3 shrink-0" />
- <span class="truncate">
- {formatDate(props.value, { showTime: true })}
- </span>
- </SidePanel.Pill>
- );
-}
diff --git a/apps/web/src/components/app/side-panel/EntityMetadata.tsx b/apps/web/src/components/app/side-panel/EntityMetadata.tsx
new file mode 100644
index 0000000000..ff1fff8ad3
--- /dev/null
+++ b/apps/web/src/components/app/side-panel/EntityMetadata.tsx
@@ -0,0 +1,35 @@
+import { type DateValue, formatDate } from '@core/util/date';
+import { OwnerLabel } from '@entity/owner/owner-display';
+import { type ParentProps, Show } from 'solid-js';
+
+/** Quiet metadata copy shared by every block information footer. */
+export function EntityMetadata(
+ props: ParentProps<{
+ ownerId?: string | null;
+ createdAt?: DateValue | null;
+ updatedAt?: DateValue | null;
+ }>
+) {
+ return (
+ <div class="flex flex-col gap-1">
+ <Show when={props.ownerId}>
+ {(owner) => (
+ <div class="flex min-w-0 items-center gap-1">
+ Owned by <OwnerLabel ownerId={owner()} textOnly suppressClick />
+ </div>
+ )}
+ </Show>
+ <Show when={props.createdAt}>
+ {(created) => (
+ <div>Created {formatDate(created(), { showTime: true })}</div>
+ )}
+ </Show>
+ <Show when={props.updatedAt}>
+ {(updated) => (
+ <div>Last updated {formatDate(updated(), { showTime: true })}</div>
+ )}
+ </Show>
+ {props.children}
+ </div>
+ );
+}
diff --git a/apps/web/src/components/app/side-panel/FileSidePanelSections.tsx b/apps/web/src/components/app/side-panel/FileSidePanelSections.tsx
index 247fba0e0f..e194cf3bd4 100644
--- a/apps/web/src/components/app/side-panel/FileSidePanelSections.tsx
+++ b/apps/web/src/components/app/side-panel/FileSidePanelSections.tsx
@@ -13,6 +13,7 @@ import { OwnerLabel } from '@entity/owner/owner-display';
import { useDocumentMetadataQuery } from '@queries/storage/document-metadata';
import { createCallback } from '@solid-primitives/rootless';
import { createMemo, Show } from 'solid-js';
+import { EntityMetadata } from './EntityMetadata';
import { SidePanel } from './SidePanel';
export function FileSidePanelSections() {
@@ -53,16 +54,11 @@ export function DocumentFileSidePanelSections(
);
}
-export function FileDetailsSection(props: { order?: number }) {
+export function FileDetailsSection(_props: { order?: number }) {
return (
- <SidePanel.Section
- id="details"
- title="Details"
- defaultOpen
- order={props.order}
- >
+ <SidePanel.Footer>
<BlockDetailsSectionContent />
- </SidePanel.Section>
+ </SidePanel.Footer>
);
}
@@ -71,14 +67,9 @@ export function DocumentFileDetailsSection(props: {
order?: number;
}) {
return (
- <SidePanel.Section
- id="details"
- title="Details"
- defaultOpen
- order={props.order}
- >
+ <SidePanel.Footer>
<DetailsSectionContent documentId={props.documentId} />
- </SidePanel.Section>
+ </SidePanel.Footer>
);
}
@@ -159,14 +150,11 @@ function DetailsSectionContent(props: { documentId: string }) {
const metadata = createMemo(() => query.data);
return (
- <SidePanel.Grid>
- <Show when={metadata()?.owner}>
- {(ownerId) => (
- <SidePanel.Row label="Owner">
- <OwnerValue ownerId={ownerId()} />
- </SidePanel.Row>
- )}
- </Show>
+ <EntityMetadata
+ ownerId={metadata()?.owner}
+ createdAt={metadata()?.createdAt}
+ updatedAt={metadata()?.updatedAt}
+ >
<Show
when={(() => {
const id = metadata()?.projectId;
@@ -175,26 +163,13 @@ function DetailsSectionContent(props: { documentId: string }) {
})()}
>
{(folder) => (
- <SidePanel.Row label="Folder">
+ <div class="flex items-center gap-1">
+ Folder
<FolderLink projectId={folder().id} projectName={folder().name} />
- </SidePanel.Row>
- )}
- </Show>
- <Show when={metadata()?.createdAt}>
- {(created) => (
- <SidePanel.Row label="Created">
- <DateValueDisplay value={created()} />
- </SidePanel.Row>
- )}
- </Show>
- <Show when={metadata()?.updatedAt}>
- {(updated) => (
- <SidePanel.Row label="Last updated">
- <DateValueDisplay value={updated()} />
- </SidePanel.Row>
+ </div>
)}
</Show>
- </SidePanel.Grid>
+ </EntityMetadata>
);
}
diff --git a/apps/web/src/components/app/side-panel/SidePanel.test.tsx b/apps/web/src/components/app/side-panel/SidePanel.test.tsx
new file mode 100644
index 0000000000..aaccd890bf
--- /dev/null
+++ b/apps/web/src/components/app/side-panel/SidePanel.test.tsx
@@ -0,0 +1,109 @@
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { createContext, createSignal, type ParentProps } from 'solid-js';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { SidePanel } from './SidePanel';
+
+const mocks = vi.hoisted(() => ({ touch: false }));
+vi.mock('@core/mobile/isTouchDevice', () => ({
+ isTouchDevice: () => mocks.touch,
+}));
+vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => mocks.touch }));
+vi.mock('@core/mobile/virtualKeyboard', () => ({
+ virtualKeyboardVisible: () => false,
+}));
+vi.mock('@core/block', () => ({ useMaybeBlockAliasedName: () => undefined }));
+vi.mock('@app/preferences/use-preference', () => ({
+ usePreference: (_key: string, options: { default: boolean }) =>
+ createSignal(options.default),
+}));
+vi.mock('@core/hotkey/hotkeys', () => ({ registerHotkey: vi.fn() }));
+vi.mock('../split-layout/layoutUtils', () => ({
+ useSplitPanel: () => undefined,
+}));
+vi.mock('../split-layout/components/SplitHeader', () => ({
+ SplitHeaderRight: (props: ParentProps) => props.children,
+}));
+vi.mock('../split-layout/components/HeaderIsland', () => ({
+ HeaderIsland: (props: ParentProps) => props.children,
+}));
+vi.mock('@core/component/Resize/Resize', () => {
+ const ResizeZoneContext = createContext({ size: () => 1400 });
+ return {
+ ResizeZoneContext,
+ Resize: {
+ Zone: (props: ParentProps) => (
+ <ResizeZoneContext.Provider value={{ size: () => 1400 }}>
+ {props.children}
+ </ResizeZoneContext.Provider>
+ ),
+ Panel: (props: ParentProps) => <main>{props.children}</main>,
+ },
+ };
+});
+
+let motion: HTMLStyleElement;
+beforeEach(() => {
+ mocks.touch = false;
+ motion = document.createElement('style');
+ motion.textContent =
+ '[data-corvu-drawer-content], [data-corvu-drawer-overlay] { transition-duration: 0s; animation-name: none; }';
+ document.head.append(motion);
+ vi.stubGlobal(
+ 'ResizeObserver',
+ class {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ }
+ );
+ vi.stubGlobal('scrollTo', vi.fn());
+});
+afterEach(() => {
+ cleanup();
+ motion.remove();
+ vi.unstubAllGlobals();
+});
+
+function setup() {
+ render(() => (
+ <SidePanel.Root floating defaultOpen={false}>
+ <SidePanel.Toggle />
+ <SidePanel.Layout floating headerToggle={false}>
+ <p>Document content</p>
+ <SidePanel.Section id="properties" title="Properties" defaultOpen>
+ <button>Edit property</button>
+ </SidePanel.Section>
+ <SidePanel.Footer>Owned by Sam</SidePanel.Footer>
+ </SidePanel.Layout>
+ </SidePanel.Root>
+ ));
+}
+
+it('opens touch details in the standard drawer and dismisses with Escape', async () => {
+ mocks.touch = true;
+ setup();
+ const trigger = screen.getByRole('button', { name: 'Show details' });
+ expect(trigger.getAttribute('aria-haspopup')).toBe('dialog');
+ expect(screen.queryByRole('dialog')).toBeNull();
+ fireEvent.click(trigger);
+ const drawer = screen.getByRole('dialog', { name: 'Item details' });
+ expect(drawer.querySelector('[data-drawer-scroll-body]')).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'Edit property' })).toBeTruthy();
+ expect(screen.getByText('Owned by Sam')).toBeTruthy();
+ expect(
+ screen.queryByRole('complementary', { name: 'Block details' })
+ ).toBeNull();
+ fireEvent.keyDown(drawer, { key: 'Escape' });
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
+ expect(
+ screen
+ .getByRole('button', { name: 'Show details' })
+ .getAttribute('aria-expanded')
+ ).toBe('false');
+});
diff --git a/apps/web/src/components/app/side-panel/SidePanel.tsx b/apps/web/src/components/app/side-panel/SidePanel.tsx
index eb7f8c0e48..41be6accf5 100644
--- a/apps/web/src/components/app/side-panel/SidePanel.tsx
+++ b/apps/web/src/components/app/side-panel/SidePanel.tsx
@@ -29,6 +29,9 @@ import {
Suspense,
useContext,
} from 'solid-js';
+import { Portal } from 'solid-js/web';
+import { Transition } from 'solid-transition-group';
+import { MobileDrawer } from '../mobile/MobileDrawer';
import { HeaderIsland } from '../split-layout/components/HeaderIsland';
import { SplitHeaderRight } from '../split-layout/components/SplitHeader';
import { useSplitPanel } from '../split-layout/layoutUtils';
@@ -70,7 +73,11 @@ function createWideOpenState(
* Layout row while still operating on the same panel.
*/
function Root(
- props: ParentProps<{ defaultOpen?: boolean; persistKey?: string }>
+ props: ParentProps<{
+ defaultOpen?: boolean;
+ persistKey?: string;
+ floating?: boolean;
+ }>
) {
const splitPanel = useSplitPanel();
const content = splitPanel?.handle.content();
@@ -80,6 +87,8 @@ function Root(
(content?.type === 'component' ? content.id : content?.type);
const [sections, setSections] = createSignal<SidePanelSectionEntry[]>([]);
const [openIds, setOpenIds] = createSignal<string[]>([]);
+ const [headerActionsMount, setHeaderActionsMount] =
+ createSignal<HTMLDivElement>();
// 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).
@@ -87,19 +96,25 @@ function Root(
persistKey,
props.defaultOpen ?? true
);
- const [isNarrowOpen, setIsNarrowOpen] = createSignal(false);
- const [isNarrow, setIsNarrow] = createSignal(isMobile());
+ const [isOverlayOpen, setIsOverlayOpen] = createSignal(false);
+ // Stay closed until the layout has measured its actual split width.
+ const [isOverlayMode, setIsOverlayMode] = createSignal(true);
+ const updateLayoutMode: Setter<boolean> = (next) => {
+ const overlay = typeof next === 'function' ? next(isOverlayMode()) : next;
+ if (overlay !== isOverlayMode()) setIsOverlayOpen(false);
+ return setIsOverlayMode(() => overlay);
+ };
- const isOpen = () => (isNarrow() ? isNarrowOpen() : isWideOpen());
+ const isOpen = () => (isOverlayMode() ? isOverlayOpen() : isWideOpen());
const setIsOpen = (next: boolean | ((prev: boolean) => boolean)) => {
- const setter = isNarrow() ? setIsNarrowOpen : setIsWideOpen;
+ const setter = isOverlayMode() ? setIsOverlayOpen : setIsWideOpen;
setter(typeof next === 'function' ? next : () => next);
};
const toggle = () => setIsOpen((prev) => !prev);
// Let global chrome shortcuts (cmd+.) hide/show this panel alongside the
// app sidebar.
- onCleanup(registerSidePanelInstance({ setIsOpen, isNarrow }));
+ onCleanup(registerSidePanelInstance({ setIsOpen, isOverlayMode }));
const register = (entry: SidePanelSectionEntry) => {
setSections((prev) => {
@@ -135,6 +150,8 @@ function Root(
}
const ctx: SidePanelContextType = {
+ headerActionsMount,
+ setHeaderActionsMount,
register,
unregister,
sections,
@@ -142,10 +159,11 @@ function Root(
isOpen,
setIsOpen,
toggle,
- isNarrow,
- setIsNarrow,
+ isOverlayMode,
+ setIsOverlayMode: updateLayoutMode,
setOpenSectionIds: setOpenIds,
openSectionIds: openIds,
+ isFloating: () => props.floating ?? false,
};
return (
@@ -168,6 +186,8 @@ function Layout(
defaultOpen?: boolean;
persistKey?: string;
headerToggle?: boolean;
+ /** Render the panel over the block instead of reserving horizontal space. */
+ floating?: boolean;
}>
) {
const parentContext = useContext(SidePanelContext);
@@ -190,7 +210,8 @@ function Layout(
setOpenIds={ctx.setOpenSectionIds}
isOpen={ctx.isOpen}
setIsOpen={ctx.setIsOpen}
- setIsNarrow={ctx.setIsNarrow}
+ setIsOverlayMode={ctx.setIsOverlayMode}
+ floating={props.floating ?? ctx.isFloating()}
>
{props.children}
</SidePanelLayoutInner>
@@ -203,7 +224,11 @@ function Layout(
<Show
when={parentContext}
fallback={
- <Root defaultOpen={props.defaultOpen} persistKey={props.persistKey}>
+ <Root
+ defaultOpen={props.defaultOpen}
+ persistKey={props.persistKey}
+ floating={props.floating}
+ >
<Panels />
</Root>
}
@@ -220,7 +245,8 @@ function SidePanelLayoutInner(
setOpenIds: (ids: string[]) => void;
isOpen: Accessor<boolean>;
setIsOpen: (next: boolean | ((prev: boolean) => boolean)) => void;
- setIsNarrow: Setter<boolean>;
+ setIsOverlayMode: Setter<boolean>;
+ floating: boolean;
}>
) {
const resolved = children(() => props.children);
@@ -235,13 +261,28 @@ function SidePanelLayoutInner(
);
const hasSections = createMemo(() => props.sections().length > 0);
- createEffect(() => props.setIsNarrow(isNarrow()));
+ createEffect(() =>
+ props.setIsOverlayMode(props.floating || isTouchDevice() || isNarrow())
+ );
const showSplit = createMemo(
- () => !isNarrow() && hasSections() && props.isOpen()
+ () =>
+ !isTouchDevice() &&
+ !props.floating &&
+ !isNarrow() &&
+ hasSections() &&
+ props.isOpen()
);
const showOverlay = createMemo(
- () => isNarrow() && hasSections() && props.isOpen()
+ () =>
+ !isTouchDevice() &&
+ !props.floating &&
+ isNarrow() &&
+ hasSections() &&
+ props.isOpen()
+ );
+ const showFloating = createMemo(
+ () => !isTouchDevice() && props.floating && hasSections() && props.isOpen()
);
return (
@@ -295,6 +336,66 @@ function SidePanelLayoutInner(
</Scroll>
</div>
</Show>
+ <Show when={isTouchDevice()}>
+ <MobileDrawer
+ side="bottom"
+ open={hasSections() && props.isOpen()}
+ onOpenChange={props.setIsOpen}
+ preventScroll={false}
+ preventScrollbarShift={false}
+ >
+ <MobileDrawer.Portal>
+ <MobileDrawer.Overlay />
+ <MobileDrawer.Content aria-label="Item details">
+ <MobileDrawer.Handle />
+ <MobileDrawer.ScrollBody>
+ <SidePanelOutlet
+ floating
+ scrollable={false}
+ sections={props.sections}
+ openIds={props.openIds}
+ setOpenIds={props.setOpenIds}
+ />
+ </MobileDrawer.ScrollBody>
+ </MobileDrawer.Content>
+ </MobileDrawer.Portal>
+ </MobileDrawer>
+ </Show>
+ <Show when={props.floating && !isTouchDevice()}>
+ <div class="absolute inset-0 z-split-panel-chrome pointer-events-none">
+ <Show when={showFloating()}>
+ <div
+ class="absolute inset-0 pointer-events-auto bg-transparent"
+ onClick={() => props.setIsOpen(false)}
+ />
+ </Show>
+ <Transition
+ appear
+ enterActiveClass="transition-[opacity,translate] duration-120 ease-out motion-reduce:duration-0"
+ enterClass="opacity-0 translate-x-1"
+ enterToClass="opacity-100 translate-x-0"
+ exitActiveClass="transition-opacity duration-70 ease-out motion-reduce:duration-0"
+ exitClass="opacity-100"
+ exitToClass="opacity-0"
+ >
+ <Show when={showFloating()}>
+ <aside
+ aria-label="Block details"
+ inert={!showFloating()}
+ class="absolute right-3 top-3 flex max-h-[calc(100%-1.5rem)] w-[min(320px,calc(100%-1.5rem))] max-w-full flex-col overflow-hidden rounded-xl border border-edge-frame bg-surface shadow-xl pointer-events-auto"
+ onClick={(event) => event.stopPropagation()}
+ >
+ <SidePanelOutlet
+ floating
+ sections={props.sections}
+ openIds={props.openIds}
+ setOpenIds={props.setOpenIds}
+ />
+ </aside>
+ </Show>
+ </Transition>
+ </div>
+ </Show>
</>
);
}
@@ -316,23 +417,59 @@ function Toggle() {
'border-0 hover:bg-transparent! active:bg-transparent! focus-visible:bg-transparent! active:text-accent',
isTouchDevice() && ctx.isOpen() && 'text-accent'
)}
- tooltip={ctx.isOpen() ? 'Hide Side Panel' : 'Show Side Panel'}
+ tooltip={
+ isTouchDevice()
+ ? ctx.isOpen()
+ ? 'Hide details'
+ : 'Show details'
+ : ctx.isOpen()
+ ? 'Hide Side Panel'
+ : 'Show Side Panel'
+ }
+ aria-haspopup={isTouchDevice() ? 'dialog' : undefined}
+ aria-expanded={ctx.isOpen()}
hotkey={TOKENS.block.toggleSidePanel}
onClick={() => ctx.toggle()}
>
<Show
- when={ctx.isNarrow()}
- fallback={<SidePanelIcon class={cn(ctx.isOpen() && 'text-accent')} />}
+ when={isTouchDevice()}
+ fallback={
+ <SidePanelIcon
+ class={cn('rotate-180', ctx.isOpen() && 'text-accent')}
+ />
+ }
>
- <InfoIcon
- class={cn('size-4', !isMobile() && ctx.isOpen() && 'text-accent')}
- />
+ <InfoIcon class={cn(ctx.isOpen() && 'text-accent')} />
</Show>
</Button>
</Show>
);
}
+/** Keeps action state in the owning block while rendering it before Share. */
+function HeaderActions(props: ParentProps) {
+ const ctx = useContext(SidePanelContext);
+ return (
+ <Show when={ctx?.headerActionsMount()}>
+ {(mount) => <Portal mount={mount()}>{props.children}</Portal>}
+ </Show>
+ );
+}
+
+function HeaderActionsOutlet() {
+ const ctx = useContext(SidePanelContext);
+ onCleanup(() => ctx?.setHeaderActionsMount(undefined));
+ return (
+ <Show when={ctx}>
+ <div
+ ref={ctx?.setHeaderActionsMount}
+ data-side-panel-header-actions
+ class="flex shrink-0 items-center gap-1 empty:hidden [&>div]:contents"
+ />
+ </Show>
+ );
+}
+
function SidePanelHeaderToggle() {
const panel = useSplitPanel();
const ctx = useContext(SidePanelContext);
@@ -368,6 +505,8 @@ function SidePanelHeaderToggle() {
}
function SidePanelOutlet(props: {
+ floating?: boolean;
+ scrollable?: boolean;
sections: Accessor<SidePanelSectionEntry[]>;
openIds: Accessor<string[]>;
setOpenIds: (ids: string[]) => void;
@@ -382,19 +521,77 @@ function SidePanelOutlet(props: {
})
);
+ const Sections = () => (
+ <Accordion
+ multiple
+ collapsible
+ value={props.openIds()}
+ onChange={(value) => props.setOpenIds(value as string[])}
+ class={cn(
+ 'flex flex-col min-h-0',
+ props.floating ? 'p-0 gap-0' : 'p-2 gap-2'
+ )}
+ >
+ <For each={sortedSections().filter((section) => !section.footer)}>
+ {(section) => section.component(props.floating ?? false)}
+ </For>
+ </Accordion>
+ );
+
return (
- <Scroll class="flex flex-col min-h-0">
- <Accordion
- multiple
- collapsible
- value={props.openIds()}
- onChange={(value) => props.setOpenIds(value as string[])}
- class="p-2 flex flex-col gap-2 min-h-0"
+ <Show
+ when={props.floating}
+ fallback={
+ <Scroll class="flex flex-col min-h-0">
+ <Sections />
+ <Footers />
+ </Scroll>
+ }
+ >
+ <div
+ class={cn(
+ 'min-h-0',
+ props.scrollable !== false && 'overflow-y-auto overscroll-contain'
+ )}
>
- <For each={sortedSections()}>{(section) => section.component()}</For>
- </Accordion>
- </Scroll>
+ <Sections />
+ <Footers />
+ </div>
+ </Show>
);
+
+ function Footers() {
+ return (
+ <For each={sortedSections().filter((section) => section.footer)}>
+ {(section) => section.component(props.floating ?? false)}
+ </For>
+ );
+ }
+}
+
+/** Unheaded metadata always follows the panel's interactive sections. */
+function Footer(props: ParentProps) {
+ const ctx = useContext(SidePanelContext);
+ if (!ctx)
+ throw new Error('<SidePanel.Footer> must be inside <SidePanel.Root>');
+ onMount(() => {
+ ctx.register({
+ id: 'metadata-footer',
+ title: 'Metadata',
+ defaultOpen: false,
+ footer: true,
+ component: () => (
+ <footer
+ aria-label="Metadata"
+ class="border-t border-edge-muted px-3 py-3 text-xs leading-relaxed text-ink-extra-muted"
+ >
+ <Suspense fallback={<Loading />}>{props.children}</Suspense>
+ </footer>
+ ),
+ });
+ onCleanup(() => ctx.unregister('metadata-footer'));
+ });
+ return null;
}
/**
@@ -432,36 +629,54 @@ function Section(
title: props.title,
defaultOpen: props.defaultOpen ?? false,
order: props.order,
- component: () => (
- <Accordion.Item value={props.id}>
- <Panel
- depth={2}
- style={{ height: 'auto' }}
- class="rounded-xl bg-surface"
+ component: (floating) => (
+ <Accordion.Item
+ value={props.id}
+ class={cn(floating && 'border-b border-edge-muted last:border-b-0')}
+ >
+ <Show
+ when={floating}
+ fallback={
+ <Panel
+ depth={2}
+ style={{ height: 'auto' }}
+ class="rounded-xl bg-surface"
+ >
+ <SectionContent />
+ </Panel>
+ }
>
- <Accordion.Header class="group flex items-center">
- <Accordion.Trigger class="px-2 py-3 flex flex-1 min-w-0 items-center gap-2 text-xs hover:underline">
- <CaretRight class="size-3 text-ink-muted transition-transform duration-90 group-data-expanded:rotate-90" />
- <span>{props.title}</span>
- </Accordion.Trigger>
- <Show when={props.actions}>
- <div class="shrink-0 pr-2">{props.actions}</div>
- </Show>
- </Accordion.Header>
- <Accordion.Content class="group/content overflow-hidden data-expanded:animate-accordion-down data-closed:animate-accordion-up">
- <Suspense fallback={<Loading />}>
- <div class="px-2 pb-2 text-sm opacity-0 group-data-expanded/content:opacity-100 transition-opacity duration-150 ease-out">
- {props.children}
- </div>
- </Suspense>
- </Accordion.Content>
- </Panel>
+ <SectionContent />
+ </Show>
</Accordion.Item>
),
});
onCleanup(() => ctx.unregister(props.id));
});
return null;
+
+ function SectionContent() {
+ return (
+ <>
+ <Accordion.Header class="group flex items-center">
+ <Accordion.Trigger class="px-2 py-3 flex flex-1 min-w-0 items-center justify-between gap-2 text-xs text-ink-muted hover:underline">
+ <span>{props.title}</span>
+ <CaretRight class="size-3 shrink-0 transition-transform duration-90 group-data-expanded:rotate-90" />
+ </Accordion.Trigger>
+ <Show when={props.actions}>
+ <div class="shrink-0 pr-2">{props.actions}</div>
+ </Show>
+ </Accordion.Header>
+ <Accordion.Content class="group/content overflow-hidden data-expanded:animate-accordion-down data-closed:animate-accordion-up">
+ <Suspense fallback={<Loading />}>
+ <div class="px-2 pb-2 text-sm opacity-0 group-data-expanded/content:opacity-100 transition-opacity duration-150 ease-out">
+ {props.children}
+ </div>
+ </Suspense>
+ </Accordion.Content>
+ </>
+ );
+ }
}
/** Hook to access the SidePanel context for toggling visibility */
@@ -474,7 +689,7 @@ function useSidePanel() {
isOpen: ctx.isOpen,
setIsOpen: ctx.setIsOpen,
toggle: ctx.toggle,
- isNarrow: ctx.isNarrow,
+ isOverlayMode: ctx.isOverlayMode,
hasSections: ctx.hasSections,
setOpenSectionIds: ctx.setOpenSectionIds,
openSectionIds: ctx.openSectionIds,
@@ -598,7 +813,10 @@ export const SidePanel = {
Root,
Layout,
Toggle,
+ HeaderActions,
+ HeaderActionsOutlet,
Section,
+ Footer,
Grid,
Row,
Pill,
diff --git a/apps/web/src/components/app/side-panel/context.ts b/apps/web/src/components/app/side-panel/context.ts
index 9392d71dc1..da1d4eb3fe 100644
--- a/apps/web/src/components/app/side-panel/context.ts
+++ b/apps/web/src/components/app/side-panel/context.ts
@@ -4,15 +4,18 @@ export type SidePanelSectionEntry = {
id: string;
title: JSX.Element;
defaultOpen: boolean;
+ footer?: 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;
+ component: (floating: boolean) => JSX.Element;
};
export type SidePanelContextType = {
+ headerActionsMount: Accessor<HTMLDivElement | undefined>;
+ setHeaderActionsMount: Setter<HTMLDivElement | undefined>;
register: (entry: SidePanelSectionEntry) => void;
unregister: (id: string) => void;
sections: Accessor<SidePanelSectionEntry[]>;
@@ -20,7 +23,6 @@ export type SidePanelContextType = {
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 for the current layout mode. */
@@ -32,12 +34,13 @@ export type SidePanelContextType = {
/** Which section IDs are currently expanded in the accordion. */
openSectionIds: Accessor<string[]>;
/**
- * 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.
+ * Floating panels are always overlays. Legacy docked panels also use
+ * an overlay on narrow layouts.
*/
- isNarrow: Accessor<boolean>;
- setIsNarrow: Setter<boolean>;
+ isOverlayMode: Accessor<boolean>;
+ setIsOverlayMode: Setter<boolean>;
+ /** Whether the panel is rendered as a single floating bubble. */
+ isFloating: Accessor<boolean>;
};
export const SidePanelContext = createContext<SidePanelContextType>();
diff --git a/apps/web/src/components/app/side-panel/registry.ts b/apps/web/src/components/app/side-panel/registry.ts
index 3c4f3da9aa..00bb006957 100644
--- a/apps/web/src/components/app/side-panel/registry.ts
+++ b/apps/web/src/components/app/side-panel/registry.ts
@@ -6,7 +6,7 @@
type SidePanelInstance = {
setIsOpen: (open: boolean) => void;
- isNarrow: () => boolean;
+ isOverlayMode: () => boolean;
};
const instances = new Set<SidePanelInstance>();
@@ -20,12 +20,12 @@ export function registerSidePanelInstance(instance: SidePanelInstance) {
}
/**
- * Show/hide every mounted side panel. Narrow layouts render the panel as a
- * full-screen overlay, so they are only ever hidden — never force-opened.
+ * Show/hide docked panels. Overlay menus are only ever hidden, never
+ * force-opened by the global chrome shortcut.
*/
export function setAllSidePanelsOpen(open: boolean) {
for (const instance of instances) {
- if (open && instance.isNarrow()) continue;
+ if (open && instance.isOverlayMode()) continue;
instance.setIsOpen(open);
}
}
diff --git a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
index 632c38f59a..9294d5016c 100644
--- a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx
@@ -339,9 +339,10 @@ function SoupNavigationButtons() {
/** Shared header controls; each host supplies its current list navigation. */
export function ListNavigationButtons(props: {
navigation: ListDetailNavigationTarget;
+ class?: string;
}) {
return (
- <div class="flex items-center gap-0.5">
+ <div class={cn('flex items-center gap-0.5', props.class)}>
<Button
size="icon-md"
label="Previous item"
@@ -646,7 +647,7 @@ export function SplitHeader(props: {
}}
/>
- <div class="header-actions h-full grow shrink flex items-center justify-end gap-0.5 px-2 touch:px-0 touch:gap-2">
+ <div class="header-actions h-full grow shrink flex items-center justify-end gap-1 px-2 touch:px-0 touch:gap-2">
<div
class="contents"
ref={(ref) => {
diff --git a/apps/web/src/components/app/split-layout/components/SplitLabel.tsx b/apps/web/src/components/app/split-layout/components/SplitLabel.tsx
index 1d3e5eb3f4..95411bf8a1 100644
--- a/apps/web/src/components/app/split-layout/components/SplitLabel.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitLabel.tsx
@@ -1,3 +1,4 @@
+import { DocumentTitleHoverCard } from '@app/components/entity-detail/DocumentTitleHoverCard';
import { isInBlock, useBlockAliasedName } from '@core/block';
import {
ContextMenuContent,
@@ -286,10 +287,30 @@ export function BlockItemSplitLabel(props: {
<Show
when={props.title}
fallback={
- <SplitLabel
- label={displayName() ?? ''}
- lockRename={!isOwner() || props.lockRename}
- />
+ <Show
+ when={blockMetadataSignal()}
+ fallback={
+ <SplitLabel
+ label={displayName() ?? ''}
+ lockRename={!isOwner() || props.lockRename}
+ />
+ }
+ >
+ {(metadata) => (
+ <DocumentTitleHoverCard
+ documentId={metadata().documentId}
+ name={displayName() ?? ''}
+ ownerId={metadata().owner}
+ createdAt={metadata().createdAt}
+ updatedAt={metadata().updatedAt}
+ >
+ <SplitLabel
+ label={displayName() ?? ''}
+ lockRename={!isOwner() || props.lockRename}
+ />
+ </DocumentTitleHoverCard>
+ )}
+ </Show>
}
>
{props.title}
diff --git a/apps/web/src/components/entity-detail/DocumentTitleHoverCard.tsx b/apps/web/src/components/entity-detail/DocumentTitleHoverCard.tsx
new file mode 100644
index 0000000000..99a3eeaaac
--- /dev/null
+++ b/apps/web/src/components/entity-detail/DocumentTitleHoverCard.tsx
@@ -0,0 +1,92 @@
+import { QUERY_FILTERS_BASE } from '@app/features/next-soup/filters/query-filters';
+import { UserIcon } from '@core/component/UserIcon';
+import { useQuickAccess } from '@core/context/quickAccess';
+import { getDisplayName, tryMacroId } from '@core/user';
+import { type DateValue, formatDate } from '@core/util/date';
+import { useSoupItemsQuery } from '@queries/soup/items';
+import { HoverCard } from '@ui';
+import { type ParentProps, Show } from 'solid-js';
+
+type DocumentTitleProps = {
+ documentId: string;
+ name: string;
+ ownerId?: string;
+ createdAt?: DateValue | null;
+ updatedAt?: DateValue | null;
+};
+
+function DocumentTitleDetails(props: DocumentTitleProps) {
+ const quickAccess = useQuickAccess();
+ const cached = () => {
+ const item = quickAccess.getById(props.documentId);
+ return item?.kind === 'entity' ? item : undefined;
+ };
+ const metadata = useSoupItemsQuery(
+ () => ({
+ params: { limit: 1 },
+ body: {
+ ...QUERY_FILTERS_BASE,
+ document_filters: { document_ids: [props.documentId] },
+ },
+ }),
+ () => ({ staleTime: 60_000 })
+ );
+ const resolved = () =>
+ metadata.isSuccess
+ ? metadata.data.find((item) => item.id === props.documentId)
+ : undefined;
+ const ownerId = () =>
+ props.ownerId ?? cached()?.data.ownerId ?? resolved()?.ownerId;
+ const updatedAt = () =>
+ props.updatedAt ?? cached()?.timestamps.updatedAt ?? resolved()?.updatedAt;
+ const createdAt = () =>
+ props.createdAt ?? cached()?.timestamps.createdAt ?? resolved()?.createdAt;
+ const timestamp = (value: DateValue | null | undefined) =>
+ value ? formatDate(value, { showTime: true }) : 'Not available';
+
+ return (
+ <div
+ class="w-full text-ink"
+ role="group"
+ aria-label={`Details for ${props.name}`}
+ >
+ <div class="flex min-w-0 items-center gap-2.5 pb-3">
+ <Show when={ownerId()}>
+ {(owner) => (
+ <UserIcon
+ id={owner()}
+ size="md"
+ suppressClick
+ showTooltip={false}
+ />
+ )}
+ </Show>
+ <div class="min-w-0 truncate text-xs">
+ <Show when={ownerId()} fallback="Not available">
+ {(owner) => getDisplayName(tryMacroId(owner())) || owner()}
+ </Show>
+ </div>
+ </div>
+ <dl class="grid grid-cols-[max-content_minmax(0,1fr)] items-baseline gap-x-[2em] gap-y-1.5 border-t border-edge-muted pt-2.5">
+ <dt class="text-ink-muted">Created</dt>
+ <dd class="text-left tabular-nums">{timestamp(createdAt())}</dd>
+ <dt class="text-ink-muted">Updated</dt>
+ <dd class="text-left tabular-nums">{timestamp(updatedAt())}</dd>
+ </dl>
+ </div>
+ );
+}
+
+/** Shared document header metadata, loaded only while the title card is open. */
+export function DocumentTitleHoverCard(props: ParentProps<DocumentTitleProps>) {
+ return (
+ <HoverCard
+ triggerClass="min-w-0"
+ contentClass="w-72 p-3"
+ placement="bottom-start"
+ content={<DocumentTitleDetails {...props} />}
+ >
+ {props.children}
+ </HoverCard>
+ );
+}
diff --git a/apps/web/src/components/entity-detail/EntityDetailBreadcrumbItem.tsx b/apps/web/src/components/entity-detail/EntityDetailBreadcrumbItem.tsx
index a4a57dcde2..6ae08a9f1a 100644
--- a/apps/web/src/components/entity-detail/EntityDetailBreadcrumbItem.tsx
+++ b/apps/web/src/components/entity-detail/EntityDetailBreadcrumbItem.tsx
@@ -8,6 +8,7 @@ import { fileTypeToBlockName } from '@core/constant/allBlocks';
import { useItemRawName } from '@queries/preview';
import type { ItemEntity } from '@queries/preview/types';
import { Show } from 'solid-js';
+import { DocumentTitleHoverCard } from './DocumentTitleHoverCard';
import type {
EntityDetailNavigationEntry,
EntityDetailTarget,
@@ -59,6 +60,22 @@ function BreadcrumbItem(props: {
props.setsSplitDisplayName ? props.name : undefined
);
+ const button = (item: { isActive: () => boolean; onSelect: () => void }) => (
+ <ViewBreadcrumbs.Button
+ class="gap-1.5"
+ isActive={item.isActive()}
+ onClick={item.onSelect}
+ tooltip={props.entry.data.type === 'document' ? undefined : props.name}
+ >
+ <EntityIcon
+ targetType={breadcrumbIcon(props.entry.data)}
+ size="xs"
+ class="shrink-0"
+ />
+ <span class="truncate">{props.name}</span>
+ </ViewBreadcrumbs.Button>
+ );
+
return (
<ViewBreadcrumbs.Item
value={props.entry.value}
@@ -66,19 +83,17 @@ function BreadcrumbItem(props: {
order={props.order}
>
{(item) => (
- <ViewBreadcrumbs.Button
- class="gap-1.5"
- isActive={item.isActive()}
- onClick={item.onSelect}
- tooltip={props.name}
+ <Show
+ when={props.entry.data.type === 'document'}
+ fallback={button(item)}
>
- <EntityIcon
- targetType={breadcrumbIcon(props.entry.data)}
- size="xs"
- class="shrink-0"
- />
- <span class="truncate">{props.name}</span>
- </ViewBreadcrumbs.Button>
+ <DocumentTitleHoverCard
+ documentId={props.entry.data.id}
+ name={props.name}
+ >
+ {button(item)}
+ </DocumentTitleHoverCard>
+ </Show>
)}
</ViewBreadcrumbs.Item>
);
diff --git a/apps/web/src/components/entity-detail/EntityDetailTopBar.tsx b/apps/web/src/components/entity-detail/EntityDetailTopBar.tsx
index 2543795999..5c0d721483 100644
--- a/apps/web/src/components/entity-detail/EntityDetailTopBar.tsx
+++ b/apps/web/src/components/entity-detail/EntityDetailTopBar.tsx
@@ -17,7 +17,8 @@ export function EntityDetailTopBar(
<Show when={props.navigation}>
<div class="min-w-0 overflow-x-auto">{props.navigation}</div>
</Show>
- <div class="ml-auto flex shrink-0 items-center gap-2">
+ <div class="ml-auto flex shrink-0 items-center gap-1">
+ <SidePanel.HeaderActionsOutlet />
{props.children}
<SidePanel.Toggle />
</div>
diff --git a/apps/web/src/components/ui/components/Badge.docs.tsx b/apps/web/src/components/ui/components/Badge.docs.tsx
index fd9318cb33..64a403a894 100644
--- a/apps/web/src/components/ui/components/Badge.docs.tsx
+++ b/apps/web/src/components/ui/components/Badge.docs.tsx
@@ -2,6 +2,7 @@ import { defineDoc } from '@app/features/ui-gallery/types';
import CaretDownIcon from '@phosphor/caret-down.svg';
import CheckIcon from '@phosphor/check.svg';
import { For } from 'solid-js';
+import { Avatar } from './Avatar';
import { Badge, type BadgeVariant } from './Badge';
const VARIANTS: BadgeVariant[] = ['ghost', 'outline'];
@@ -29,6 +30,28 @@ function VariantsDemo() {
}
// #endregion
+// #region demo:avatars
+function AvatarsDemo() {
+ return (
+ <div class="flex flex-wrap items-end gap-3">
+ <For each={['xs', 'sm', 'md', 'lg'] as const}>
+ {(size) => (
+ <div class="flex flex-col items-start gap-1.5">
+ <span class="font-mono text-xs text-ink-subtle">{size}</span>
+ <Badge variant="outline" size={size}>
+ <Avatar size={size === 'xs' || size === 'sm' ? 'sm' : 'md'}>
+ <Avatar.Fallback>JD</Avatar.Fallback>
+ </Avatar>
+ Jordan
+ </Badge>
+ </div>
+ )}
+ </For>
+ </div>
+ );
+}
+// #endregion
+
// #region demo:sizes
function SizesDemo() {
return (
@@ -103,5 +126,12 @@ export default defineDoc({
'Badges take arbitrary children — a color dot for a tag, a status glyph, a caret when the badge is the visible half of a menu trigger.',
render: ContentDemo,
},
+ {
+ id: 'avatars',
+ title: 'Leading avatars',
+ description:
+ 'Use a small Avatar in xs / sm badges and a medium Avatar in md / lg badges. Each gets an even circular inset; text-only badges retain their usual padding.',
+ render: AvatarsDemo,
+ },
],
});
diff --git a/apps/web/src/components/ui/components/Badge.tsx b/apps/web/src/components/ui/components/Badge.tsx
index 80a62f058a..85424accc6 100644
--- a/apps/web/src/components/ui/components/Badge.tsx
+++ b/apps/web/src/components/ui/components/Badge.tsx
@@ -17,8 +17,21 @@ export const badgeVariants = createVariants(
outline: 'bg-transparent text-ink-muted border-edge-muted',
},
size: {
- xs: "h-5 gap-1 px-2 text-xs [&>svg:not([class*='size-'])]:size-3",
+ xs: "h-5 gap-1 px-2 text-xs [&>svg:not([class*='size-'])]:size-3 has-[>[data-slot=avatar][data-size=sm]:first-child]:pl-px",
...CONTROL_SIZE_VARIANTS,
+ // A 16px avatar in a 24px pill has a 3px inset inside its 1px border.
+ sm: cn(
+ CONTROL_SIZE_VARIANTS.sm,
+ 'has-[>[data-slot=avatar][data-size=sm]:first-child]:pl-[3px]'
+ ),
+ md: cn(
+ CONTROL_SIZE_VARIANTS.md,
+ 'has-[>[data-slot=avatar][data-size=md]:first-child]:pl-[3px]'
+ ),
+ lg: cn(
+ CONTROL_SIZE_VARIANTS.lg,
+ 'has-[>[data-slot=avatar][data-size=md]:first-child]:pl-[5px]'
+ ),
},
},
{
@@ -62,6 +75,7 @@ export function badgeTriggerClasses(options: BadgeClassOptions = {}): string {
/** A non-interactive label with Button-aligned sizing.
*
* @do Keep badge text to a word or two.
+ * @do Use a small leading Avatar in xs/sm badges, or medium in md/lg badges.
* @do Use `badgeTriggerClasses` when a badge needs to behave like a button.
* @do Use a palette color for identity (tags, calendars) and a semantic color
* for state.
diff --git a/apps/web/src/components/ui/components/CopyButton.docs.tsx b/apps/web/src/components/ui/components/CopyButton.docs.tsx
new file mode 100644
index 0000000000..6432329385
--- /dev/null
+++ b/apps/web/src/components/ui/components/CopyButton.docs.tsx
@@ -0,0 +1,64 @@
+import { defineDoc } from '@app/features/ui-gallery/types';
+import CopyIcon from '@phosphor/copy.svg';
+import { For } from 'solid-js';
+import { CopyButton } from './CopyButton';
+
+// #region demo:variants
+function VariantsDemo() {
+ return (
+ <div class="flex flex-wrap items-center gap-3">
+ <For each={['ghost', 'outline', 'strong'] as const}>
+ {(variant) => (
+ <CopyButton
+ variant={variant}
+ onClick={() => navigator.clipboard.writeText('Copied from Macro')}
+ >
+ <CopyIcon />
+ Copy {variant}
+ </CopyButton>
+ )}
+ </For>
+ </div>
+ );
+}
+// #endregion
+
+// #region demo:sizes
+function SizesDemo() {
+ return (
+ <div class="flex items-center gap-3">
+ <For each={['sm', 'md', 'lg', 'icon-md'] as const}>
+ {(size) => (
+ <CopyButton
+ size={size}
+ variant="outline"
+ label="Copy example"
+ onClick={() => navigator.clipboard.writeText('Copied from Macro')}
+ >
+ <CopyIcon />
+ {size !== 'icon-md' && 'Copy'}
+ </CopyButton>
+ )}
+ </For>
+ </div>
+ );
+}
+// #endregion
+
+export default defineDoc({
+ name: 'CopyButton',
+ category: 'Actions',
+ description:
+ 'A normal Button that fades its first icon to a solid green check-circle after its onClick handler succeeds. Return the copy promise; return false or reject on failure. Text-only buttons keep their content unchanged.',
+ status: 'stable',
+ exports: ['CopyButton'],
+ import: "import { CopyButton } from '@ui';",
+ demos: [
+ {
+ id: 'variants',
+ title: 'Variants and success feedback',
+ render: VariantsDemo,
+ },
+ { id: 'sizes', title: 'Copy feedback at each size', render: SizesDemo },
+ ],
+});
diff --git a/apps/web/src/components/ui/components/CopyButton.test.tsx b/apps/web/src/components/ui/components/CopyButton.test.tsx
new file mode 100644
index 0000000000..155ba293c1
--- /dev/null
+++ b/apps/web/src/components/ui/components/CopyButton.test.tsx
@@ -0,0 +1,164 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { ButtonGroup } from './ButtonGroup';
+import { CopyButton } from './CopyButton';
+
+const cancel = vi.fn();
+const connectedAtAnimation: boolean[] = [];
+const animate = vi.fn<Element['animate']>(function (this: Element) {
+ connectedAtAnimation.push(this.isConnected);
+ return { cancel } as unknown as Animation;
+});
+const originalAnimate = Object.getOwnPropertyDescriptor(
+ Element.prototype,
+ 'animate'
+);
+
+beforeEach(() => {
+ vi.useFakeTimers();
+ vi.stubGlobal(
+ 'matchMedia',
+ vi.fn(() => ({ matches: false }))
+ );
+ Object.defineProperty(Element.prototype, 'animate', {
+ configurable: true,
+ value: animate,
+ });
+});
+
+afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+ vi.clearAllMocks();
+ connectedAtAnimation.length = 0;
+ if (originalAnimate)
+ Object.defineProperty(Element.prototype, 'animate', originalAnimate);
+ else Reflect.deleteProperty(Element.prototype, 'animate');
+});
+
+describe('CopyButton', () => {
+ it('copies inside editor containers that stop native click propagation', async () => {
+ const copy = vi.fn().mockResolvedValue(undefined);
+ const view = render(() => (
+ <div on:click={(event) => event.stopPropagation()}>
+ <CopyButton onClick={copy} label="Copy code">
+ <svg />
+ </CopyButton>
+ </div>
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'Copy code' }));
+ await Promise.resolve();
+ expect(copy).toHaveBeenCalledOnce();
+ expect(view.container.querySelector('[data-copy-feedback]')).not.toBeNull();
+ });
+
+ it('waits for success, preserves the existing icon, and restores it after feedback', async () => {
+ let complete!: () => void;
+ const copy = vi.fn(
+ () => new Promise<void>((resolve) => (complete = resolve))
+ );
+ let forwardedRef: HTMLButtonElement | undefined;
+ render(() => (
+ <ButtonGroup variant="outline" size="md">
+ <CopyButton ref={(element) => (forwardedRef = element)} onClick={copy}>
+ <svg aria-hidden="true" style={{ width: '18px', height: '18px' }} />
+ Copy
+ </CopyButton>
+ </ButtonGroup>
+ ));
+ const button = screen.getByRole('button', { name: 'Copy' });
+ const original = button.querySelector('svg')!;
+ vi.spyOn(original, 'getBoundingClientRect').mockReturnValue({
+ left: 8,
+ top: 7,
+ width: 18,
+ height: 18,
+ } as DOMRect);
+ expect(forwardedRef).toBe(button);
+ expect(button.getAttribute('data-variant')).toBe('outline');
+ expect(button.getAttribute('data-size')).toBe('md');
+ fireEvent.click(button);
+ fireEvent.click(button);
+ expect(copy).toHaveBeenCalledTimes(1);
+ expect(button.querySelector('[data-copy-feedback]')).toBeNull();
+ complete();
+ await Promise.resolve();
+ const check = button.querySelector<SVGElement>('[data-copy-feedback]')!;
+ expect(check.style.width).toBe('18px');
+ expect(check.style.height).toBe('18px');
+ expect(button.querySelector('svg')).toBe(original);
+ expect(button.textContent).toBe('Copy');
+ expect(connectedAtAnimation).toEqual([true, true]);
+ await vi.advanceTimersByTimeAsync(1600);
+ expect(button.querySelector('[data-copy-feedback]')).toBeNull();
+ expect(cancel).toHaveBeenCalled();
+ });
+
+ it.each([() => false, () => Promise.reject(new Error('denied'))])(
+ 'does not signal success on a failed copy',
+ async (copy) => {
+ render(() => (
+ <CopyButton onClick={copy}>
+ <svg />
+ Copy
+ </CopyButton>
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'Copy' }));
+ await Promise.resolve();
+ expect(animate).not.toHaveBeenCalled();
+ }
+ );
+
+ it('preserves bound handlers and leaves text-only buttons unchanged', async () => {
+ const copy = vi.fn();
+ render(() => <CopyButton onClick={[copy, 'text']}>Copy</CopyButton>);
+ const button = screen.getByRole('button', { name: 'Copy' });
+ fireEvent.click(button);
+ await Promise.resolve();
+ expect(copy.mock.calls[0][0]).toBe('text');
+ expect(button.querySelector('svg')).toBeNull();
+ });
+
+ it('does not animate after unmount while a copy is pending', async () => {
+ let complete!: () => void;
+ const view = render(() => (
+ <CopyButton
+ onClick={() => new Promise<void>((resolve) => (complete = resolve))}
+ >
+ <svg />
+ Copy
+ </CopyButton>
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'Copy' }));
+ view.unmount();
+ complete();
+ await Promise.resolve();
+ expect(animate).not.toHaveBeenCalled();
+ });
+
+ it('respects reduced motion and disabled buttons', async () => {
+ vi.mocked(window.matchMedia).mockReturnValue({
+ matches: true,
+ } as MediaQueryList);
+ const copy = vi.fn();
+ render(() => (
+ <CopyButton onClick={copy}>
+ <svg />
+ Copy
+ </CopyButton>
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'Copy' }));
+ await Promise.resolve();
+ expect(animate.mock.calls[0][1]).toMatchObject({ duration: 0 });
+ cleanup();
+ render(() => (
+ <CopyButton disabled onClick={copy}>
+ Disabled
+ </CopyButton>
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'Disabled' }));
+ expect(copy).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/apps/web/src/components/ui/components/CopyButton.tsx b/apps/web/src/components/ui/components/CopyButton.tsx
new file mode 100644
index 0000000000..88f8789691
--- /dev/null
+++ b/apps/web/src/components/ui/components/CopyButton.tsx
@@ -0,0 +1,137 @@
+import CheckCircle from '@phosphor-fill/check-circle-fill.svg';
+import { mergeRefs } from '@solid-primitives/refs';
+import {
+ createSignal,
+ type JSX,
+ onCleanup,
+ onMount,
+ Show,
+ splitProps,
+} from 'solid-js';
+import { Button, type ButtonProps } from './Button';
+
+export type CopyButtonProps = ButtonProps;
+
+const TRANSITION_MS = 160;
+const SUCCESS_MS = 1400;
+
+/**
+ * Button with copy-success feedback, using the same props and children.
+ * The first SVG fades to a check-circle without changing its layout or size.
+ *
+ * @do Return the clipboard promise from onClick so feedback waits for success.
+ * @do Return false (or reject) when copying fails; report errors in the handler.
+ * @dont Discard the promise with `void` inside onClick.
+ */
+export function CopyButton(props: CopyButtonProps) {
+ const [local, rest] = splitProps(props, ['onClick', 'children', 'ref']);
+ const [feedback, setFeedback] = createSignal<JSX.CSSProperties>();
+ let button!: HTMLButtonElement;
+ let check: SVGSVGElement | undefined;
+ let animations: Animation[] = [];
+ let resetTimer: ReturnType<typeof setTimeout> | undefined;
+ let exitTimer: ReturnType<typeof setTimeout> | undefined;
+ let pending = false;
+ let disposed = false;
+
+ function clearFeedback() {
+ clearTimeout(resetTimer);
+ clearTimeout(exitTimer);
+ for (const animation of animations) animation.cancel();
+ animations = [];
+ setFeedback(undefined);
+ check = undefined;
+ }
+
+ onCleanup(() => {
+ disposed = true;
+ clearFeedback();
+ });
+
+ function animate(element: SVGSVGElement, entering: boolean) {
+ const frames = [
+ { opacity: 0, scale: '0.75', transformOrigin: 'center' },
+ { opacity: 1, scale: '1', transformOrigin: 'center' },
+ ];
+ animations.push(
+ element.animate(entering ? frames : frames.toReversed(), {
+ duration: window.matchMedia('(prefers-reduced-motion: reduce)').matches
+ ? 0
+ : TRANSITION_MS,
+ easing: 'cubic-bezier(0.2, 0.8, 0.2, 1)',
+ fill: 'forwards',
+ })
+ );
+ }
+
+ function showSuccess() {
+ clearFeedback();
+ const icon = button.querySelector<SVGSVGElement>('svg');
+ if (!icon) return;
+ const iconRect = icon.getBoundingClientRect();
+ const buttonRect = button.getBoundingClientRect();
+ animate(icon, false);
+ setFeedback({
+ left: `${iconRect.left - buttonRect.left - button.clientLeft}px`,
+ top: `${iconRect.top - buttonRect.top - button.clientTop}px`,
+ width: `${iconRect.width}px`,
+ height: `${iconRect.height}px`,
+ });
+ resetTimer = setTimeout(() => {
+ for (const animation of animations) animation.cancel();
+ animations = [];
+ animate(icon, true);
+ if (check) animate(check, false);
+ exitTimer = setTimeout(clearFeedback, TRANSITION_MS);
+ }, SUCCESS_MS);
+ }
+
+ const onClick: JSX.EventHandler<HTMLButtonElement, MouseEvent> = async (
+ event
+ ) => {
+ const handler = local.onClick;
+ if (!handler || pending || button.disabled) return;
+ pending = true;
+ clearFeedback();
+ try {
+ const result: unknown = await (typeof handler === 'function'
+ ? handler(event)
+ : handler[0](handler[1], event));
+ if (!disposed && result !== false) showSuccess();
+ } catch {
+ // The caller owns error reporting; rejected copies never show success.
+ } finally {
+ pending = false;
+ }
+ };
+
+ function FeedbackIcon(props: { style: JSX.CSSProperties }) {
+ let icon!: SVGSVGElement;
+ onMount(() => {
+ check = icon;
+ animate(icon, true);
+ });
+ return (
+ <CheckCircle
+ ref={icon}
+ data-copy-feedback
+ aria-hidden="true"
+ class="pointer-events-none absolute text-success opacity-0"
+ style={props.style}
+ />
+ );
+ }
+
+ return (
+ <Button
+ {...rest}
+ ref={mergeRefs((element) => (button = element), local.ref)}
+ on:click={onClick}
+ >
+ {local.children}
+ <Show when={feedback()}>
+ {(style) => <FeedbackIcon style={style()} />}
+ </Show>
+ </Button>
+ );
+}
diff --git a/apps/web/src/components/ui/index.ts b/apps/web/src/components/ui/index.ts
index 53579118f7..1f8c6f8d3e 100644
--- a/apps/web/src/components/ui/index.ts
+++ b/apps/web/src/components/ui/index.ts
@@ -64,6 +64,7 @@ export type {
ConfirmDialogProps,
} from './components/ConfirmDialog';
export { ConfirmDialog, confirmDialog } from './components/ConfirmDialog';
+export { CopyButton, type CopyButtonProps } from './components/CopyButton';
export type { DeleteDialogProps } from './components/DeleteDialog';
export { DeleteDialog } from './components/DeleteDialog';
export type { DialogProps } from './components/Dialog';
diff --git a/apps/web/src/components/view-shell/ViewShell.tsx b/apps/web/src/components/view-shell/ViewShell.tsx
index 9f5ccb4367..d322a9dc58 100644
--- a/apps/web/src/components/view-shell/ViewShell.tsx
+++ b/apps/web/src/components/view-shell/ViewShell.tsx
@@ -643,7 +643,7 @@ function TopBar(props: JSX.HTMLAttributes<HTMLDivElement>) {
{...rest}
ref={mergeRefs(local.ref, tourTarget(VIEW_SHELL_TOUR.topBar))}
class={cn(
- 'flex h-12 min-w-0 shrink-0 items-center gap-1 px-2 py-3 not-touch:pl-[13px] touch:hidden',
+ '@container/split-header flex h-12 min-w-0 shrink-0 items-center gap-1 px-2 py-3 not-touch:pl-[13px] touch:hidden',
local.class
)}
data-view-shell-top-bar=""
diff --git a/apps/web/src/features/agents-view/components/AgentSessionPane.tsx b/apps/web/src/features/agents-view/components/AgentSessionPane.tsx
index 7e914e4530..e8e5fe8f32 100644
--- a/apps/web/src/features/agents-view/components/AgentSessionPane.tsx
+++ b/apps/web/src/features/agents-view/components/AgentSessionPane.tsx
@@ -135,7 +135,7 @@ function SessionContent(props: {
active={panel.isPanelActive()}
notificationSource={props.notificationSource}
/>
- <SidePanel.Root defaultOpen={false} persistKey="agent">
+ <SidePanel.Root floating defaultOpen={false} persistKey="agent">
<Topbar
title={title()}
titleContent={
@@ -229,7 +229,7 @@ function SessionContent(props: {
<SidePanel.Toggle />
</Topbar>
<div class="relative min-h-0 min-w-0 flex-1">
- <SidePanel.Layout headerToggle={false}>
+ <SidePanel.Layout headerToggle={false} floating>
<AgentSidePanelSections />
<section
class="page pane size-full min-w-0"
diff --git a/apps/web/src/features/agents-view/components/Topbar.tsx b/apps/web/src/features/agents-view/components/Topbar.tsx
index 933a7845d1..56a460b7d9 100644
--- a/apps/web/src/features/agents-view/components/Topbar.tsx
+++ b/apps/web/src/features/agents-view/components/Topbar.tsx
@@ -35,7 +35,7 @@ export function Topbar(props: {
</h1>
)}
</div>
- <div class="header-actions ml-auto flex shrink-0 items-center gap-2">
+ <div class="header-actions ml-auto flex shrink-0 items-center gap-1">
{props.children}
</div>
</ViewShell.TopBar>
diff --git a/apps/web/src/features/block-agent/component/Block.tsx b/apps/web/src/features/block-agent/component/Block.tsx
index 2b16d30ead..5d812f2117 100644
--- a/apps/web/src/features/block-agent/component/Block.tsx
+++ b/apps/web/src/features/block-agent/component/Block.tsx
@@ -13,7 +13,6 @@ import { useNavigatedFromJK } from '@components/app/useNavigatedFromJK';
import { useBlockId } from '@core/block';
import { LoadErrorPanel } from '@core/component/EntityLoadGate';
import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { nativeNetworkStatus } from '@core/mobile/native-network-status';
import { createMethodRegistration } from '@core/orchestrator';
import { blockHandleSignal } from '@core/signal/load';
@@ -50,22 +49,6 @@ function AgentComposerRegion(props: ParentProps) {
);
}
-function AgentContentLayout(props: ParentProps) {
- return (
- <Show
- when={isTouchDevice()}
- fallback={
- <SidePanel.Layout defaultOpen={false}>
- <AgentSidePanelSections />
- {props.children}
- </SidePanel.Layout>
- }
- >
- <div class="flex size-full min-w-0 flex-col">{props.children}</div>
- </Show>
- );
-}
-
function AgentBlockContent(props: {
active: boolean;
notificationSource: NotificationSource;
@@ -166,7 +149,8 @@ function AgentBlockContent(props: {
<div class="size-full overflow-hidden flex">
{/* Collapsed by default, like the other conversation-shaped blocks —
the transcript wants the width; `]` or the header button opens it. */}
- <AgentContentLayout>
+ <SidePanel.Layout defaultOpen={false} floating>
+ <AgentSidePanelSections />
<AgentSplitHeader
session={session()}
title={metadata()?.title ?? undefined}
@@ -207,7 +191,7 @@ function AgentBlockContent(props: {
</div>
</AgentComposerRegion>
</AgentChangesSplit>
- </AgentContentLayout>
+ </SidePanel.Layout>
</div>
</StaticMarkdownContext>
</Show>
diff --git a/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx b/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx
index 1c44d5821a..9683ad5da0 100644
--- a/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx
+++ b/apps/web/src/features/block-agent/component/sidepanel/AgentSidePanelSections.tsx
@@ -12,9 +12,9 @@
import { DiffCounts } from '@app/components/diff-view';
import { useOptionalAgentChanges } from '@app/features/agent-changes/context/agent-changes-controller';
import { SidePanel } from '@components/app/side-panel';
+import { EntityMetadata } from '@components/app/side-panel/EntityMetadata';
import { ModelIcon } from '@core/component/AI/component/ProviderIcon';
import { References } from '@core/component/References';
-import { formatDate } from '@core/util/date';
import { openExternalUrl } from '@core/util/url';
import GitBranch from '@phosphor/git-branch.svg';
import { useAttachmentReferencesQuery } from '@queries/storage/attachment-references';
@@ -42,7 +42,14 @@ export function AgentSidePanelSections() {
return (
<>
- <SidePanel.Section id="details" title="Details" defaultOpen order={10}>
+ <SidePanel.Footer>
+ <EntityMetadata
+ ownerId={session()?.ownerId}
+ createdAt={session()?.createdAt}
+ updatedAt={session()?.modifiedAt}
+ />
+ </SidePanel.Footer>
+ <SidePanel.Section id="session" title="Session" defaultOpen order={10}>
<SidePanel.Grid>
<SidePanel.Row label="Status">
<SessionStatusPill status={sessionStatus(metadata())} />
@@ -101,28 +108,6 @@ export function AgentSidePanelSections() {
</SidePanel.Row>
)}
</Show>
- <Show when={session()?.createdAt}>
- {(created) => (
- <SidePanel.Row label="Created">
- <SidePanel.Pill>
- <span class="truncate">
- {formatDate(created(), { showTime: true })}
- </span>
- </SidePanel.Pill>
- </SidePanel.Row>
- )}
- </Show>
- <Show when={session()?.modifiedAt}>
- {(modified) => (
- <SidePanel.Row label="Last updated">
- <SidePanel.Pill>
- <span class="truncate">
- {formatDate(modified(), { showTime: true })}
- </span>
- </SidePanel.Pill>
- </SidePanel.Row>
- )}
- </Show>
</SidePanel.Grid>
</SidePanel.Section>
diff --git a/apps/web/src/features/block-call/component/CallBlockAdapter.tsx b/apps/web/src/features/block-call/component/CallBlockAdapter.tsx
index a8b2356f3a..33254c3f73 100644
--- a/apps/web/src/features/block-call/component/CallBlockAdapter.tsx
+++ b/apps/web/src/features/block-call/component/CallBlockAdapter.tsx
@@ -128,7 +128,7 @@ export function CallBlockAdapter(props: CallBlockProps) {
<div class="h-full flex flex-col @container">
<Show when={callRecord.isPending ? undefined : callRecord.data}>
{(data) => (
- <SidePanel.Layout>
+ <SidePanel.Layout floating>
<CallSidePanelSections record={data()} callId={callId} />
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden @container">
<CallRecordingSplitHeader record={data()} />
diff --git a/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx b/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx
index c7fd04e5ec..62a50dda49 100644
--- a/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx
+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx
@@ -147,13 +147,8 @@ export function CallRecordingBody(props: {
return (
<div class="relative flex-1 min-h-0 overflow-hidden">
- <SidePanel.Section
- id="call-ai-actions"
- title="Actions"
- defaultOpen
- order={0}
- >
- <div class="m-px flex items-center justify-start gap-2">
+ <SidePanel.HeaderActions>
+ <div class="flex shrink-0 items-center gap-1">
<AskMacroButton
entity={{
type: 'document',
@@ -163,7 +158,7 @@ export function CallRecordingBody(props: {
}}
/>
</div>
- </SidePanel.Section>
+ </SidePanel.HeaderActions>
<div
data-channel-scroll
class="h-full min-h-0 overflow-y-auto scrollbar-hidden"
diff --git a/apps/web/src/features/block-call/component/sidepanel/CallSidePanelSections.tsx b/apps/web/src/features/block-call/component/sidepanel/CallSidePanelSections.tsx
index b7c0420f17..9d6d86e626 100644
--- a/apps/web/src/features/block-call/component/sidepanel/CallSidePanelSections.tsx
+++ b/apps/web/src/features/block-call/component/sidepanel/CallSidePanelSections.tsx
@@ -2,12 +2,10 @@ import { EntityActivitySectionConditional } from '@app/features/activity/views/e
import { EntityPropertiesSection } from '@app/features/property/side-panel/properties';
import { useCallContextOptional } from '@channel/Call/CallContext';
import { SidePanel } from '@components/app/side-panel';
+import { EntityMetadata } from '@components/app/side-panel/EntityMetadata';
import { References } from '@core/component/References';
-import { UserIcon } from '@core/component/UserIcon';
import { useUserId } from '@core/context/user';
-import { getDisplayName, tryMacroId } from '@core/user';
import { type DateValue, formatDate } from '@core/util/date';
-import ClockIcon from '@phosphor/clock.svg';
import {
isCallSharedWithTeam,
useSetCallRecordTeamShareMutation,
@@ -27,9 +25,9 @@ interface CallSidePanelSectionsProps {
export function CallSidePanelSections(props: CallSidePanelSectionsProps) {
return (
<>
- <SidePanel.Section id="details" title="Details" defaultOpen order={10}>
+ <SidePanel.Footer>
<DetailsSectionContent record={props.record} />
- </SidePanel.Section>
+ </SidePanel.Footer>
<SidePanel.Section
id="properties"
title="Properties"
@@ -63,46 +61,20 @@ function DetailsSectionContent(props: { record: CallRecord }) {
const durationMs = () => record().durationMs ?? undefined;
return (
- <SidePanel.Grid>
- <SidePanel.Row label="Owner">
- <OwnerValue ownerId={record().createdBy} />
- </SidePanel.Row>
+ <EntityMetadata ownerId={record().createdBy}>
<Show when={startedAt()}>
{(value) => (
- <SidePanel.Row label="Started">
- <DateValueDisplay value={value()} />
- </SidePanel.Row>
+ <div>Started {formatDate(value(), { showTime: true })}</div>
)}
</Show>
<Show when={endedAt()}>
- {(value) => (
- <SidePanel.Row label="Ended">
- <DateValueDisplay value={value()} />
- </SidePanel.Row>
- )}
+ {(value) => <div>Ended {formatDate(value(), { showTime: true })}</div>}
</Show>
<Show when={durationMs()}>
- {(ms) => (
- <SidePanel.Row label="Duration">
- <SidePanel.Pill>
- <ClockIcon class="size-3 shrink-0" />
- <span class="truncate">{formatCallDuration(ms())}</span>
- </SidePanel.Pill>
- </SidePanel.Row>
- )}
+ {(ms) => <div>{formatCallDuration(ms())}</div>}
</Show>
- <SidePanel.Row label="Status">
- <SidePanel.Pill>
- <Show
- when={record().isActive}
- fallback={<span class="truncate text-ink-muted">Ended</span>}
- >
- <span class="size-2 rounded-full bg-success shrink-0" />
- <span class="truncate text-success font-medium">In progress</span>
- </Show>
- </SidePanel.Pill>
- </SidePanel.Row>
- </SidePanel.Grid>
+ <div>{record().isActive ? 'In progress' : 'Ended'}</div>
+ </EntityMetadata>
);
}
@@ -122,27 +94,6 @@ function PropertiesSectionContent(props: { record: CallRecord }) {
);
}
-function OwnerValue(props: { ownerId: string }) {
- const displayName = () => getDisplayName(tryMacroId(props.ownerId));
- return (
- <SidePanel.Pill>
- <UserIcon id={props.ownerId} size="sm" showTooltip suppressClick />
- <span class="truncate">{displayName()}</span>
- </SidePanel.Pill>
- );
-}
-
-function DateValueDisplay(props: { value: DateValue }) {
- return (
- <SidePanel.Pill>
- <ClockIcon class="size-3 shrink-0" />
- <span class="truncate">
- {formatDate(props.value, { showTime: true })}
- </span>
- </SidePanel.Pill>
- );
-}
-
// ─────────────────────────────────────────────────────────────────────────────
// Sharing Section
// ─────────────────────────────────────────────────────────────────────────────
diff --git a/apps/web/src/features/block-call/views/CallDetailView.tsx b/apps/web/src/features/block-call/views/CallDetailView.tsx
index eaf393d852..a54bf122ab 100644
--- a/apps/web/src/features/block-call/views/CallDetailView.tsx
+++ b/apps/web/src/features/block-call/views/CallDetailView.tsx
@@ -1,5 +1,4 @@
import { ViewShell } from '@app/components/view-shell';
-import { ChatWithAgentButton } from '@app/features/chat/ChatWithAgentButton';
import { createSearchParams } from '@app/lib/split-router';
import { SidePanel } from '@components/app/side-panel';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
@@ -73,21 +72,14 @@ export function CallDetailActions(props: {
}));
return (
- <div class="ml-auto flex shrink-0 items-center gap-2">
+ <div class="ml-auto flex shrink-0 items-center gap-1">
<Show when={!isMobile() && !props.record.isActive && canCallAgain()}>
<Button variant="outline" size="sm" onClick={callAgain}>
<PhoneCallIcon class="size-4" />
Call Again
</Button>
</Show>
- <ChatWithAgentButton
- entity={{
- type: 'document',
- id: props.callId,
- name: props.name,
- fileType: 'call',
- }}
- />
+ <SidePanel.HeaderActionsOutlet />
<ShareTrigger
onClick={openShare}
id={props.callId}
@@ -102,7 +94,7 @@ export function CallDetailActions(props: {
/** Keep side-panel state alive across call-record query updates. */
export function CallDetailRoot(props: ParentProps<{ callId: string }>) {
return (
- <SidePanel.Root persistKey={`call:${props.callId}`}>
+ <SidePanel.Root floating persistKey={`call:${props.callId}`}>
{props.children}
</SidePanel.Root>
);
@@ -123,7 +115,7 @@ function LoadedCallContent(props: {
}
});
return (
- <SidePanel.Layout headerToggle={false}>
+ <SidePanel.Layout headerToggle={false} floating>
<CallSidePanelSections callId={props.callId} record={props.record} />
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<CallRecordingBody
diff --git a/apps/web/src/features/block-canvas/component/Block.tsx b/apps/web/src/features/block-canvas/component/Block.tsx
index 1382ec9982..acadb9fefd 100644
--- a/apps/web/src/features/block-canvas/component/Block.tsx
+++ b/apps/web/src/features/block-canvas/component/Block.tsx
@@ -59,7 +59,7 @@ export default function BlockCanvas(props: BlockCanvasProps) {
}}
>
<Show when={!isNested} fallback={content}>
- <SidePanel.Layout defaultOpen={false}>
+ <SidePanel.Layout defaultOpen={false} floating>
<FileSidePanelSections />
<div class="flex size-full min-w-0 flex-col overflow-hidden">
<TopBar />
diff --git a/apps/web/src/features/block-chat/component/Block.tsx b/apps/web/src/features/block-chat/component/Block.tsx
index 73acb4f867..521600c81a 100644
--- a/apps/web/src/features/block-chat/component/Block.tsx
+++ b/apps/web/src/features/block-chat/component/Block.tsx
@@ -24,7 +24,7 @@ export default function ChatBlock() {
notificationSource={notificationSource}
entity={{ type: 'chat', id: blockId }}
/>
- <SidePanel.Layout defaultOpen={false}>
+ <SidePanel.Layout defaultOpen={false} floating>
<ChatSidePanelSections />
<Show when={chatBlockData()}>{(data) => <Chat data={data()} />}</Show>
</SidePanel.Layout>
diff --git a/apps/web/src/features/block-chat/component/sidepanel/ChatSidePanelSections.tsx b/apps/web/src/features/block-chat/component/sidepanel/ChatSidePanelSections.tsx
index af69342d73..62e7a3e8a3 100644
--- a/apps/web/src/features/block-chat/component/sidepanel/ChatSidePanelSections.tsx
+++ b/apps/web/src/features/block-chat/component/sidepanel/ChatSidePanelSections.tsx
@@ -3,12 +3,8 @@ import {
EntityPropertiesSection,
EntityTagsSection,
} from '@app/features/property/side-panel/properties';
-import {
- DateValueDisplay,
- FolderLink,
- OwnerValue,
- SidePanel,
-} from '@components/app/side-panel';
+import { FolderLink, SidePanel } from '@components/app/side-panel';
+import { EntityMetadata } from '@components/app/side-panel/EntityMetadata';
import { useBlockId } from '@core/block';
import { useCanEdit } from '@core/signal/permissions';
import { useChatDataQuery } from '@queries/cognition/chat-data';
@@ -21,11 +17,11 @@ export function ChatSidePanelSections() {
return (
<>
- <SidePanel.Section id="details" title="Details" defaultOpen order={10}>
+ <SidePanel.Footer>
<Suspense fallback={<SidePanel.Loading />}>
<ChatDetailsContent chatId={chatId} />
</Suspense>
- </SidePanel.Section>
+ </SidePanel.Footer>
<EntityTagsSection
entityId={chatId}
entityType="CHAT"
@@ -59,14 +55,11 @@ function ChatDetailsContent(props: { chatId: string }) {
);
return (
- <SidePanel.Grid>
- <Show when={chat()?.userId}>
- {(ownerId) => (
- <SidePanel.Row label="Owner">
- <OwnerValue ownerId={ownerId()} />
- </SidePanel.Row>
- )}
- </Show>
+ <EntityMetadata
+ ownerId={chat()?.userId}
+ createdAt={chat()?.createdAt}
+ updatedAt={chat()?.updatedAt}
+ >
<Show
when={(() => {
const id = chat()?.projectId;
@@ -75,26 +68,13 @@ function ChatDetailsContent(props: { chatId: string }) {
})()}
>
{(folder) => (
- <SidePanel.Row label="Folder">
+ <div class="flex items-center gap-1">
+ Folder
<FolderLink projectId={folder().id} projectName={folder().name} />
- </SidePanel.Row>
- )}
- </Show>
- <Show when={chat()?.createdAt}>
- {(created) => (
- <SidePanel.Row label="Created">
- <DateValueDisplay value={created()} />
- </SidePanel.Row>
- )}
- </Show>
- <Show when={chat()?.updatedAt}>
- {(updated) => (
- <SidePanel.Row label="Last updated">
- <DateValueDisplay value={updated()} />
- </SidePanel.Row>
+ </div>
)}
</Show>
- </SidePanel.Grid>
+ </EntityMetadata>
);
}
diff --git a/apps/web/src/features/block-code/component/Block.tsx b/apps/web/src/features/block-code/component/Block.tsx
index 7ebb7400ce..3addd56dfd 100644
--- a/apps/web/src/features/block-code/component/Block.tsx
+++ b/apps/web/src/features/block-code/component/Block.tsx
@@ -56,7 +56,7 @@ export default function BlockCode() {
<DocumentBlockContainer usesCenterBar>
<Show when={!isNestedBlock} fallback={<CodeMarkdown />}>
<div class="size-full select-none overscroll-none overflow-hidden flex flex-col items-end relative">
- <SidePanel.Layout defaultOpen={false}>
+ <SidePanel.Layout defaultOpen={false} floating>
<FileSidePanelSections />
<div class="flex size-full min-w-0 flex-col items-end overflow-hidden">
<TopBar
diff --git a/apps/web/src/features/block-email/EmailThreadHostView.tsx b/apps/web/src/features/block-email/EmailThreadHostView.tsx
index 4e16741dac..e1eca65e28 100644
--- a/apps/web/src/features/block-email/EmailThreadHostView.tsx
+++ b/apps/web/src/features/block-email/EmailThreadHostView.tsx
@@ -74,6 +74,7 @@ export function EmailThreadHostView(props: EmailThreadHostViewProps) {
<>
{props.chrome?.({ createTask })}
<SidePanel.Layout
+ floating
defaultOpen={false}
headerToggle={props.sidePanelHeaderToggle}
>
@@ -92,13 +93,8 @@ export function EmailThreadHostView(props: EmailThreadHostViewProps) {
function ThreadActions(props: { title: string; onCreateTask: () => void }) {
const context = useEmailThreadState();
return (
- <SidePanel.Section
- id="email-ai-actions"
- title="Actions"
- defaultOpen
- order={0}
- >
- <div class="m-px flex items-center justify-start gap-2">
+ <SidePanel.HeaderActions>
+ <div class="flex shrink-0 items-center gap-1">
<Show when={context.thread()?.db_id}>
{(id) => (
<AskMacroButton
@@ -110,6 +106,6 @@ function ThreadActions(props: { title: string; onCreateTask: () => void }) {
<EmailTaskButton onClick={props.onCreateTask} />
</Show>
</div>
- </SidePanel.Section>
+ </SidePanel.HeaderActions>
);
}
diff --git a/apps/web/src/features/block-email/component/EmailTaskButton.tsx b/apps/web/src/features/block-email/component/EmailTaskButton.tsx
index f3d1691b42..e0b9a55791 100644
--- a/apps/web/src/features/block-email/component/EmailTaskButton.tsx
+++ b/apps/web/src/features/block-email/component/EmailTaskButton.tsx
@@ -1,17 +1,12 @@
+import { HeaderActionButton } from '@components/app/HeaderActionButton';
import TaskIcon from '@phosphor/list-checks.svg';
-import { Button } from '@ui';
export function EmailTaskButton(props: { onClick: () => void }) {
return (
- <Button
- tooltip="Create Task"
- variant="ghost"
- size="sm"
+ <HeaderActionButton
+ tooltip="Create task"
+ label="Create task"
onClick={props.onClick}
- depth={2}
- class="gap-1.5 border border-edge-muted px-2 text-ink-extra-muted"
- >
- <TaskIcon />
- <span class="text-xs font-semibold">Task</span>
- </Button>
+ icon={<TaskIcon />}
+ />
);
}
diff --git a/apps/web/src/features/block-email/component/sidepanel/EmailSidePanelSections.test.tsx b/apps/web/src/features/block-email/component/sidepanel/EmailSidePanelSections.test.tsx
index 2717d8be72..225bc4eead 100644
--- a/apps/web/src/features/block-email/component/sidepanel/EmailSidePanelSections.test.tsx
+++ b/apps/web/src/features/block-email/component/sidepanel/EmailSidePanelSections.test.tsx
@@ -15,7 +15,10 @@ vi.mock('@queries/storage/attachment-references', () => ({
vi.mock(
'@app/features/email-thread/context/email-thread-state-context',
() => ({
- useEmailThreadState: () => ({ permissions: () => ({ isOwner: true }) }),
+ useEmailThreadState: () => ({
+ permissions: () => ({ isOwner: true }),
+ thread: () => undefined,
+ }),
})
);
vi.mock('@app/features/activity/views/entity-activity-section', () => ({
@@ -42,6 +45,7 @@ vi.mock('@components/app/side-panel', () => ({
</span>
),
Loading: () => null,
+ Footer: (props: ParentProps) => <footer>{props.children}</footer>,
},
}));
diff --git a/apps/web/src/features/block-email/component/sidepanel/EmailSidePanelSections.tsx b/apps/web/src/features/block-email/component/sidepanel/EmailSidePanelSections.tsx
index 829d2f29e4..3d93d85fd7 100644
--- a/apps/web/src/features/block-email/component/sidepanel/EmailSidePanelSections.tsx
+++ b/apps/web/src/features/block-email/component/sidepanel/EmailSidePanelSections.tsx
@@ -5,6 +5,7 @@ import {
EntityTagsSection,
} from '@app/features/property/side-panel/properties';
import { SidePanel } from '@components/app/side-panel';
+import { EntityMetadata } from '@components/app/side-panel/EntityMetadata';
import { References } from '@core/component/References';
import { queryReadyGate } from '@queries/gate';
import { useAttachmentReferencesQuery } from '@queries/storage/attachment-references';
@@ -50,6 +51,12 @@ export function EmailSidePanelSections(props: EmailSidePanelSectionsProps) {
order={40}
/>
<ReferencesSectionConditional threadId={props.threadId} />
+ <SidePanel.Footer>
+ <EntityMetadata
+ createdAt={emailCtx.thread()?.created_at}
+ updatedAt={emailCtx.thread()?.updated_at}
+ />
+ </SidePanel.Footer>
</>
);
}
diff --git a/apps/web/src/features/block-image/component/Block.tsx b/apps/web/src/features/block-image/component/Block.tsx
index 505e0d4329..2179a1953d 100644
--- a/apps/web/src/features/block-image/component/Block.tsx
+++ b/apps/web/src/features/block-image/component/Block.tsx
@@ -30,7 +30,7 @@ export default function BlockImage() {
return (
<DocumentBlockContainer>
<div class="size-full select-none overscroll-none overflow-hidden flex flex-col">
- <SidePanel.Layout defaultOpen={false}>
+ <SidePanel.Layout defaultOpen={false} floating>
<FileSidePanelSections />
<div class="flex size-full min-w-0 flex-col overflow-hidden">
<TopBar />
diff --git a/apps/web/src/features/block-initiative/component/InitiativeBlock.tsx b/apps/web/src/features/block-initiative/component/InitiativeBlock.tsx
index 630b3b1e13..2c3aed209a 100644
--- a/apps/web/src/features/block-initiative/component/InitiativeBlock.tsx
+++ b/apps/web/src/features/block-initiative/component/InitiativeBlock.tsx
@@ -32,7 +32,7 @@ export function InitiativeProject(props: { id: string }) {
>
<ListEntityMetadataQueryProvider>
<ViewBreadcrumbs.Root value={value()} onChange={() => {}}>
- <SidePanel.Root>
+ <SidePanel.Root floating defaultOpen={false}>
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<ProjectDetail
route={{ id: props.id, section: 'overview' }}
diff --git a/apps/web/src/features/block-md/component/Block.tsx b/apps/web/src/features/block-md/component/Block.tsx
index c42d6c4112..87c3880384 100644
--- a/apps/web/src/features/block-md/component/Block.tsx
+++ b/apps/web/src/features/block-md/component/Block.tsx
@@ -31,7 +31,6 @@ import { useInstructionsMdIdQuery } from '@queries/storage/instructions-md';
import { Show, Suspense } from 'solid-js';
import { createMarkdownDocumentState } from '../context/markdown-document-state';
import type { MarkdownData } from '../definition';
-import { OldOverlay } from '../history/OldOverlay';
import { createMarkdownRouteNavigation } from '../primitives/create-markdown-route-navigation';
import { loadMarkdownCachedSnapshot } from '../queries/markdown-document-operations';
import type { MarkdownDocumentKind, MarkdownDocumentSource } from '../types';
@@ -137,8 +136,7 @@ export default function MarkdownBlockAdapter(props: BlockMarkdownProps) {
fallbackName={fallbackName()}
>
<ModalsProvider>
- <OldOverlay />
- <SidePanel.Layout>
+ <SidePanel.Layout floating>
<Show when={ENABLE_MARKDOWN_SIDE_PANEL && !isInstructions()}>
<MarkdownSidePanelSections />
</Show>
diff --git a/apps/web/src/features/block-md/component/DispatchAgentMenu.test.tsx b/apps/web/src/features/block-md/component/DispatchAgentMenu.test.tsx
new file mode 100644
index 0000000000..bb927ce2c2
--- /dev/null
+++ b/apps/web/src/features/block-md/component/DispatchAgentMenu.test.tsx
@@ -0,0 +1,108 @@
+import { render } from '@solidjs/testing-library';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { useDispatchAgentAction } from './DispatchAgentMenu';
+
+const mocks = vi.hoisted(() => ({
+ kind: 'document',
+ shortId: vi.fn(),
+ branchName: vi.fn(),
+ threads: vi.fn(),
+ copy: vi.fn(),
+ success: vi.fn(),
+ failure: vi.fn(),
+}));
+vi.mock('@app/features/integrations/mcp-setup/MacroMcpSetupModal', () => ({
+ openMacroMcpSetupModal: vi.fn(),
+}));
+vi.mock('@core/component/LexicalMarkdown/utils', () => ({
+ editorStateAsMarkdown: () => 'Document body',
+}));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { success: mocks.success, failure: mocks.failure },
+}));
+vi.mock('@core/user', () => ({
+ tryMacroId: () => undefined,
+ macroIdToEmail: (id: string) => id,
+}));
+vi.mock('@core/util/branchName', () => ({
+ copyBranchNameToClipboard: vi.fn(),
+}));
+vi.mock('@queries/messages/document-messages', () => ({
+ fetchDocumentThreads: mocks.threads,
+}));
+vi.mock('@service-storage/client', () => ({
+ storageServiceClient: {
+ getDocumentShortId: mocks.shortId,
+ getDocumentBranchName: mocks.branchName,
+ },
+}));
+vi.mock('../context/markdown-document-context', () => ({
+ useMarkdownDocument: () => ({
+ documentId: () => 'document-id',
+ kind: () => mocks.kind,
+ state: { editor: { md: { editor: {} } } },
+ }),
+}));
+vi.mock('./MarkdownNameProvider', () => ({
+ useMarkdownName: () => ({ displayName: () => 'Example' }),
+}));
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ mocks.kind = 'document';
+ mocks.shortId.mockResolvedValue({ isOk: () => true, value: 'DOC-1' });
+ mocks.branchName.mockResolvedValue({
+ isOk: () => true,
+ value: { shortId: 'TASK-1', branchName: 'work/example' },
+ });
+ mocks.threads.mockResolvedValue([]);
+ mocks.copy.mockResolvedValue(undefined);
+ vi.stubGlobal('navigator', { clipboard: { writeText: mocks.copy } });
+});
+afterEach(() => vi.unstubAllGlobals());
+
+function actions() {
+ let result!: ReturnType<typeof useDispatchAgentAction>;
+ const view = render(() => {
+ result = useDispatchAgentAction();
+ return null;
+ });
+ return { result, dispose: view.unmount };
+}
+
+it('copies document context without asking for a task branch or showing a success toast', async () => {
+ const { result, dispose } = actions();
+ expect(await result.executeLastUsed()).toBe(true);
+ expect(mocks.copy).toHaveBeenCalledWith(
+ expect.stringContaining('<document identifier="DOC-1">')
+ );
+ expect(mocks.copy).toHaveBeenCalledWith(
+ expect.stringContaining('Document body')
+ );
+ expect(mocks.branchName).not.toHaveBeenCalled();
+ expect(mocks.success).not.toHaveBeenCalled();
+ dispose();
+});
+
+it('keeps task branch context and toast feedback for menu actions', async () => {
+ mocks.kind = 'task';
+ const { result, dispose } = actions();
+ expect(await result.executeAction(result.lastUsed())).toBe(true);
+ expect(mocks.copy).toHaveBeenCalledWith(
+ expect.stringContaining('<branch>work/example</branch>')
+ );
+ expect(mocks.shortId).not.toHaveBeenCalled();
+ expect(mocks.success).toHaveBeenCalledOnce();
+ dispose();
+});
+
+it('reports clipboard failure instead of triggering copy success feedback', async () => {
+ mocks.copy.mockRejectedValueOnce(new Error('Clipboard denied'));
+ const error = vi.spyOn(console, 'error').mockImplementation(() => {});
+ const { result, dispose } = actions();
+ expect(await result.executeLastUsed()).toBe(false);
+ expect(mocks.failure).toHaveBeenCalledWith('Failed to generate prompt');
+ expect(mocks.success).not.toHaveBeenCalled();
+ dispose();
+ error.mockRestore();
+});
diff --git a/apps/web/src/features/block-md/component/DispatchAgentMenu.tsx b/apps/web/src/features/block-md/component/DispatchAgentMenu.tsx
index f20f094de6..ffe5b321ee 100644
--- a/apps/web/src/features/block-md/component/DispatchAgentMenu.tsx
+++ b/apps/web/src/features/block-md/component/DispatchAgentMenu.tsx
@@ -19,7 +19,7 @@ import { storageServiceClient } from '@service-storage/client';
import type { MessageThread } from '@service-storage/messages';
import { createCallback } from '@solid-primitives/rootless';
import { makePersisted } from '@solid-primitives/storage';
-import { Button, ButtonGroup, Dropdown } from '@ui';
+import { Button, ButtonGroup, CopyButton, Dropdown } from '@ui';
import { type Component, createSignal, For, type JSX, Show } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { useMarkdownDocument } from '../context/markdown-document-context';
@@ -184,7 +184,7 @@ type AgentAction = {
name: string;
icon: Component<JSX.SvgSVGAttributes<SVGSVGElement>>;
buttonIcon?: Component<JSX.SvgSVGAttributes<SVGSVGElement>>;
- execute: (prompt: string) => void;
+ execute: (prompt: string) => unknown;
};
const COPY_ACTION: AgentAction = {
@@ -192,9 +192,8 @@ const COPY_ACTION: AgentAction = {
name: 'Copy as prompt',
icon: CopyIcon,
buttonIcon: TerminalWindowIcon,
- execute: (prompt) => {
- navigator.clipboard.writeText(prompt);
- toast.success('Prompt copied to clipboard');
+ execute: async (prompt) => {
+ await navigator.clipboard.writeText(prompt);
},
};
@@ -260,14 +259,22 @@ export function useDispatchAgentAction() {
return generate(blockId, docName, content, threads);
});
- const executeAction = async (action: AgentAction) => {
+ const executeAction = async (
+ action: AgentAction,
+ options: { silent?: boolean } = {}
+ ) => {
try {
const prompt = await buildPrompt();
- action.execute(prompt);
+ await action.execute(prompt);
+ if (action.key === 'copy' && !options.silent) {
+ toast.success('Prompt copied to clipboard');
+ }
setLastUsedKey(action.key);
+ return true;
} catch (e) {
console.error('Failed to generate prompt', e);
toast.failure('Failed to generate prompt');
+ return false;
}
};
@@ -276,7 +283,7 @@ export function useDispatchAgentAction() {
isTask,
lastUsed,
executeAction,
- executeLastUsed: () => executeAction(lastUsed()),
+ executeLastUsed: () => executeAction(lastUsed(), { silent: true }),
};
}
@@ -324,29 +331,32 @@ export function DispatchAgentButton(
return (
<Dropdown open={open()} onOpenChange={setOpen}>
<ButtonGroup
- variant="ghost"
- size={props.showPrimaryLabel ? 'sm' : 'icon-sm'}
+ variant="outline"
+ size={props.showPrimaryLabel ? 'md' : 'icon-sm'}
depth={2}
- class="rounded-full border border-edge-muted"
+ class={props.showPrimaryLabel ? 'h-8' : undefined}
>
- <Button
+ <Dynamic
+ component={lastUsed().key === 'copy' ? CopyButton : Button}
onClick={executeLastUsed}
tooltip={lastUsed().name}
- class="bg-transparent hover:bg-ink/[0.04]"
+ class="@max-[600px]/split-header:w-8 @max-[600px]/split-header:p-0"
>
<Dynamic
component={lastUsed().buttonIcon ?? lastUsed().icon}
- class="size-3!"
+ class="size-3.5!"
/>
<Show when={props.showPrimaryLabel}>
- <span class="max-w-36 truncate text-xs font-medium">
+ <span class="max-w-36 truncate @max-[600px]/split-header:hidden">
{lastUsed().name}
</span>
</Show>
- </Button>
+ </Dynamic>
<ButtonGroup.Divider />
<Dropdown.Trigger
- class="bg-transparent p-1 hover:bg-ink/[0.04]"
+ variant="outline"
+ size={props.showPrimaryLabel ? 'md' : 'icon-sm'}
+ class="px-2"
label="Agent options"
>
<CaretDown class="size-3.5!" />
diff --git a/apps/web/src/features/block-md/component/InlinePropertyValue.test.tsx b/apps/web/src/features/block-md/component/InlinePropertyValue.test.tsx
new file mode 100644
index 0000000000..b9f6582450
--- /dev/null
+++ b/apps/web/src/features/block-md/component/InlinePropertyValue.test.tsx
@@ -0,0 +1,91 @@
+import { PropertiesProvider } from '@property/context/PropertiesContext';
+import type { Property } from '@property/types';
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import type { JSX } from 'solid-js';
+import { afterEach, expect, it, vi } from 'vitest';
+import { InlinePropertyValue } from './InlinePropertyValue';
+
+vi.mock('@property/component/PropertyValuePill', () => ({
+ PropertyValuePill: (props: { hoverActions?: JSX.Element }) => (
+ <div>{props.hoverActions}</div>
+ ),
+}));
+vi.mock('@property/editor/state/propertyEditor', () => ({
+ openPropertyEditor: vi.fn(),
+}));
+afterEach(cleanup);
+
+const property: Property = {
+ propertyId: 'assignment',
+ propertyDefinitionId: 'definition',
+ displayName: 'Review notes',
+ valueType: 'STRING',
+ value: 'Keep this value',
+ isMultiSelect: false,
+ owner: { scope: 'system' },
+ createdAt: '2026-01-01',
+ updatedAt: '2026-01-01',
+};
+function setup(canEdit = true) {
+ const remove = vi.fn<() => Promise<void>>().mockResolvedValue(undefined);
+ const unpin = vi.fn();
+ const refresh = vi.fn();
+ render(() => (
+ <PropertiesProvider
+ entityId="doc"
+ entityType="DOCUMENT"
+ canEdit={canEdit}
+ properties={() => [property]}
+ onRefresh={refresh}
+ onPropertyAdded={refresh}
+ onPropertyDeleted={refresh}
+ onPropertyUnpinned={unpin}
+ removeProperty={remove}
+ saveHandler={{ saveProperty: vi.fn(), saveDate: vi.fn() }}
+ >
+ <InlinePropertyValue property={property} entityId="doc" canManage />
+ </PropertiesProvider>
+ ));
+ return { remove, unpin, refresh };
+}
+it('unpins without removing the saved property', async () => {
+ const { remove, unpin } = setup();
+ await fireEvent.click(screen.getByRole('button', { name: 'Unpin' }));
+ expect(unpin).toHaveBeenCalledWith('assignment');
+ expect(remove).not.toHaveBeenCalled();
+});
+it('removes the property assignment and its pin after a successful save', async () => {
+ const { remove, unpin, refresh } = setup();
+ await fireEvent.click(
+ screen.getByRole('button', { name: 'Delete from item' })
+ );
+ await waitFor(() => expect(unpin).toHaveBeenCalledWith('assignment'));
+ expect(remove).toHaveBeenCalledWith('assignment');
+ expect(refresh).toHaveBeenCalledOnce();
+});
+it('keeps the pin if removing the property fails', async () => {
+ const { remove, unpin, refresh } = setup();
+ remove.mockRejectedValue(new Error('Save failed'));
+ await fireEvent.click(
+ screen.getByRole('button', { name: 'Delete from item' })
+ );
+ await waitFor(() =>
+ expect(
+ screen
+ .getByRole('button', { name: 'Delete from item' })
+ .hasAttribute('disabled')
+ ).toBe(false)
+ );
+ expect(unpin).not.toHaveBeenCalled();
+ expect(refresh).not.toHaveBeenCalled();
+});
+it('hides management actions for read-only documents', () => {
+ setup(false);
+ expect(screen.queryByRole('button')).toBeNull();
+});
diff --git a/apps/web/src/features/block-md/component/InlinePropertyValue.tsx b/apps/web/src/features/block-md/component/InlinePropertyValue.tsx
index 24c348e348..14c8793607 100644
--- a/apps/web/src/features/block-md/component/InlinePropertyValue.tsx
+++ b/apps/web/src/features/block-md/component/InlinePropertyValue.tsx
@@ -1,7 +1,11 @@
+import PushPinSlashIcon from '@phosphor/push-pin-slash.svg';
+import TrashIcon from '@phosphor/trash.svg';
import { PropertyValuePill } from '@property/component/PropertyValuePill';
+import { SYSTEM_PROPERTY_IDS } from '@property/constants';
import { usePropertiesContext } from '@property/context/PropertiesContext';
+import { openPropertyEditor } from '@property/editor/state/propertyEditor';
import type { Property as PropertyT } from '@property/types';
-import type { Component, JSX } from 'solid-js';
+import { type Component, createSignal, type JSX, Show } from 'solid-js';
type InlinePropertyValueProps = {
property: PropertyT;
@@ -10,6 +14,7 @@ type InlinePropertyValueProps = {
/** Label rendered when the property is empty. Defaults to "None". */
emptyLabel?: JSX.Element;
class?: string;
+ canManage?: boolean;
};
/**
@@ -22,16 +27,90 @@ export const InlinePropertyValue: Component<InlinePropertyValueProps> = (
props
) => {
const ctx = usePropertiesContext();
+ const usesInlineEditor = () =>
+ ['STRING', 'NUMBER', 'BOOLEAN', 'LINK'].includes(props.property.valueType);
return (
<PropertyValuePill
property={props.property}
+ showLabel={
+ props.property.propertyDefinitionId !== SYSTEM_PROPERTY_IDS.STATUS &&
+ props.property.propertyDefinitionId !== SYSTEM_PROPERTY_IDS.PRIORITY &&
+ !(
+ ctx.entityType === 'TASK' &&
+ props.property.propertyDefinitionId === SYSTEM_PROPERTY_IDS.ASSIGNEES
+ )
+ }
canEdit={ctx.canEdit}
onSave={ctx.saveHandler.saveProperty}
onRefresh={ctx.onRefresh}
+ onEdit={
+ props.entityId && usesInlineEditor()
+ ? (property, anchor) =>
+ openPropertyEditor(
+ [
+ {
+ id: props.entityId!,
+ name: ctx.documentName ?? 'Document',
+ entityType: ctx.entityType,
+ },
+ ],
+ 'direct',
+ property,
+ { restoreFocus: () => anchor?.focus() }
+ )
+ : undefined
+ }
class={props.class}
emptyLabel={props.emptyLabel}
+ hoverActions={
+ <Show
+ when={props.canManage && ctx.canEdit && !props.property.isMetadata}
+ >
+ <InlinePropertyActions property={props.property} />
+ </Show>
+ }
entitySelfFilter={{ entityType: ctx.entityType, blockId: props.entityId }}
/>
);
};
+
+function InlinePropertyActions(props: { property: PropertyT }) {
+ const ctx = usePropertiesContext();
+ const [removing, setRemoving] = createSignal(false);
+ const remove = async () => {
+ if (!ctx.removeProperty || removing()) return;
+ setRemoving(true);
+ try {
+ await ctx.removeProperty(props.property.propertyId);
+ ctx.onPropertyUnpinned?.(props.property.propertyId);
+ ctx.onPropertyDeleted();
+ } catch {
+ // The shared removal mutation reports the failure and keeps the property.
+ } finally {
+ setRemoving(false);
+ }
+ };
+ return (
+ <div class="flex min-w-40 flex-col gap-0.5 text-ink">
+ <button
+ type="button"
+ class="flex w-full min-w-0 items-center gap-2 whitespace-nowrap rounded-md px-2 py-1.5 text-left hover:bg-hover disabled:opacity-50"
+ disabled={removing()}
+ onClick={() => ctx.onPropertyUnpinned?.(props.property.propertyId)}
+ >
+ <PushPinSlashIcon class="size-3.5 shrink-0 text-ink-muted" />
+ Unpin
+ </button>
+ <button
+ type="button"
+ class="flex w-full min-w-0 items-center gap-2 whitespace-nowrap rounded-md px-2 py-1.5 text-left text-failure-ink hover:bg-hover disabled:opacity-50"
+ disabled={removing()}
+ onClick={remove}
+ >
+ <TrashIcon class="size-3.5 shrink-0" />
+ {removing() ? 'Deleting…' : 'Delete from item'}
+ </button>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/block-md/component/InlineTaskGithubPullRequests.tsx b/apps/web/src/features/block-md/component/InlineTaskGithubPullRequests.tsx
index 50eea03cb2..9e6157be4e 100644
--- a/apps/web/src/features/block-md/component/InlineTaskGithubPullRequests.tsx
+++ b/apps/web/src/features/block-md/component/InlineTaskGithubPullRequests.tsx
@@ -5,7 +5,7 @@ import GithubIcon from '@icon/mcp-github.svg';
import GitBranch from '@phosphor/git-branch.svg';
import { useDocumentGithubPullRequestsQuery } from '@queries/storage/github-pull-requests';
import type { GithubPullRequest } from '@service-storage/generated/schemas';
-import { Button, Layer } from '@ui';
+import { badgeTriggerClasses, CopyButton, Layer } from '@ui';
import { cn } from '@ui/utils/classname';
import { createMemo, For, type JSX, Show, Suspense } from 'solid-js';
import { useMarkdownDocument } from '../context/markdown-document-context';
@@ -135,17 +135,25 @@ function InlineTaskGithubPullRequestsContent(props: {
}}
</For>
<Show when={!isWaitingForPullRequests() && pullRequests().length === 0}>
- <Button
- variant="ghost"
+ <CopyButton
+ variant="outline"
size="sm"
+ noTouchResize
depth={2}
tooltip="Copy branch name"
+ aria-label="Copy branch name"
hotkey={TOKENS.entity.action.copyBranchName}
- class={cn(PILL_CLASS, 'bg-surface px-1.5')}
- onClick={() => void copyBranchNameToClipboard(props.blockId)}
+ class={badgeTriggerClasses({
+ variant: 'outline',
+ size: 'sm',
+ class: 'gap-1.5 bg-surface-2 border border-edge',
+ })}
+ onClick={() =>
+ copyBranchNameToClipboard(props.blockId, { silent: true })
+ }
>
<GitBranch class="size-3 shrink-0" />
- </Button>
+ </CopyButton>
</Show>
</>
);
diff --git a/apps/web/src/features/block-md/component/InlineTaskProperties.test.tsx b/apps/web/src/features/block-md/component/InlineTaskProperties.test.tsx
new file mode 100644
index 0000000000..f7658dd875
--- /dev/null
+++ b/apps/web/src/features/block-md/component/InlineTaskProperties.test.tsx
@@ -0,0 +1,151 @@
+import {
+ $getPinnedProperties,
+ pinnedPropertiesPlugin,
+} from '@core/component/LexicalMarkdown/plugins/pinned-properties/pinnedPropertiesPlugin';
+import { usePropertiesContext } from '@property/context/PropertiesContext';
+import type { openPropertyEditor } from '@property/editor/state/propertyEditor';
+import type { Property } from '@property/types';
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import {
+ $createParagraphNode,
+ $getRoot,
+ createEditor,
+ type LexicalEditor,
+} from 'lexical';
+import { createSignal } from 'solid-js';
+import { afterEach, expect, it, vi } from 'vitest';
+import { InlineTaskProperties } from './InlineTaskProperties';
+
+const mocks = vi.hoisted(() => ({
+ editor: undefined as LexicalEditor | undefined,
+ properties: () => [] as Property[],
+ add: vi.fn(),
+ open: vi.fn<typeof openPropertyEditor>(),
+}));
+vi.mock('@app/features/projects/task-project-property', () => ({
+ TaskProjectProperty: () => null,
+}));
+vi.mock('@property/editor/state/propertyEditor', () => ({
+ openPropertyEditor: mocks.open,
+}));
+vi.mock('@property/component/modal', () => ({ Modals: () => null }));
+vi.mock('@property/hooks', () => ({
+ useEntityProperties: () => ({
+ properties: () => mocks.properties(),
+ refetch: vi.fn(),
+ addProperty: mocks.add,
+ removeProperty: vi.fn(),
+ }),
+}));
+vi.mock('@property/tags', () => ({ InlineFetchedEntityTagsPill: () => null }));
+vi.mock('@queries/properties/tags', () => ({
+ useTagsQuery: () => ({ isSuccess: true, data: [] }),
+}));
+vi.mock('@queries/properties/entity', () => ({
+ useBulkSaveEntityPropertiesMutation: () => ({ mutateAsync: vi.fn() }),
+}));
+vi.mock('@core/component/LexicalMarkdown/component/status/Progress', () => ({
+ ProgressChip: () => null,
+}));
+vi.mock('./MarkdownNameProvider', () => ({
+ useMarkdownName: () => ({ displayName: () => 'Document' }),
+}));
+vi.mock('../context/markdown-document-context', () => ({
+ useMarkdownDocument: () => ({
+ documentId: () => 'doc',
+ kind: () => 'document',
+ permissions: { canEdit: () => true },
+ state: { editor: { md: { editor: mocks.editor } } },
+ }),
+}));
+vi.mock('./InlinePropertyValue', () => ({
+ InlinePropertyValue: (props: { property: Property }) => {
+ const context = usePropertiesContext();
+ return (
+ <button
+ onClick={() => context.onPropertyUnpinned?.(props.property.propertyId)}
+ >
+ Unpin {props.property.displayName}
+ </button>
+ );
+ },
+}));
+afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+});
+
+const property: Property = {
+ propertyId: 'assignment',
+ propertyDefinitionId: 'definition',
+ displayName: 'Review notes',
+ valueType: 'STRING',
+ value: 'Keep this value',
+ isMultiSelect: false,
+ owner: { scope: 'system' },
+ createdAt: '2026-01-01',
+ updatedAt: '2026-01-01',
+};
+
+function setup(initial: Property[] = []) {
+ const editor = createEditor({
+ onError: (error) => {
+ throw error;
+ },
+ });
+ editor.update(() => $getRoot().append($createParagraphNode()), {
+ discrete: true,
+ });
+ pinnedPropertiesPlugin()(editor);
+ mocks.editor = editor;
+ render(() => {
+ const [properties, setProperties] = createSignal(initial);
+ mocks.properties = properties;
+ mocks.add.mockImplementation(async () => setProperties([property]));
+ return <InlineTaskProperties />;
+ });
+ return editor;
+}
+
+it('pins a newly assigned property and unpins without deleting its value', async () => {
+ const editor = setup();
+ await fireEvent.click(screen.getByRole('button', { name: 'Add property' }));
+ await mocks.open.mock.lastCall?.[3]?.onPropertyAdded?.(['definition']);
+ await waitFor(() =>
+ expect(
+ screen.getByRole('button', { name: 'Unpin Review notes' })
+ ).toBeTruthy()
+ );
+ expect(mocks.add).toHaveBeenCalledWith('definition');
+ expect(editor.getEditorState().read($getPinnedProperties)).toEqual([
+ 'assignment',
+ ]);
+ await fireEvent.click(
+ screen.getByRole('button', { name: 'Unpin Review notes' })
+ );
+ await waitFor(() =>
+ expect(
+ screen.queryByRole('button', { name: 'Unpin Review notes' })
+ ).toBeNull()
+ );
+ expect(editor.getEditorState().read($getPinnedProperties)).toEqual([]);
+ expect(mocks.properties()[0].value).toBe('Keep this value');
+});
+
+it('repins an existing property without assigning it a second time', async () => {
+ setup([property]);
+ await fireEvent.click(screen.getByRole('button', { name: 'Add property' }));
+ await mocks.open.mock.lastCall?.[3]?.onPropertyAdded?.(['definition']);
+ await waitFor(() =>
+ expect(
+ screen.getByRole('button', { name: 'Unpin Review notes' })
+ ).toBeTruthy()
+ );
+ expect(mocks.add).not.toHaveBeenCalled();
+});
diff --git a/apps/web/src/features/block-md/component/InlineTaskProperties.tsx b/apps/web/src/features/block-md/component/InlineTaskProperties.tsx
index a2f03526f4..60d3823194 100644
--- a/apps/web/src/features/block-md/component/InlineTaskProperties.tsx
+++ b/apps/web/src/features/block-md/component/InlineTaskProperties.tsx
@@ -1,4 +1,6 @@
+import { TaskProjectProperty } from '@app/features/projects/task-project-property';
import { ProgressChip } from '@core/component/LexicalMarkdown/component/status/Progress';
+import { AddPropertyButton } from '@property/component/AddPropertyButton';
import { Modals } from '@property/component/modal';
import { SYSTEM_PROPERTY_IDS } from '@property/constants';
import {
@@ -9,14 +11,22 @@ import { useEntityProperties } from '@property/hooks';
import { InlineFetchedEntityTagsPill } from '@property/tags';
import type { Property, PropertyApiValues } from '@property/types';
import { useBulkSaveEntityPropertiesMutation } from '@queries/properties/entity';
-import { createMemo, For, Show, Suspense } from 'solid-js';
+import { useTagsQuery } from '@queries/properties/tags';
+import {
+ createEffect,
+ createMemo,
+ createSignal,
+ For,
+ Show,
+ Suspense,
+} from 'solid-js';
import { useMarkdownDocument } from '../context/markdown-document-context';
+import { createPinnedProperties } from '../primitives/create-pinned-properties';
import { InlinePropertyValue } from './InlinePropertyValue';
import { useMarkdownName } from './MarkdownNameProvider';
/**
- * Inline task properties shown below the title when the side panel is closed.
- * Displays status, priority, and assignees in a single row, editable like in list view.
+ * Inline document metadata and the task's status, priority, and assignees.
*/
export function InlineTaskProperties() {
const { documentId, kind, permissions, state } = useMarkdownDocument();
@@ -26,14 +36,49 @@ export function InlineTaskProperties() {
const { displayName: documentName } = useMarkdownName();
const entityType = documentKind === 'task' ? 'TASK' : 'DOCUMENT';
- const { properties, refetch } = useEntityProperties(
- blockId,
- entityType,
- false
- );
+ const { properties, refetch, addProperty, removeProperty } =
+ useEntityProperties(blockId, entityType, false);
+ const pins = createPinnedProperties(() => state.editor.md.editor);
+ const tagSets = useTagsQuery();
+ const tagDefinitionIds = () =>
+ new Set(
+ tagSets.isSuccess ? tagSets.data.map((set) => set.definition?.id) : []
+ );
+ const [pendingPins, setPendingPins] = createSignal(new Set<string>());
+ const propertyAdded = (definitionIds?: string[]) => {
+ if (definitionIds?.length) {
+ setPendingPins((pending) => new Set([...pending, ...definitionIds]));
+ }
+ refetch();
+ };
+ const clearPendingPin = (definitionId: string) => {
+ setPendingPins((pending) => {
+ const next = new Set(pending);
+ next.delete(definitionId);
+ return next;
+ });
+ };
+ // Property assignment IDs arrive from the server; persist each requested pin
+ // to the editor once its assignment exists and the editor is ready.
+ createEffect(() => {
+ if (pendingPins().size === 0 || !state.editor.md.editor) return;
+ for (const property of properties()) {
+ if (!pendingPins().has(property.propertyDefinitionId)) continue;
+ pins.pin(property.propertyId);
+ clearPendingPin(property.propertyDefinitionId);
+ }
+ });
const inlineProperties = createMemo(() => {
const props = properties();
+ if (documentKind === 'document') {
+ return props.filter(
+ (property) =>
+ pins.ids().includes(property.propertyId) &&
+ !property.isMetadata &&
+ !tagDefinitionIds().has(property.propertyDefinitionId)
+ );
+ }
const ids = [
SYSTEM_PROPERTY_IDS.STATUS,
SYSTEM_PROPERTY_IDS.PRIORITY,
@@ -67,29 +112,41 @@ export function InlineTaskProperties() {
<Suspense>
<Show when={shouldShowRow()}>
<PropertiesProvider
+ entityId={blockId}
entityType={entityType}
canEdit={canEdit()}
documentName={documentName()}
- properties={inlineProperties}
+ properties={properties}
+ addProperty={addProperty}
+ removeProperty={removeProperty}
+ pinnedPropertyIds={pins.ids}
+ onPropertyPinned={pins.pin}
+ onPropertyUnpinned={pins.unpin}
onRefresh={refetch}
- onPropertyAdded={refetch}
+ onPropertyAdded={propertyAdded}
+ onPropertyAddFailed={clearPendingPin}
onPropertyDeleted={refetch}
saveHandler={saveHandler}
>
+ <InlineFetchedEntityTagsPill
+ entityId={blockId}
+ entityType={entityType}
+ class="bg-surface-2"
+ showAddButton={documentKind === 'document' && canEdit()}
+ />
<For each={inlineProperties()}>
{(property) => (
<InlinePropertyValue
property={property}
entityId={blockId}
class="bg-surface-2 border border-edge"
+ canManage={documentKind === 'document'}
/>
)}
</For>
- <InlineFetchedEntityTagsPill
- entityId={blockId}
- entityType={entityType}
- class="bg-surface-2"
- />
+ <Show when={documentKind === 'document' && canEdit()}>
+ <AddPropertyButton class="gap-1.5 bg-surface-2" />
+ </Show>
<Show when={documentKind === 'task'}>
<TaskProjectProperty taskId={blockId} canEdit={canEdit()} />
</Show>
@@ -106,5 +163,3 @@ export function InlineTaskProperties() {
</Suspense>
);
}
-
-import { TaskProjectProperty } from '@app/features/projects/task-project-property';
diff --git a/apps/web/src/features/block-md/component/MarkdownDetailBreadcrumbItem.tsx b/apps/web/src/features/block-md/component/MarkdownDetailBreadcrumbItem.tsx
index c70d139a23..fa07d59761 100644
--- a/apps/web/src/features/block-md/component/MarkdownDetailBreadcrumbItem.tsx
+++ b/apps/web/src/features/block-md/component/MarkdownDetailBreadcrumbItem.tsx
@@ -1,3 +1,4 @@
+import { DocumentTitleHoverCard } from '@app/components/entity-detail/DocumentTitleHoverCard';
import { ViewBreadcrumbs } from '@app/components/view-shell';
import { useBlockEntityCommands } from '@app/features/next-soup/actions';
import { SplitFileMenu } from '@components/app/split-layout/components/SplitFileMenu';
@@ -73,18 +74,23 @@ export function MarkdownDetailBreadcrumbItem(props: {
>
{(item) => (
<div class="flex min-w-0 items-center motion-safe:animate-[dialog-overlay-open_150ms_ease-out]">
- <ViewBreadcrumbs.Button
- class="gap-1.5"
- isActive={item.isActive()}
- onClick={() => {
- item.onSelect();
- focusDocument();
- }}
- tooltip={documentName()}
+ <DocumentTitleHoverCard
+ documentId={props.documentId}
+ name={documentName()}
+ ownerId={props.ownerId}
>
- <EntityIcon targetType={blockName()} size="xs" class="shrink-0" />
- <span class="truncate">{documentName()}</span>
- </ViewBreadcrumbs.Button>
+ <ViewBreadcrumbs.Button
+ class="gap-1.5"
+ isActive={item.isActive()}
+ onClick={() => {
+ item.onSelect();
+ focusDocument();
+ }}
+ >
+ <EntityIcon targetType={blockName()} size="xs" class="shrink-0" />
+ <span class="truncate">{documentName()}</span>
+ </ViewBreadcrumbs.Button>
+ </DocumentTitleHoverCard>
<div class="shrink-0">
<SplitFileMenu
id={props.documentId}
diff --git a/apps/web/src/features/block-md/component/MarkdownDocument.tsx b/apps/web/src/features/block-md/component/MarkdownDocument.tsx
index 8888a5c0a2..9576cee6e0 100644
--- a/apps/web/src/features/block-md/component/MarkdownDocument.tsx
+++ b/apps/web/src/features/block-md/component/MarkdownDocument.tsx
@@ -37,6 +37,7 @@ import {
type MarkdownDocumentState,
} from '../context/markdown-document-state';
import { HistoryProvider } from '../history/HistoryContext';
+import { HistoryWorkspace } from '../history/HistoryWorkspace';
import { resumeDocumentSpan, stampLoroSnapshotState } from '../observability';
import type { MarkdownDocumentKind, MarkdownDocumentSource } from '../types';
import { MarkdownNameProvider } from './MarkdownNameProvider';
@@ -217,7 +218,7 @@ export function MarkdownDocument(props: ParentProps<MarkdownDocumentProps>) {
tabIndex={-1}
>
<HistoryProvider documentId={() => props.documentId}>
- {props.children}
+ <HistoryWorkspace>{props.children}</HistoryWorkspace>
</HistoryProvider>
</div>
</MarkdownNameProvider>
diff --git a/apps/web/src/features/block-md/component/Notebook.tsx b/apps/web/src/features/block-md/component/Notebook.tsx
index 815a1ab492..714f7d787e 100644
--- a/apps/web/src/features/block-md/component/Notebook.tsx
+++ b/apps/web/src/features/block-md/component/Notebook.tsx
@@ -2,17 +2,12 @@ import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { createSizeBreakpoints } from '@app/util/create-size-breakpoints';
import { CommentMargin } from '@block-md/comments/CommentMargin';
import { useMacroMentionLinkResolver } from '@components/app/split-layout/split-router/mention-links';
-import {
- editorFocusSignal,
- getSaveState,
-} from '@core/component/LexicalMarkdown/utils';
+import { editorFocusSignal } from '@core/component/LexicalMarkdown/utils';
import { ParamsProvider } from '@core/component/ParamsProvider';
import {
DEV_MODE_ENV,
ENABLE_MARKDOWN_COMMENTS,
- enableHistoryComponent,
enableInlineAiEditing,
- isFeatureEnabled,
LOCAL_ONLY,
} from '@core/constant/featureFlags';
import { useIsMacroTeam } from '@core/context/team';
@@ -39,8 +34,6 @@ import {
untrack,
} from 'solid-js';
import { useMarkdownDocument } from '../context/markdown-document-context';
-import { useHistory } from '../history/HistoryContext';
-import { HistoryOverlay } from '../history/HistoryOverlay';
import { DocumentAiEditBar } from './DocumentAiEditBar';
import { DocumentDiscussion } from './DocumentDiscussion';
import { InlineTaskGithubPullRequests } from './InlineTaskGithubPullRequests';
@@ -114,7 +107,6 @@ export function Notebook(props: {
const { md, setMd } = state.editor;
const { displayName: documentName } = useMarkdownName();
const scopeId = () => props.hotkeyScope;
- const history = useHistory();
const inlineAiEditing = useFeatureFlag(enableInlineAiEditing);
const resolveAppLink = useMacroMentionLinkResolver();
@@ -132,8 +124,7 @@ export function Notebook(props: {
const canUseLexicalStateDebugger = useCanUseLexicalStateDebugger();
const outline = useMarkdownOutline({
editor: () => md.editor,
- enabled: () =>
- (width() ?? 0) >= OutlineMinWidth && !history.isOpen() && !isMobile(),
+ enabled: () => (width() ?? 0) >= OutlineMinWidth && !isMobile(),
});
const hasComment = createMemo(() => {
@@ -143,7 +134,7 @@ export function Notebook(props: {
// On phones the margin is hidden entirely (no minimized rail); the touch
// comment drawer is the only comment surface. CommentMargin stays mounted
// inside the hidden wrapper — it hosts the drawer.
- const showComments = () => hasComment() && !history.isOpen() && !isMobile();
+ const showComments = () => hasComment() && !isMobile();
const layoutMode = createMemo((): CommentLayoutMode => {
if (!showComments() || width() === undefined) {
return CommentLayoutMode.none;
@@ -187,11 +178,6 @@ export function Notebook(props: {
)
);
- const currentEditorState = () => {
- const editor = md.editor;
- return editor ? getSaveState(editor.getEditorState()) : undefined;
- };
-
// Set the refs on the block store.
onMount(() => {
setMd({
@@ -375,37 +361,22 @@ export function Notebook(props: {
<TaskDuplicateMatchPill />
</div>
<ParamsProvider state={params}>
- {/* Relative wrapper so the history overlay covers only the body region,
- leaving the title + properties above it untouched and aligned. */}
- <div class="relative">
- <MarkdownEditor
- resolveAppLink={resolveAppLink}
- loroManager={props.loroManager}
- showLexicalStateDebugger={
- canUseLexicalStateDebugger() && showLexicalStateDebugger()
- }
- onLexicalStateDebuggerClose={() =>
- setShowLexicalStateDebugger(false)
- }
- />
- <Show when={isFeatureEnabled(enableHistoryComponent)}>
- <HistoryOverlay
- currentState={currentEditorState}
- selectedAt={history.selectedAt()}
- isLive={history.isLive()}
- visible={history.isOpen()}
- onExit={history.exit}
- />
- </Show>
- </div>
- <Show when={!history.isOpen()}>
- <Show when={inlineAiEditing().enabled && canEdit() && !isMobile()}>
- <div class="mb-2">
- <DocumentAiEditBar documentId={props.documentId} />
- </div>
- </Show>
- <DocumentDiscussion editorHasFocus={editorHasFocus()} />
+ <MarkdownEditor
+ resolveAppLink={resolveAppLink}
+ loroManager={props.loroManager}
+ showLexicalStateDebugger={
+ canUseLexicalStateDebugger() && showLexicalStateDebugger()
+ }
+ onLexicalStateDebuggerClose={() =>
+ setShowLexicalStateDebugger(false)
+ }
+ />
+ <Show when={inlineAiEditing().enabled && canEdit() && !isMobile()}>
+ <div class="mb-2">
+ <DocumentAiEditBar documentId={props.documentId} />
+ </div>
</Show>
+ <DocumentDiscussion editorHasFocus={editorHasFocus()} />
</ParamsProvider>
</div>
<div
diff --git a/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx b/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
index 95212893cb..9c1de2dc5b 100644
--- a/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
+++ b/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
@@ -10,35 +10,24 @@ import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import {
GithubPullRequestDetailsRows,
SidePanel,
- useSidePanel,
} from '@components/app/side-panel';
-import { EntityDetailsGrid } from '@components/app/side-panel/EntityDetailsGrid';
+import { EntityMetadata } from '@components/app/side-panel/EntityMetadata';
import { useSplitLayout } from '@components/app/split-layout/layout';
import { EntityIcon } from '@core/component/EntityIcon';
import { openDocument } from '@core/component/LexicalMarkdown/component/core/BlockLink';
-import { ProgressMeter } from '@core/component/LexicalMarkdown/component/status/Progress';
import { Wordcount } from '@core/component/LexicalMarkdown/component/status/Wordcount';
-import {
- $getPinnedProperties,
- ADD_PINNED_PROPERTY_COMMAND,
- REMOVE_PINNED_PROPERTY_COMMAND,
-} from '@core/component/LexicalMarkdown/plugins';
import { Notifications } from '@core/component/Notifications';
import { References } from '@core/component/References';
import {
- enableHistoryComponent,
enableProjects,
- isFeatureEnabled,
USE_MACRO_PR_SUMMARY_BLOCK,
} from '@core/constant/featureFlags';
-import { useUserId } from '@core/context/user';
import { isMobile } from '@core/mobile/isMobile';
import type { Entity } from '@core/types';
import type { DateValue } from '@core/util/date';
import { openExternalUrl } from '@core/util/url';
import { useSplitNavigationHandler } from '@core/util/useSplitNavigationHandler';
import { useNotificationsForEntity } from '@notifications';
-import CaretRightIcon from '@phosphor/caret-right.svg';
import {
getDefaultPinnedProperties,
SYSTEM_PROPERTY_IDS,
@@ -50,41 +39,22 @@ import {
type GithubPullRequestWithDetails,
useDocumentGithubPullRequestsQuery,
} from '@queries/storage/github-pull-requests';
-import {
- useDocumentTeamShareQuery,
- useSetDocumentTeamShareMutation,
-} from '@queries/storage/team-share';
import type { EntityType as PropertiesEntityType } from '@service-properties/generated/schemas/entityType';
import { createCallback } from '@solid-primitives/rootless';
-import { cn, InlineCheckbox } from '@ui';
-import {
- createEffect,
- createMemo,
- createSignal,
- For,
- onCleanup,
- Show,
-} from 'solid-js';
+import { cn } from '@ui';
+import { createMemo, For, Show } from 'solid-js';
import { useMarkdownDocument } from '../../context/markdown-document-context';
-import { useHistory } from '../../history/HistoryContext';
-import { HistoryScrubber } from '../../history/HistoryScrubber';
-import { HistorySessionList } from '../../history/HistorySessionList';
+import { createPinnedProperties } from '../../primitives/create-pinned-properties';
import { DispatchAgentButton } from '../DispatchAgentMenu';
import { useMarkdownName } from '../MarkdownNameProvider';
import { TaskDuplicateMatchesSidePanelSection } from '../TaskDuplicateMatches';
-/**
- * Renders all three SidePanel sections for the markdown block:
- * - Properties (always shown)
- * - Details (always shown)
- * - Stats (hidden for tasks)
- */
+/** Registers markdown header actions, panel sections, and metadata footer. */
export function MarkdownSidePanelSections() {
const { documentId, kind, permissions } = useMarkdownDocument();
const canEdit = permissions.canEdit;
const { displayName } = useMarkdownName();
const isTask = () => kind() === 'task';
- const isSnippet = () => kind() === 'snippet';
const canDispatchToAgent = () => isTask() || kind() === 'document';
const entity = (): Entity => ({
id: documentId(),
@@ -95,13 +65,11 @@ export function MarkdownSidePanelSections() {
return (
<>
- <SidePanel.Section
- id="document-ai-actions"
- title="Actions"
- defaultOpen
- order={0}
- >
- <div class="m-px flex items-center justify-start gap-2">
+ <SidePanel.HeaderActions>
+ <div class="flex shrink-0 items-center gap-1">
+ <Show when={canDispatchToAgent() && !isMobile()}>
+ <DispatchAgentButton showPrimaryLabel />
+ </Show>
<AskMacroButton
entity={{
type: 'document',
@@ -110,17 +78,14 @@ export function MarkdownSidePanelSections() {
fileType: 'md',
}}
/>
- <Show when={canDispatchToAgent() && !isMobile()}>
- <DispatchAgentButton showPrimaryLabel />
- </Show>
</div>
- </SidePanel.Section>
- <SidePanel.Section id="details" title="Details" defaultOpen order={10}>
+ </SidePanel.HeaderActions>
+ <SidePanel.Footer>
+ <Show when={!isTask()}>
+ <StatsSectionContent />
+ </Show>
<DetailsSectionContent documentId={documentId()} />
- </SidePanel.Section>
- <Show when={isSnippet()}>
- <SnippetSharingOwnerSectionConditional documentId={documentId()} />
- </Show>
+ </SidePanel.Footer>
<EntityTagsSection
entityId={documentId()}
entityType={propertiesEntityType()}
@@ -152,16 +117,6 @@ export function MarkdownSidePanelSections() {
documentName={displayName() ?? ''}
/>
</SidePanel.Section>
- <Show when={!isTask()}>
- <SidePanel.Section id="stats" title="Stats" order={30}>
- <StatsSectionContent />
- </SidePanel.Section>
- </Show>
- <Show when={isFeatureEnabled(enableHistoryComponent)}>
- <SidePanel.Section id="history" title="History" order={35}>
- <HistorySectionContent />
- </SidePanel.Section>
- </Show>
<EntityActivitySectionConditional
entityId={documentId()}
entityType={propertiesEntityType()}
@@ -177,185 +132,6 @@ export function MarkdownSidePanelSections() {
);
}
-function HistorySectionContent() {
- const history = useHistory();
- const sidePanel = useSidePanel();
- const [showSessions, setShowSessions] = createSignal(false);
-
- createEffect(() => {
- if (history.isOpen()) {
- sidePanel?.setOpenSectionIds(['history']);
- }
- });
-
- // Discover whether history exists (to choose between the empty state and
- // the scrubber) once the user actually expands this accordion section —
- // nothing inside the section can trigger the load itself, since the
- // scrubber and "Show activity" toggle only render once sessions exist.
- createEffect(() => {
- if (sidePanel?.openSectionIds().includes('history')) {
- history.requestLoad();
- }
- });
- const isShowingSessions = () => history.isOpen() || showSessions();
-
- const totalEdits = createMemo(() => {
- const sessions = history.sessions();
- if (!sessions) return 0;
- return sessions.reduce((sum, s) => sum + s.count, 0);
- });
-
- return (
- <Show when={!history.loading.sessions()} fallback={<HistorySkeleton />}>
- <Show
- when={totalEdits() > 1 && history.sessions()}
- fallback={
- // Don't claim the document has no edits when we couldn't load them.
- <p
- class="text-xs text-ink-muted"
- title={history.error() ?? undefined}
- >
- {history.error() ? "Couldn't load history" : 'No history yet'}
- </p>
- }
- >
- {(sessions) => (
- <div class="hidden min-w-0 overflow-hidden md:block">
- <HistoryScrubber compact />
- <Show when={sessions().length > 0}>
- <div class="mt-3 min-w-0 border-edge-muted border-t pt-2">
- <button
- type="button"
- aria-expanded={isShowingSessions()}
- class="flex w-full items-center gap-1.5 rounded-md px-1 py-1 text-ink-muted text-xs hover:bg-hover hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"
- onClick={() => {
- history.enter();
- setShowSessions(true);
- }}
- >
- <CaretRightIcon
- class={cn(
- 'size-3 shrink-0 transition-transform duration-90',
- isShowingSessions() && 'rotate-90'
- )}
- />
- <span>
- {isShowingSessions() ? 'Activity' : 'Show activity'}
- </span>
- </button>
- <Show when={isShowingSessions()}>
- <HistorySessionList
- sessions={sessions()}
- selectedAt={history.selectedAt}
- onSelect={history.enter}
- onViewSessionDiff={(session) => {
- if (history.diff.session()?.startMs === session.startMs) {
- history.diff.clear();
- } else {
- history.diff.view(session);
- }
- }}
- />
- </Show>
- </div>
- </Show>
- </div>
- )}
- </Show>
- </Show>
- );
-}
-
-function HistorySkeleton() {
- return (
- <div
- aria-hidden="true"
- class="hidden min-w-0 flex-col gap-2.5 overflow-hidden md:flex"
- >
- <div class="skeleton-shimmer h-12 w-full rounded-md bg-skeleton" />
- </div>
- );
-}
-
-// ─────────────────────────────────────────────────────────────────────────────
-// Sharing Section (snippets)
-// ─────────────────────────────────────────────────────────────────────────────
-
-function SnippetSharingOwnerSectionConditional(props: { documentId: string }) {
- const currentUserId = useUserId();
- const metadataQuery = useDocumentMetadataQuery(() => props.documentId);
-
- const isOwner = createMemo(() => {
- const ownerId = metadataQuery.data?.owner;
- const userId = currentUserId();
- return !!ownerId && !!userId && ownerId === userId;
- });
-
- return (
- <Show when={isOwner()}>
- <SnippetSharingTeamSectionConditional documentId={props.documentId} />
- </Show>
- );
-}
-
-/**
- * "Share with team" toggle for snippets. Only mounted for the snippet owner;
- * sharing grants the owner's team Edit access so teammates can insert and
- * maintain the snippet.
- */
-function SnippetSharingTeamSectionConditional(props: { documentId: string }) {
- const teamShareQuery = useDocumentTeamShareQuery(() => props.documentId);
-
- return (
- <Show when={teamShareQuery.data?.teamId}>
- <SidePanel.Section id="sharing" title="Sharing" defaultOpen order={15}>
- <SnippetSharingSectionContent documentId={props.documentId} />
- </SidePanel.Section>
- </Show>
- );
-}
-
-function SnippetSharingSectionContent(props: { documentId: string }) {
- const teamShareQuery = useDocumentTeamShareQuery(() => props.documentId);
- const setTeamShare = useSetDocumentTeamShareMutation();
-
- const isShared = () => teamShareQuery.data?.sharedWithTeam ?? false;
- const isDisabled = () => setTeamShare.isPending || teamShareQuery.isPending;
-
- const handleChange = (checked: boolean) => {
- setTeamShare.mutate({
- documentId: props.documentId,
- shareWithTeam: checked,
- });
- };
-
- return (
- <div class="flex flex-col gap-2 text-xs">
- <button
- type="button"
- role="checkbox"
- aria-checked={isShared()}
- disabled={isDisabled()}
- onClick={() => handleChange(!isShared())}
- class={cn(
- 'inline-flex items-center gap-2 rounded-md h-7 px-2.5 text-xs select-none w-fit',
- 'border border-ink-muted/[0.08] bg-ink-muted/[0.025]',
- 'text-ink-muted/70 hover:text-ink hover:bg-ink-muted/[0.06]',
- isShared() && 'text-ink',
- isDisabled() && 'pointer-events-none opacity-50'
- )}
- >
- <InlineCheckbox checked={isShared()} />
- <span class="whitespace-nowrap">Share with team</span>
- </button>
- <p class="text-ink-muted leading-5">
- Lets everyone on your team insert this snippet from the ; menu and edit
- it.
- </p>
- </div>
- );
-}
-
// ─────────────────────────────────────────────────────────────────────────────
// Details Section
// ─────────────────────────────────────────────────────────────────────────────
@@ -385,19 +161,20 @@ function DetailsGrid(props: {
updatedAt: () => DateValue | null | undefined;
}) {
return (
- <EntityDetailsGrid
+ <EntityMetadata
ownerId={props.owner()}
createdAt={props.createdAt()}
updatedAt={props.updatedAt()}
>
<Show when={props.folder()}>
{(folder) => (
- <SidePanel.Row label="Folder">
+ <div class="flex items-center gap-1">
+ Folder
<FolderLink projectId={folder().id} projectName={folder().name} />
- </SidePanel.Row>
+ </div>
)}
</Show>
- </EntityDetailsGrid>
+ </EntityMetadata>
);
}
@@ -436,40 +213,7 @@ function PropertiesSectionContent(props: {
const entityType: PropertiesEntityType = props.isTask ? 'TASK' : 'DOCUMENT';
- const [pinnedPropertyIds, setPinnedPropertyIds] = createSignal<string[]>([]);
-
- createEffect(() => {
- const currentEditor = mdData.editor;
- if (!currentEditor) return;
- currentEditor.getEditorState().read(() => {
- const ids = $getPinnedProperties();
- setPinnedPropertyIds(ids);
- });
-
- const unregister = currentEditor.registerUpdateListener(
- ({ editorState }) => {
- editorState.read(() => {
- const ids = $getPinnedProperties();
- setPinnedPropertyIds(ids);
- });
- }
- );
- onCleanup(unregister);
- });
-
- const handlePropertyPinned = (propertyId: string) => {
- const editor = mdData.editor;
- if (editor) {
- editor.dispatchCommand(ADD_PINNED_PROPERTY_COMMAND, propertyId);
- }
- };
-
- const handlePropertyUnpinned = (propertyId: string) => {
- const editor = mdData.editor;
- if (editor) {
- editor.dispatchCommand(REMOVE_PINNED_PROPERTY_COMMAND, propertyId);
- }
- };
+ const pins = createPinnedProperties(() => mdData.editor);
return (
<EntityPropertiesSection
@@ -480,10 +224,9 @@ function PropertiesSectionContent(props: {
defaultPinnedPropertyIds={() =>
props.isTask ? getDefaultPinnedProperties('task') : []
}
- pinnedPropertyIds={pinnedPropertyIds}
+ pinnedPropertyIds={pins.ids}
pinnedPropertyDefinitionOrder={PINNED_ORDER}
- onPropertyPinned={handlePropertyPinned}
- onPropertyUnpinned={handlePropertyUnpinned}
+ onPropertyUnpinned={pins.unpin}
showTags={false}
/>
);
@@ -507,31 +250,12 @@ function StatsSectionContent() {
const md = state.editor.md;
return (
- <Show
- when={md.wordcountStats}
- fallback={
- <div class="text-ink-muted text-xs py-2">No stats available</div>
- }
- >
+ <Show when={md.wordcountStats}>
{(stats) => (
<Wordcount.Root stats={stats()}>
- <SidePanel.Grid>
- <SidePanel.Row label="Words">
- <Wordcount.Words />
- </SidePanel.Row>
- <SidePanel.Row label="Characters">
- <Wordcount.Characters />
- </SidePanel.Row>
- <Show when={md.progressStats}>
- {(progressStats) => (
- <Show when={progressStats().total > 0}>
- <SidePanel.Row label="Progress">
- <ProgressMeter stats={progressStats()} />
- </SidePanel.Row>
- </Show>
- )}
- </Show>
- </SidePanel.Grid>
+ <div class="mb-1">
+ <Wordcount.Words /> words · <Wordcount.Characters /> characters
+ </div>
</Wordcount.Root>
)}
</Show>
diff --git a/apps/web/src/features/block-md/component/useMarkdownDocumentTools.tsx b/apps/web/src/features/block-md/component/useMarkdownDocumentTools.tsx
index 2227dea459..84f0e5a434 100644
--- a/apps/web/src/features/block-md/component/useMarkdownDocumentTools.tsx
+++ b/apps/web/src/features/block-md/component/useMarkdownDocumentTools.tsx
@@ -11,8 +11,13 @@ import {
ShareTrigger,
} from '@core/component/TopBar/ShareButton';
import { useShareModal } from '@core/component/TopBar/shareModal';
+import {
+ enableHistoryComponent,
+ isFeatureEnabled,
+} from '@core/constant/featureFlags';
import { isMobile } from '@core/mobile/isMobile';
import { copyBranchNameToClipboard } from '@core/util/branchName';
+import ClockCounterClockwise from '@phosphor/clock-counter-clockwise.svg';
import Download from '@phosphor/download.svg';
import GitBranch from '@phosphor/git-branch.svg';
import IconLink from '@phosphor/link.svg';
@@ -20,6 +25,7 @@ import TerminalWindowIcon from '@phosphor/terminal-window.svg';
import { queryReadyGate } from '@queries/gate';
import { useDocumentMetadataQuery } from '@queries/storage/document-metadata';
import { useMarkdownDocument } from '../context/markdown-document-context';
+import { useHistory } from '../history/HistoryContext';
import {
DispatchAgentButton,
useDispatchAgentSplitFileActions,
@@ -55,7 +61,8 @@ function useMarkdownShareModal() {
}
export function useMarkdownDocumentTools() {
- const { documentId, kind } = useMarkdownDocument();
+ const { documentId, kind, element } = useMarkdownDocument();
+ const history = useHistory();
const { displayName } = useMarkdownName();
const downloadAsMarkdownText = useDownloadDocumentAsMarkdownText();
const openShare = useMarkdownShareModal();
@@ -124,6 +131,15 @@ export function useMarkdownDocumentTools() {
];
const menuTools: BlockTool[] = [
+ {
+ group: 'file',
+ label: 'History',
+ icon: ClockCounterClockwise,
+ condition: () => !isMobile() && isFeatureEnabled(enableHistoryComponent),
+ action: () => history.enter(),
+ focusTarget: () =>
+ element()?.querySelector<HTMLElement>('[data-history-close]') ?? null,
+ },
{
label: 'Ask Macro',
icon: ChatWithAgentIcon,
diff --git a/apps/web/src/features/block-md/history/HistoryOverlay.tsx b/apps/web/src/features/block-md/history/HistoryOverlay.tsx
index ebc90ea5c1..9ac88c2af1 100644
--- a/apps/web/src/features/block-md/history/HistoryOverlay.tsx
+++ b/apps/web/src/features/block-md/history/HistoryOverlay.tsx
@@ -2,7 +2,7 @@ import { buildConfig } from '@core/component/LexicalMarkdown/builder/MarkdownCon
import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';
import type { DiffStatus } from '@macro-inc/lexical-core';
import type { SerializedEditorState } from 'lexical';
-import { createMemo, createSignal, onCleanup, onMount, Show } from 'solid-js';
+import { createMemo, createSignal, Show } from 'solid-js';
import { diffAuthorColorPlugin } from './diffAuthorColorPlugin';
import { useHistory } from './HistoryContext';
import { UserHoverTag } from './UserHoverTag';
@@ -12,25 +12,10 @@ export function HistoryOverlay(props: {
currentState: () => SerializedEditorState | undefined;
selectedAt: Date | null;
isLive: boolean;
- visible: boolean;
- onExit: () => void;
}) {
const history = useHistory();
- const onKeyDown = (e: KeyboardEvent) => {
- if (!props.visible || e.key !== 'Escape' || e.defaultPrevented) return;
- e.preventDefault();
- props.onExit();
- };
- onMount(() => {
- document.addEventListener('keydown', onKeyDown);
- onCleanup(() => document.removeEventListener('keydown', onKeyDown));
- });
-
- const currentEditorState = createMemo(() => {
- if (!props.visible) return undefined;
- return props.currentState();
- });
+ const currentEditorState = createMemo(() => props.currentState());
const targetMs = createMemo<number | undefined>(() => {
if (props.isLive) return undefined;
@@ -91,15 +76,13 @@ export function HistoryOverlay(props: {
return (
<div
ref={rootRef}
- class="absolute inset-0 z-20"
+ class="relative min-w-0"
style={{
- display: props.visible ? undefined : 'none',
'--diff-author-color': diffAuthorColor(),
}}
onPointerMove={onDiffPointerMove}
onPointerLeave={() => setHoverAuthor(null)}
>
- <div class="absolute inset-y-0 -inset-x-1 -z-10 bg-surface" />
<Show keyed when={previewState()}>
{(state) => {
const config = buildConfig('markdown')
diff --git a/apps/web/src/features/block-md/history/HistoryToolbar.tsx b/apps/web/src/features/block-md/history/HistoryToolbar.tsx
new file mode 100644
index 0000000000..3933eaf197
--- /dev/null
+++ b/apps/web/src/features/block-md/history/HistoryToolbar.tsx
@@ -0,0 +1,86 @@
+import { useSplitLayout } from '@components/app/split-layout/layout';
+import { toast } from '@core/component/Toast/Toast';
+import { formatDate } from '@core/util/date';
+import GitFork from '@phosphor-icons/core/regular/git-fork.svg?component-solid';
+import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';
+import { Button } from '@ui';
+import { useMarkdownName } from '../component/MarkdownNameProvider';
+import { useMarkdownDocument } from '../context/markdown-document-context';
+import { createForkMarkdownDocumentMutation } from '../queries/markdown-document-operations';
+import { useHistory } from './HistoryContext';
+
+const nameForkedDocument = (name: string) => `${name} (forked)`;
+
+export function HistoryToolbar(props: { onClose: () => void }) {
+ const history = useHistory();
+ const { documentId } = useMarkdownDocument();
+ const { displayName } = useMarkdownName();
+ const { insertSplit } = useSplitLayout();
+ const forkDocument = createForkMarkdownDocumentMutation();
+
+ const handleFork = async () => {
+ if (forkDocument.isPending) return;
+ const ms = history.selectedAt()?.getTime();
+ const vid = history.isLive()
+ ? undefined
+ : ms
+ ? (history.versionIdAt(ms) ?? undefined)
+ : undefined;
+ if (!history.isLive() && !vid) return;
+ try {
+ const copied = await forkDocument.mutateAsync({
+ documentId: documentId(),
+ documentName: nameForkedDocument(displayName() ?? ''),
+ syncServiceVersion: vid,
+ });
+ insertSplit({ type: 'md', id: copied.documentId }, 'fork');
+ history.exit();
+ } catch {
+ toast.failure('Failed to fork document');
+ }
+ };
+
+ return (
+ <div class="flex shrink-0 items-center gap-2 border-b border-edge-muted px-4 py-3 text-ink">
+ <Button
+ data-history-close
+ variant="ghost"
+ size="icon-sm"
+ onClick={props.onClose}
+ aria-label="Close history"
+ >
+ <XIcon />
+ </Button>
+ <div class="min-w-0 flex-1">
+ <h2 class="text-sm font-medium">Document history</h2>
+ <div class="truncate text-xs text-ink-muted">
+ {history.isLive()
+ ? 'Current version'
+ : formatDate(history.selectedAt()!, { showTime: true })}
+ </div>
+ </div>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => history.enter()}
+ disabled={history.isLive()}
+ >
+ Current version
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={handleFork}
+ disabled={
+ forkDocument.isPending ||
+ (!history.isLive() &&
+ (history.loading.doc() ||
+ !history.versionIdAt(history.selectedAt()?.getTime() ?? 0)))
+ }
+ >
+ <GitFork class="size-3.5 shrink-0" />
+ {forkDocument.isPending ? 'Forking…' : 'Fork'}
+ </Button>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/block-md/history/HistoryWorkspace.test.tsx b/apps/web/src/features/block-md/history/HistoryWorkspace.test.tsx
new file mode 100644
index 0000000000..ebbbd739d8
--- /dev/null
+++ b/apps/web/src/features/block-md/history/HistoryWorkspace.test.tsx
@@ -0,0 +1,131 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { createSignal, type ParentProps } from 'solid-js';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { HistoryWorkspace } from './HistoryWorkspace';
+
+const mocks = vi.hoisted(() => ({
+ mobile: false,
+ history: {} as Record<string, unknown>,
+}));
+vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => mocks.mobile }));
+vi.mock('@core/constant/featureFlags', () => ({
+ enableHistoryComponent: {},
+ isFeatureEnabled: () => true,
+}));
+vi.mock('@core/component/LexicalMarkdown/utils', () => ({
+ getSaveState: (state: unknown) => state,
+}));
+vi.mock('@core/component/ParamsProvider', () => ({
+ ParamsProvider: (props: ParentProps) => props.children,
+}));
+vi.mock('@ui', () => ({
+ Scroll: (props: ParentProps) => <div>{props.children}</div>,
+}));
+vi.mock('../component/MarkdownNameProvider', () => ({
+ useMarkdownName: () => ({ displayName: () => 'Document' }),
+}));
+vi.mock('../context/markdown-document-context', () => ({
+ useMarkdownDocument: () => ({
+ state: { editor: { md: {} }, params: {} },
+ element: () => undefined,
+ }),
+}));
+vi.mock('./HistoryContext', () => ({ useHistory: () => mocks.history }));
+vi.mock('./HistoryOverlay', () => ({
+ HistoryOverlay: () => <p>Read-only version</p>,
+}));
+vi.mock('./HistoryScrubber', () => ({
+ HistoryScrubber: () => <div>History graph</div>,
+}));
+vi.mock('./HistorySessionList', () => ({
+ HistorySessionList: () => <div>History sessions</div>,
+}));
+vi.mock('./HistoryToolbar', () => ({
+ HistoryToolbar: (props: { onClose: () => void }) => (
+ <button onClick={props.onClose}>Close history</button>
+ ),
+}));
+
+beforeEach(() => {
+ mocks.mobile = false;
+});
+afterEach(cleanup);
+
+function setup(
+ options: { loading?: boolean; error?: string; sessions?: boolean } = {}
+) {
+ let setOpen!: (open: boolean) => void;
+ const exit = vi.fn(() => setOpen(false));
+ const mounted = vi.fn();
+ const Editor = () => {
+ mounted();
+ return <textarea aria-label="Live editor" />;
+ };
+ render(() => {
+ const [open, updateOpen] = createSignal(false);
+ setOpen = updateOpen;
+ mocks.history = {
+ isOpen: open,
+ exit,
+ selectedAt: () => null,
+ isLive: () => true,
+ loading: { sessions: () => options.loading ?? false },
+ error: () => options.error ?? null,
+ sessions: () =>
+ options.sessions === false ? [] : [{ startMs: 1, endMs: 2 }],
+ diff: { session: () => null },
+ };
+ return (
+ <HistoryWorkspace>
+ <Editor />
+ </HistoryWorkspace>
+ );
+ });
+ return { setOpen, exit, mounted };
+}
+
+it('keeps the live editor mounted and preserves its draft through opening and Escape', async () => {
+ const { setOpen, exit, mounted } = setup();
+ const editor = screen.getByRole('textbox', {
+ name: 'Live editor',
+ }) as HTMLTextAreaElement;
+ await fireEvent.input(editor, { target: { value: 'Unsaved draft' } });
+ setOpen(true);
+ expect(editor.parentElement?.inert).toBe(true);
+ expect(
+ screen.getByRole('region', { name: 'Version preview' }).textContent
+ ).toContain('Read-only version');
+ const timeline = screen.getByRole('complementary', {
+ name: 'History timeline and sessions',
+ });
+ expect(timeline.textContent).toContain('History graph');
+ expect(timeline.textContent).toContain('History sessions');
+ await fireEvent.keyDown(
+ screen.getByRole('button', { name: 'Close history' }),
+ { key: 'Escape' }
+ );
+ expect(exit).toHaveBeenCalledOnce();
+ expect(screen.queryByRole('region', { name: 'Document history' })).toBeNull();
+ expect(editor.parentElement?.inert).toBe(false);
+ expect(editor.value).toBe('Unsaved draft');
+ setOpen(true);
+ await fireEvent.click(screen.getByRole('button', { name: 'Close history' }));
+ expect(mounted).toHaveBeenCalledOnce();
+});
+
+it('does not take over the document on mobile', () => {
+ mocks.mobile = true;
+ const { setOpen } = setup();
+ setOpen(true);
+ expect(screen.queryByRole('region', { name: 'Document history' })).toBeNull();
+ expect(screen.getByRole('textbox').parentElement?.inert).toBe(false);
+});
+
+it('distinguishes a failed history request from an empty history', () => {
+ const { setOpen } = setup({ error: 'Snapshot unavailable', sessions: false });
+ setOpen(true);
+ expect(screen.getByRole('alert').textContent).toContain(
+ "Couldn't load history"
+ );
+ expect(screen.queryByText('No history yet')).toBeNull();
+});
diff --git a/apps/web/src/features/block-md/history/HistoryWorkspace.tsx b/apps/web/src/features/block-md/history/HistoryWorkspace.tsx
new file mode 100644
index 0000000000..0b72965f76
--- /dev/null
+++ b/apps/web/src/features/block-md/history/HistoryWorkspace.tsx
@@ -0,0 +1,136 @@
+import { getSaveState } from '@core/component/LexicalMarkdown/utils';
+import { ParamsProvider } from '@core/component/ParamsProvider';
+import {
+ enableHistoryComponent,
+ isFeatureEnabled,
+} from '@core/constant/featureFlags';
+import { isMobile } from '@core/mobile/isMobile';
+import { Scroll } from '@ui';
+import { type ParentProps, Show } from 'solid-js';
+import { useMarkdownName } from '../component/MarkdownNameProvider';
+import { useMarkdownDocument } from '../context/markdown-document-context';
+import { useHistory } from './HistoryContext';
+import { HistoryOverlay } from './HistoryOverlay';
+import { HistoryScrubber } from './HistoryScrubber';
+import { HistorySessionList } from './HistorySessionList';
+import { HistoryToolbar } from './HistoryToolbar';
+
+/** A block-local takeover that keeps the live editor mounted beneath it. */
+export function HistoryWorkspace(props: ParentProps) {
+ const history = useHistory();
+ const { state, element } = useMarkdownDocument();
+ const { displayName } = useMarkdownName();
+ const visible = () =>
+ history.isOpen() && !isMobile() && isFeatureEnabled(enableHistoryComponent);
+ const currentState = () => {
+ const editor = state.editor.md.editor;
+ return editor ? getSaveState(editor.getEditorState()) : undefined;
+ };
+ const close = () => {
+ history.exit();
+ element()?.focus({ preventScroll: true });
+ };
+
+ return (
+ <>
+ <div class="contents" inert={visible()}>
+ {props.children}
+ </div>
+ <Show when={visible()}>
+ <section
+ aria-label="Document history"
+ tabIndex={-1}
+ class="absolute inset-0 z-modal flex min-h-0 min-w-0 flex-col bg-panel text-ink motion-safe:animate-[dialog-overlay-open_100ms_ease-out]"
+ onKeyDown={(event) => {
+ if (event.key !== 'Escape' || event.defaultPrevented) return;
+ event.preventDefault();
+ event.stopPropagation();
+ close();
+ }}
+ >
+ <HistoryToolbar onClose={close} />
+ <div class="flex min-h-0 min-w-0 flex-1">
+ <section
+ aria-label="Version preview"
+ class="min-h-0 min-w-0 flex-1"
+ >
+ <Scroll>
+ <div class="mx-auto w-full max-w-3xl px-6 py-8">
+ <h1 class="mb-6 break-words text-xl font-semibold">
+ {displayName()}
+ </h1>
+ <ParamsProvider state={state.params}>
+ <HistoryOverlay
+ currentState={currentState}
+ selectedAt={history.selectedAt()}
+ isLive={history.isLive()}
+ />
+ </ParamsProvider>
+ </div>
+ </Scroll>
+ </section>
+ <aside
+ aria-label="History timeline and sessions"
+ class="flex min-h-0 w-80 max-w-[45%] shrink-0 flex-col border-l border-edge-muted"
+ >
+ <Show
+ when={!history.loading.sessions()}
+ fallback={
+ <div role="status" class="p-4 text-xs text-ink-muted">
+ <div
+ aria-hidden="true"
+ class="mb-3 h-20 rounded-md bg-skeleton skeleton-shimmer"
+ />
+ Loading history…
+ </div>
+ }
+ >
+ <Show
+ when={!history.error()}
+ fallback={
+ <p role="alert" class="p-4 text-sm text-ink-muted">
+ Couldn't load history. Close and reopen history to try
+ again.
+ </p>
+ }
+ >
+ <Show
+ when={history.sessions().length > 0}
+ fallback={
+ <p class="p-4 text-sm text-ink-muted">No history yet</p>
+ }
+ >
+ <div class="shrink-0 border-b border-edge-muted p-4 pb-6">
+ <h3 class="mb-4 text-xs text-ink-muted">Timeline</h3>
+ <HistoryScrubber compact />
+ </div>
+ <div class="min-h-0 flex-1">
+ <Scroll>
+ <div class="p-3">
+ <h3 class="px-2 text-xs text-ink-muted">Sessions</h3>
+ <HistorySessionList
+ sessions={history.sessions()}
+ selectedAt={history.selectedAt}
+ onSelect={history.enter}
+ onViewSessionDiff={(session) => {
+ if (
+ history.diff.session()?.startMs ===
+ session.startMs
+ )
+ history.diff.clear();
+ else history.diff.view(session);
+ }}
+ />
+ </div>
+ </Scroll>
+ </div>
+ </Show>
+ </Show>
+ </Show>
+ </aside>
+ </div>
+ </section>
+ </Show>
+ </>
+ );
+}
diff --git a/apps/web/src/features/block-md/history/OldOverlay.tsx b/apps/web/src/features/block-md/history/OldOverlay.tsx
deleted file mode 100644
index 3f2bd930c3..0000000000
--- a/apps/web/src/features/block-md/history/OldOverlay.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import { useSplitLayout } from '@components/app/split-layout/layout';
-import { toast } from '@core/component/Toast/Toast';
-import GitFork from '@phosphor-icons/core/regular/git-fork.svg?component-solid';
-import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';
-import { storageServiceClient } from '@service-storage/client';
-import { Button, Hotkey } from '@ui';
-import { createSignal, Show } from 'solid-js';
-import { useMarkdownName } from '../component/MarkdownNameProvider';
-import { useMarkdownDocument } from '../context/markdown-document-context';
-import { useHistory } from './HistoryContext';
-
-const nameForkedDocument = (name: string) => `${name} (forked)`;
-
-export function OldOverlay() {
- const history = useHistory();
- const { documentId } = useMarkdownDocument();
- const { displayName } = useMarkdownName();
- const { insertSplit } = useSplitLayout();
- const [forking, setForking] = createSignal(false);
-
- const handleFork = async () => {
- if (forking()) return;
- const ms = history.selectedAt()?.getTime();
- const vid = history.isLive()
- ? undefined
- : ms
- ? (history.versionIdAt(ms) ?? undefined)
- : undefined;
- if (!history.isLive() && !vid) return;
- setForking(true);
- const res = await storageServiceClient.copyDocument({
- documentId: documentId(),
- documentName: nameForkedDocument(displayName() ?? ''),
- syncServiceVersion: vid,
- });
- setForking(false);
- if (res.isErr()) {
- toast.failure('Failed to fork document');
- return;
- }
- insertSplit({ type: 'md', id: res.value.documentId }, 'fork');
- history.exit();
- };
-
- return (
- <Show when={history.isOpen()}>
- <div class="flex w-full items-center gap-2 bg-alert-bg px-3 py-2 text-xs text-alert-ink">
- <span class="flex items-center gap-1 flex-1">
- You are viewing history. Press{' '}
- <Hotkey shortcut="escape" theme="current" /> to exit.
- </span>
- <Button variant="outline" size="sm" onClick={history.exit}>
- <XIcon />
- Exit
- </Button>
- <Button
- variant="accent"
- size="sm"
- onClick={handleFork}
- disabled={
- forking() ||
- (!history.isLive() &&
- (history.loading.doc() ||
- !history.versionIdAt(history.selectedAt()?.getTime() ?? 0)))
- }
- >
- <GitFork class="size-3.5 shrink-0" />
- {forking() ? 'Forking…' : 'Fork'}
- </Button>
- </div>
- </Show>
- );
-}
diff --git a/apps/web/src/features/block-md/primitives/create-pinned-properties.ts b/apps/web/src/features/block-md/primitives/create-pinned-properties.ts
new file mode 100644
index 0000000000..96fb367628
--- /dev/null
+++ b/apps/web/src/features/block-md/primitives/create-pinned-properties.ts
@@ -0,0 +1,31 @@
+import {
+ $getPinnedProperties,
+ ADD_PINNED_PROPERTY_COMMAND,
+ REMOVE_PINNED_PROPERTY_COMMAND,
+} from '@core/component/LexicalMarkdown/plugins/pinned-properties/pinnedPropertiesPlugin';
+import type { LexicalEditor } from 'lexical';
+import { type Accessor, createEffect, createSignal, onCleanup } from 'solid-js';
+
+/** Observe and update the pins persisted in the collaborative document. */
+export function createPinnedProperties(
+ editor: Accessor<LexicalEditor | undefined>
+) {
+ const [ids, setIds] = createSignal<string[]>([]);
+ createEffect(() => {
+ const current = editor();
+ if (!current) return;
+ current.getEditorState().read(() => setIds($getPinnedProperties()));
+ onCleanup(
+ current.registerUpdateListener(({ editorState }) => {
+ editorState.read(() => setIds($getPinnedProperties()));
+ })
+ );
+ });
+ return {
+ ids,
+ pin: (id: string) =>
+ editor()?.dispatchCommand(ADD_PINNED_PROPERTY_COMMAND, id),
+ unpin: (id: string) =>
+ editor()?.dispatchCommand(REMOVE_PINNED_PROPERTY_COMMAND, id),
+ };
+}
diff --git a/apps/web/src/features/block-md/queries/markdown-document-operations.ts b/apps/web/src/features/block-md/queries/markdown-document-operations.ts
index 39748fdb27..5b78400cf1 100644
--- a/apps/web/src/features/block-md/queries/markdown-document-operations.ts
+++ b/apps/web/src/features/block-md/queries/markdown-document-operations.ts
@@ -1,8 +1,21 @@
+import { throwOnErr } from '@core/util/result';
import { utf8Encode } from '@core/util/string';
import { refetchHistory } from '@queries/history/history';
import { storageServiceClient } from '@service-storage/client';
+import type { HistoryVersionId } from '@service-sync/client';
import { useMutation } from '@tanstack/solid-query';
+export function createForkMarkdownDocumentMutation() {
+ return useMutation(() => ({
+ mutationFn: (params: {
+ documentId: string;
+ documentName: string;
+ syncServiceVersion?: HistoryVersionId;
+ }) =>
+ throwOnErr(async () => await storageServiceClient.copyDocument(params)),
+ }));
+}
+
export async function loadMarkdownCachedSnapshot(
documentId: string
): Promise<Uint8Array | undefined> {
diff --git a/apps/web/src/features/block-pdf/component/Block.tsx b/apps/web/src/features/block-pdf/component/Block.tsx
index 0119b6806b..9533f28bd7 100644
--- a/apps/web/src/features/block-pdf/component/Block.tsx
+++ b/apps/web/src/features/block-pdf/component/Block.tsx
@@ -75,7 +75,7 @@ function PdfBlockContent() {
return (
<Show when={!pdf.isNested()} fallback={<PdfDocumentContent />}>
- <SidePanel.Layout>
+ <SidePanel.Layout floating>
<PdfSidePanelSections />
<div class="flex size-full min-w-0 flex-col overflow-hidden">
<TopBar />
diff --git a/apps/web/src/features/block-pdf/component/sidepanel/PdfSidePanelSections.tsx b/apps/web/src/features/block-pdf/component/sidepanel/PdfSidePanelSections.tsx
index a29f7837f8..37e5802f8e 100644
--- a/apps/web/src/features/block-pdf/component/sidepanel/PdfSidePanelSections.tsx
+++ b/apps/web/src/features/block-pdf/component/sidepanel/PdfSidePanelSections.tsx
@@ -11,22 +11,22 @@ import { useBlockDocumentName } from '@core/util/currentBlockDocumentName';
export function PdfSidePanelSections() {
return (
<>
- <SidePanel.Section id="actions" title="Actions" defaultOpen order={10}>
- <ActionsSectionContent />
- </SidePanel.Section>
+ <SidePanel.HeaderActions>
+ <PdfHeaderActions />
+ </SidePanel.HeaderActions>
<FileDetailsSection order={20} />
<FilePropertiesSection order={30} />
</>
);
}
-function ActionsSectionContent() {
+function PdfHeaderActions() {
const documentId = useBlockId();
const name = useBlockDocumentName('Unknown Filename');
const fileType = () => blockMetadataSignal()?.fileType;
return (
- <div class="m-px flex items-center justify-start gap-2">
+ <div class="flex shrink-0 items-center gap-1">
<AskMacroButton
entity={{
type: 'document',
diff --git a/apps/web/src/features/block-pr/component/Block.tsx b/apps/web/src/features/block-pr/component/Block.tsx
index ac57b979c6..a94d6b7b09 100644
--- a/apps/web/src/features/block-pr/component/Block.tsx
+++ b/apps/web/src/features/block-pr/component/Block.tsx
@@ -11,7 +11,7 @@ export default function PrBlock() {
const detail = usePrDetail(() => foreignEntityId);
return (
<div class="size-full overflow-hidden flex flex-col relative">
- <SidePanel.Layout>
+ <SidePanel.Layout floating>
<PrSidePanelSections enrichment={detail.data()?.pullRequest} />
<div class="flex flex-col size-full min-w-0">
<Show when={detail.data()}>
diff --git a/apps/web/src/features/block-pr/component/sidepanel/PrSidePanelSections.tsx b/apps/web/src/features/block-pr/component/sidepanel/PrSidePanelSections.tsx
index bef2c344d7..a98d5f0440 100644
--- a/apps/web/src/features/block-pr/component/sidepanel/PrSidePanelSections.tsx
+++ b/apps/web/src/features/block-pr/component/sidepanel/PrSidePanelSections.tsx
@@ -1,18 +1,45 @@
import {
GithubPullRequestChecksContent,
- GithubPullRequestDetailsContent,
SidePanel,
} from '@components/app/side-panel';
import type { GithubPullRequestWithDetails } from '@queries/storage/github-pull-requests';
+import { Show } from 'solid-js';
export function PrSidePanelSections(props: {
enrichment?: GithubPullRequestWithDetails;
}) {
return (
<>
- <SidePanel.Section id="pr-details" title="Details" defaultOpen order={10}>
- <GithubPullRequestDetailsContent enrichment={props.enrichment} />
- </SidePanel.Section>
+ <SidePanel.Footer>
+ <Show when={props.enrichment} fallback={<SidePanel.Loading />}>
+ {(pr) => (
+ <div class="flex flex-col gap-1">
+ <Show when={pr().authorLogin}>
+ {(author) => <div>Authored by {author()}</div>}
+ </Show>
+ <div>
+ {pr().owner}/{pr().repo}
+ </div>
+ <Show when={pr().status}>
+ {(status) => <div class="capitalize">{status()}</div>}
+ </Show>
+ <Show when={pr().additions != null || pr().deletions != null}>
+ <div>
+ +{pr().additions ?? 0} / −{pr().deletions ?? 0}
+ </div>
+ </Show>
+ <a
+ href={pr().url}
+ target="_blank"
+ rel="noreferrer"
+ class="truncate hover:underline"
+ >
+ {pr().displayName}
+ </a>
+ </div>
+ )}
+ </Show>
+ </SidePanel.Footer>
<SidePanel.Section id="pr-checks" title="Checks" order={20}>
<GithubPullRequestChecksContent enrichment={props.enrichment} />
diff --git a/apps/web/src/features/block-pr/views/PrDetail.tsx b/apps/web/src/features/block-pr/views/PrDetail.tsx
index 85dc8c15ec..fb1b8fa6e9 100644
--- a/apps/web/src/features/block-pr/views/PrDetail.tsx
+++ b/apps/web/src/features/block-pr/views/PrDetail.tsx
@@ -128,7 +128,7 @@ export function PrDetailContent(props: PrDetailBodyProps) {
</Scroll>
}
>
- <SidePanel.Layout headerToggle={false}>
+ <SidePanel.Layout headerToggle={false} floating>
<PrSidePanelSections enrichment={props.data?.pullRequest} />
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<PrDetailBody
@@ -178,7 +178,7 @@ export function StandalonePrDetail(props: { foreignEntityId: string }) {
return data ? (data.pullRequest.url ?? prHtmlUrl(data.prRef)) : undefined;
};
return (
- <SidePanel.Root persistKey={`pr:${props.foreignEntityId}`}>
+ <SidePanel.Root floating persistKey={`pr:${props.foreignEntityId}`}>
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden @container">
<ViewShell.TopBar class="touch:flex">
<SplitPanel.CloseButton class="hidden shrink-0 touch:flex" />
diff --git a/apps/web/src/features/block-project/component/Block.tsx b/apps/web/src/features/block-project/component/Block.tsx
index 1a94ebc753..a58f9c9b8a 100644
--- a/apps/web/src/features/block-project/component/Block.tsx
+++ b/apps/web/src/features/block-project/component/Block.tsx
@@ -114,7 +114,7 @@ const Block: Component = () => {
<Show when={isDragging() && !isSpecialProject}>
<FileDropOverlay>Upload to this folder</FileDropOverlay>
</Show>
- <SidePanel.Layout defaultOpen={false}>
+ <SidePanel.Layout defaultOpen={false} floating>
<Show when={!isSpecialProject}>
<ProjectSidePanelSections />
</Show>
diff --git a/apps/web/src/features/block-project/component/sidepanel/ProjectSidePanelSections.tsx b/apps/web/src/features/block-project/component/sidepanel/ProjectSidePanelSections.tsx
index 28fc95d9fc..30d9b7de6d 100644
--- a/apps/web/src/features/block-project/component/sidepanel/ProjectSidePanelSections.tsx
+++ b/apps/web/src/features/block-project/component/sidepanel/ProjectSidePanelSections.tsx
@@ -4,9 +4,11 @@ import {
EntityTagsSection,
} from '@app/features/property/side-panel/properties';
import { SidePanel } from '@components/app/side-panel';
+import { EntityMetadata } from '@components/app/side-panel/EntityMetadata';
import { useBlockId } from '@core/block';
import { useCanEdit } from '@core/signal/permissions';
import { useBlockDocumentName } from '@core/util/currentBlockDocumentName';
+import { useProjectDataQuery } from '@queries/storage/project-data';
import { Suspense } from 'solid-js';
export function ProjectSidePanelSections() {
@@ -16,20 +18,11 @@ export function ProjectSidePanelSections() {
return (
<>
- <SidePanel.Section id="details" title="Details" defaultOpen order={10}>
+ <SidePanel.Footer>
<Suspense fallback={<SidePanel.Loading />}>
- <EntityPropertiesSection
- entityId={projectId}
- entityType="PROJECT"
- canEdit={canEdit()}
- documentName={projectName()}
- includeMetadata
- propertyFilter={(property) => property.isMetadata === true}
- showAddProperty={false}
- showTags={false}
- />
+ <ProjectMetadata projectId={projectId} />
</Suspense>
- </SidePanel.Section>
+ </SidePanel.Footer>
<EntityTagsSection
entityId={projectId}
entityType="PROJECT"
@@ -61,3 +54,14 @@ export function ProjectSidePanelSections() {
</>
);
}
+
+function ProjectMetadata(props: { projectId: string }) {
+ const query = useProjectDataQuery(() => props.projectId);
+ return (
+ <EntityMetadata
+ ownerId={query.data?.userId}
+ createdAt={query.data?.createdAt}
+ updatedAt={query.data?.updatedAt}
+ />
+ );
+}
diff --git a/apps/web/src/features/block-unknown/component/Block.tsx b/apps/web/src/features/block-unknown/component/Block.tsx
index eb69371ea9..1a63e05204 100644
--- a/apps/web/src/features/block-unknown/component/Block.tsx
+++ b/apps/web/src/features/block-unknown/component/Block.tsx
@@ -61,7 +61,7 @@ function BlockUnknownContent() {
});
return (
- <SidePanel.Layout defaultOpen={!spreadsheet()}>
+ <SidePanel.Layout defaultOpen={!spreadsheet()} floating>
<FileSidePanelSections />
<div class="flex size-full min-w-0 flex-col overflow-hidden">
<div class="relative">
diff --git a/apps/web/src/features/block-video/component/Block.tsx b/apps/web/src/features/block-video/component/Block.tsx
index 3602431c50..26d0b87c51 100644
--- a/apps/web/src/features/block-video/component/Block.tsx
+++ b/apps/web/src/features/block-video/component/Block.tsx
@@ -10,7 +10,7 @@ export default function BlockVideo() {
return (
<DocumentBlockContainer>
<div class="size-full select-none overscroll-none overflow-hidden flex flex-col relative">
- <SidePanel.Layout defaultOpen={false}>
+ <SidePanel.Layout defaultOpen={false} floating>
<FileSidePanelSections />
<div class="flex size-full min-w-0 flex-col overflow-hidden">
<div class="relative">
diff --git a/apps/web/src/features/channel/Call/ChannelCallButton.tsx b/apps/web/src/features/channel/Call/ChannelCallButton.tsx
index fb5151576b..ef18e4700f 100644
--- a/apps/web/src/features/channel/Call/ChannelCallButton.tsx
+++ b/apps/web/src/features/channel/Call/ChannelCallButton.tsx
@@ -1,12 +1,12 @@
import { analytics } from '@app/lib/analytics';
import { useChannelTab } from '@channel/Channel/ChannelTabContext';
+import { HeaderActionButton } from '@components/app/HeaderActionButton';
import { useChannelName, useChannelType } from '@core/context/channels';
import { isMobile } from '@core/mobile/isMobile';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
import PhoneIcon from '@phosphor/phone-call.svg';
import { useActiveCallQuery } from '@queries/call/call';
import { ChannelTypeEnum } from '@service-storage/client';
-import { Button, cn, confirmDialog } from '@ui';
+import { cn, confirmDialog } from '@ui';
import { tourTarget } from '@ui/components/Tour';
import { getOwner, Show } from 'solid-js';
import { CHANNEL_TOUR } from '../tour';
@@ -33,12 +33,6 @@ export function ChannelCallButton(props: { channelId: string }) {
const tooltip = () => (isCallInProgress() ? 'Join Call' : 'Start Call');
const label = () => (isCallInProgress() ? 'Join' : 'Call');
- const variant = () => {
- if (isTouchDevice()) return 'ghost';
- if (isCallInProgress()) return 'success';
- return 'outline';
- };
-
const confirmTitle = () => {
const name = channelName();
if (!name) return 'Start a call?';
@@ -101,21 +95,14 @@ export function ChannelCallButton(props: { channelId: string }) {
return (
<Show when={!call.isInThisChannel()}>
- <Button
+ <HeaderActionButton
ref={tourTarget(CHANNEL_TOUR.call)}
onClick={handleClick}
tooltip={tooltip()}
- variant={variant()}
- size="sm"
- depth={2}
- class={cn(
- !isCallInProgress() && !isTouchDevice() && 'bg-surface',
- isTouchDevice() && 'active:bg-transparent'
- )}
- >
- <PhoneIcon />
- <span>{label()}</span>
- </Button>
+ label={label()}
+ icon={<PhoneIcon />}
+ class={cn(isCallInProgress() && 'text-success')}
+ />
</Show>
);
}
diff --git a/apps/web/src/features/channel/Channel/ChannelDetail.tsx b/apps/web/src/features/channel/Channel/ChannelDetail.tsx
index 7f98523e5e..10285e1f66 100644
--- a/apps/web/src/features/channel/Channel/ChannelDetail.tsx
+++ b/apps/web/src/features/channel/Channel/ChannelDetail.tsx
@@ -160,7 +160,7 @@ export function ChannelDetailActions(props: ChannelDetailHeaderProps) {
};
return (
- <div class="header-actions ml-auto flex shrink-0 items-center gap-2">
+ <div class="header-actions ml-auto flex shrink-0 items-center gap-1">
<DebugSuspense name="ChannelDetail.live-indicators">
<ChannelLiveIndicators channelId={props.channelId} />
</DebugSuspense>
diff --git a/apps/web/src/features/channel/channel-invite-button.tsx b/apps/web/src/features/channel/channel-invite-button.tsx
index dbc227ad30..3cd639965f 100644
--- a/apps/web/src/features/channel/channel-invite-button.tsx
+++ b/apps/web/src/features/channel/channel-invite-button.tsx
@@ -1,11 +1,10 @@
+import { HeaderActionButton } from '@components/app/HeaderActionButton';
import { useUserId } from '@core/context/user';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { useCombinedRecipients } from '@core/signal/useCombinedRecipient';
import UserPlusIcon from '@phosphor/user-plus.svg';
import { useChannelParticipantsQuery } from '@queries/channel/channel-participants';
import { useAddParticipantsMutation } from '@queries/channel/participants';
import { useCurrentTeamQuery } from '@queries/team/teams';
-import { Button, cn } from '@ui';
import { createSignal, Show, Suspense } from 'solid-js';
import { ChannelInviteModal } from './views/channel-invite-modal';
@@ -25,19 +24,12 @@ export function ChannelInviteButton(props: {
return (
<Show when={canInvite()}>
- <Button
- // On touch the button sits inside a floating header island, which
- // already draws the glass pill; an outline border inside it doubles up.
- variant={isTouchDevice() ? 'ghost' : 'outline'}
- size="sm"
- label="Invite people"
+ <HeaderActionButton
+ label="Invite"
+ icon={<UserPlusIcon />}
tooltip="Invite people"
- class={cn(isTouchDevice() && 'active:bg-transparent')}
onClick={() => setOpen(true)}
- >
- <UserPlusIcon />
- <span class="hidden sm:inline">Invite</span>
- </Button>
+ />
<Suspense>
<Show when={open()}>
<ChannelInviteDialog
diff --git a/apps/web/src/features/chat/ChatWithAgentButton.tsx b/apps/web/src/features/chat/ChatWithAgentButton.tsx
index ee55949a69..d8f67d97c1 100644
--- a/apps/web/src/features/chat/ChatWithAgentButton.tsx
+++ b/apps/web/src/features/chat/ChatWithAgentButton.tsx
@@ -1,6 +1,7 @@
import { agentsRouteId } from '@app/features/agents-view/core/route';
import { startPendingSession } from '@app/features/block-agent/context/pending-session';
import { globalSplitManager } from '@app/signal/splitLayout';
+import { HeaderActionButton } from '@components/app/HeaderActionButton';
import type { SplitHandle } from '@components/app/split-layout/layoutManager';
import {
type ChatAttachmentMention,
@@ -10,7 +11,6 @@ import { toast } from '@core/component/Toast/Toast';
import { fileTypeToBlockName } from '@core/constant/allBlocks';
import AgentIcon from '@phosphor/sparkle.svg';
import type { ChannelType } from '@service-cognition/generated/schemas/channelType';
-import { Button } from '@ui';
import { createSignal } from 'solid-js';
export { AgentIcon as ChatWithAgentIcon };
@@ -145,33 +145,24 @@ export function ChatWithAgentButton(props: {
}
}
return (
- <Button
+ <HeaderActionButton
tooltip={props.label ?? 'Chat with Agent'}
- variant="outline"
- size="sm"
+ label={props.label ?? 'Chat'}
+ icon={<AgentIcon />}
onClick={() => void open()}
disabled={props.disabled || opening()}
- aria-busy={opening()}
- depth={2}
- class="bg-surface"
- >
- <AgentIcon />
- <span class="text-xs">{props.label ?? 'Chat'}</span>
- </Button>
+ busy={opening()}
+ />
);
}
export function AskMacroButton(props: { entity: ChatWithAgentEntity }) {
return (
- <Button
+ <HeaderActionButton
onClick={() => openChatWithAgent(props.entity)}
- variant="ghost"
- size="sm"
- depth={2}
- class="gap-1.5 border border-edge-muted px-2"
- >
- <AgentIcon />
- <span class="text-xs font-medium">Ask Macro</span>
- </Button>
+ tooltip="Ask Macro"
+ label="Ask Macro"
+ icon={<AgentIcon />}
+ />
);
}
diff --git a/apps/web/src/features/crm/views/company-detail.tsx b/apps/web/src/features/crm/views/company-detail.tsx
index 0b62dac210..b2c0f17b47 100644
--- a/apps/web/src/features/crm/views/company-detail.tsx
+++ b/apps/web/src/features/crm/views/company-detail.tsx
@@ -24,7 +24,7 @@ import { useCompanyQuery } from './use-crm';
* Root of the company detail view, laid out like a project: the host's top
* bar picks the section, Overview shows the company with its description and
* discussion, and the other sections list its team, emails, files, tasks and
- * calls. Properties and sharing stay in the right-hand SidePanel.
+ * calls. Properties and sharing open in the floating information panel.
*/
export function Company(props: {
companyId: string;
@@ -53,7 +53,11 @@ export function Company(props: {
);
return (
- <SidePanel.Layout headerToggle={props.headerToggle}>
+ <SidePanel.Layout
+ headerToggle={props.headerToggle}
+ floating
+ defaultOpen={false}
+ >
<div class="size-full min-h-0 min-w-0">
<Switch>
<Match when={section() === 'overview'}>
diff --git a/apps/web/src/features/crm/views/contact-detail.tsx b/apps/web/src/features/crm/views/contact-detail.tsx
index 56fba59633..a3d22f7eb8 100644
--- a/apps/web/src/features/crm/views/contact-detail.tsx
+++ b/apps/web/src/features/crm/views/contact-detail.tsx
@@ -17,7 +17,7 @@ import { useContactQuery, useIsTeamAdmin } from './use-crm';
* Root of the contact detail view, laid out like a project: the host's top
* bar picks the section, Overview shows the contact and its discussion, and
* the other sections list its emails, files, tasks and calls. Sharing stays
- * in the right-hand SidePanel.
+ * in the floating information panel.
*/
export function Contact(props: {
contactId: string;
@@ -46,7 +46,11 @@ export function Contact(props: {
);
return (
- <SidePanel.Layout headerToggle={props.headerToggle}>
+ <SidePanel.Layout
+ headerToggle={props.headerToggle}
+ floating
+ defaultOpen={false}
+ >
<div class="size-full min-h-0 min-w-0">
<Switch>
<Match when={section() === 'overview'}>
diff --git a/apps/web/src/features/crm/views/record-detail.tsx b/apps/web/src/features/crm/views/record-detail.tsx
index 50b07fafc5..109f420975 100644
--- a/apps/web/src/features/crm/views/record-detail.tsx
+++ b/apps/web/src/features/crm/views/record-detail.tsx
@@ -123,7 +123,7 @@ export function CrmCompanyDetail(props: {
</ViewBreadcrumbs.Item>
)}
</Show>
- <SidePanel.Root persistKey="crm-company">
+ <SidePanel.Root floating defaultOpen={false}>
<div
ref={container}
tabindex={-1}
@@ -153,7 +153,7 @@ export function CrmCompanyDetail(props: {
/>
</Show>
</div>
- <div class="ml-auto flex shrink-0 items-center gap-2">
+ <div class="ml-auto flex shrink-0 items-center gap-1">
<CrmCopyLinkButton
type={selectedContact() ? 'contact' : 'company'}
id={selectedContact()?.id ?? props.company.id}
diff --git a/apps/web/src/features/drive-view/components/DriveDetailView.tsx b/apps/web/src/features/drive-view/components/DriveDetailView.tsx
index 6f2b7bc196..45142f8ec3 100644
--- a/apps/web/src/features/drive-view/components/DriveDetailView.tsx
+++ b/apps/web/src/features/drive-view/components/DriveDetailView.tsx
@@ -80,7 +80,8 @@ function DriveDetailTopBar() {
aria-label="File location"
fallback={<EntityDetailBreadcrumbSkeleton />}
/>
- <div class="ml-auto flex shrink-0 items-center gap-2">
+ <div class="ml-auto flex shrink-0 items-center gap-1">
+ <SidePanel.HeaderActionsOutlet />
<Show when={activeDetail()}>
{(detail) => (
<ShareTrigger
@@ -225,7 +226,7 @@ export function DriveDetailView() {
return (
<>
<DriveDetailAncestorBreadcrumbs orderOffset={breadcrumbOrderOffset()} />
- <SidePanel.Root>
+ <SidePanel.Root floating>
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<Show when={!hasBlockHeader()}>
<DriveDetailTopBar />
diff --git a/apps/web/src/features/drive-view/components/FileDetail.tsx b/apps/web/src/features/drive-view/components/FileDetail.tsx
index b6b6cdf384..f29634cb31 100644
--- a/apps/web/src/features/drive-view/components/FileDetail.tsx
+++ b/apps/web/src/features/drive-view/components/FileDetail.tsx
@@ -34,6 +34,7 @@ export function FileDetailLayout(props: FileDetailLayoutProps) {
return (
<SidePanel.Layout
+ floating
defaultOpen={props.defaultSidePanelOpen ?? false}
persistKey={`file:${props.documentId}`}
headerToggle={false}
diff --git a/apps/web/src/features/drive-view/components/FileDetailBreadcrumbItem.tsx b/apps/web/src/features/drive-view/components/FileDetailBreadcrumbItem.tsx
index f15d02bf0c..19884b49a6 100644
--- a/apps/web/src/features/drive-view/components/FileDetailBreadcrumbItem.tsx
+++ b/apps/web/src/features/drive-view/components/FileDetailBreadcrumbItem.tsx
@@ -1,3 +1,4 @@
+import { DocumentTitleHoverCard } from '@app/components/entity-detail/DocumentTitleHoverCard';
import { ViewBreadcrumbs } from '@app/components/view-shell';
import { useBlockEntityCommands } from '@app/features/next-soup/actions';
import type { FileOperation } from '@components/app/split-layout/components/SplitFileMenu';
@@ -60,19 +61,26 @@ export function FileDetailBreadcrumbItem(props: {
>
{(item) => (
<div class="flex min-w-0 items-center motion-safe:animate-[dialog-overlay-open_150ms_ease-out]">
- <ViewBreadcrumbs.Button
- class="gap-1.5"
- isActive={item.isActive()}
- onClick={item.onSelect}
- tooltip={documentName()}
+ <DocumentTitleHoverCard
+ documentId={documentId()}
+ name={documentName()}
+ ownerId={props.documentMetadata.owner}
+ createdAt={props.documentMetadata.createdAt}
+ updatedAt={props.documentMetadata.updatedAt}
>
- <EntityIcon
- targetType={props.blockType}
- size="xs"
- class="shrink-0"
- />
- <span class="truncate">{documentName()}</span>
- </ViewBreadcrumbs.Button>
+ <ViewBreadcrumbs.Button
+ class="gap-1.5"
+ isActive={item.isActive()}
+ onClick={item.onSelect}
+ >
+ <EntityIcon
+ targetType={props.blockType}
+ size="xs"
+ class="shrink-0"
+ />
+ <span class="truncate">{documentName()}</span>
+ </ViewBreadcrumbs.Button>
+ </DocumentTitleHoverCard>
<div class="shrink-0">
<SplitFileMenu
id={documentId()}
diff --git a/apps/web/src/features/drive-view/views/MarkdownDetail.tsx b/apps/web/src/features/drive-view/views/MarkdownDetail.tsx
index c815e5288b..77fd0d5263 100644
--- a/apps/web/src/features/drive-view/views/MarkdownDetail.tsx
+++ b/apps/web/src/features/drive-view/views/MarkdownDetail.tsx
@@ -6,7 +6,6 @@ import {
import { ModalsProvider } from '@block-md/component/ModalsProvider';
import { MarkdownSidePanelSections } from '@block-md/component/sidepanel/MarkdownSidePanelSections';
import { createMarkdownDocumentState } from '@block-md/context/markdown-document-state';
-import { OldOverlay } from '@block-md/history/OldOverlay';
import { createMarkdownRouteNavigation } from '@block-md/primitives/create-markdown-route-navigation';
import {
loadMarkdownDocument,
@@ -113,13 +112,12 @@ function MarkdownDetailContent(props: {
fallbackName={props.fallbackName}
>
<ModalsProvider>
- <OldOverlay />
{props.children?.({
data: props.data,
documentMetadata: props.data.metadata,
userAccessLevel: props.data.userAccessLevel,
})}
- <SidePanel.Layout headerToggle={false}>
+ <SidePanel.Layout headerToggle={false} floating>
<Show when={ENABLE_MARKDOWN_SIDE_PANEL}>
<MarkdownSidePanelSections />
</Show>
diff --git a/apps/web/src/features/drive-view/views/PdfDetail.tsx b/apps/web/src/features/drive-view/views/PdfDetail.tsx
index b7969a4871..398ddf5e45 100644
--- a/apps/web/src/features/drive-view/views/PdfDetail.tsx
+++ b/apps/web/src/features/drive-view/views/PdfDetail.tsx
@@ -1,3 +1,4 @@
+import { AskMacroButton } from '@app/features/chat/ChatWithAgentButton';
import {
PdfDocument,
PdfDocumentContent,
@@ -20,6 +21,7 @@ import {
downloadPdfDocument,
printPdfDocument,
} from '@block-pdf/util/pdf-file-actions';
+import { SidePanel } from '@components/app/side-panel';
import type { FileOperation } from '@components/app/split-layout/components/SplitFileMenu';
import { useIsAuthenticated } from '@core/auth';
import {
@@ -142,6 +144,17 @@ export function PdfDetailDocument(props: {
documentMetadata={props.data.documentMetadata}
userAccessLevel={props.data.userAccessLevel}
>
+ <SidePanel.HeaderActions>
+ <AskMacroButton
+ entity={{
+ type: 'document',
+ id: props.documentId,
+ name:
+ props.data.documentMetadata.documentName ?? 'Unknown Filename',
+ fileType: 'pdf',
+ }}
+ />
+ </SidePanel.HeaderActions>
<PdfDocument
documentId={props.documentId}
documentVersionId={props.data.documentMetadata.documentVersionId}
diff --git a/apps/web/src/features/email-thread/components/copy-subject-button.tsx b/apps/web/src/features/email-thread/components/copy-subject-button.tsx
index 2441cd7526..511f7475c5 100644
--- a/apps/web/src/features/email-thread/components/copy-subject-button.tsx
+++ b/apps/web/src/features/email-thread/components/copy-subject-button.tsx
@@ -1,9 +1,8 @@
import { isPlaceholderSubject } from '@app/features/email-compose/core/subject-text';
-import IconCheck from '@phosphor/check.svg';
import CopyIcon from '@phosphor/copy.svg';
-import { debounce } from '@solid-primitives/scheduled';
+import { CopyButton } from '@ui';
import { cn } from '@ui/utils/classname';
-import { createSignal, Show } from 'solid-js';
+import { Show } from 'solid-js';
function copyableSubject(title: string): string | undefined {
const subject = title.trim();
@@ -14,35 +13,27 @@ function copyableSubject(title: string): string | undefined {
export function CopySubjectButton(props: {
subject: string;
class?: string;
- onCopy?: (subject: string) => void;
+ onCopy?: (subject: string) => void | boolean | Promise<void | boolean>;
}) {
- const [copied, setCopied] = createSignal(false);
- const resetCopied = debounce(() => setCopied(false), 800);
-
function handleCopy(e: MouseEvent) {
e.stopPropagation();
const subject = copyableSubject(props.subject);
- if (!subject) return;
- props.onCopy?.(subject);
- setCopied(true);
- resetCopied();
+ if (!subject) return false;
+ return props.onCopy?.(subject);
}
return (
<Show when={props.onCopy && copyableSubject(props.subject)}>
- <button
- type="button"
+ <CopyButton
+ variant="ghost"
+ size="icon-sm"
+ noTouchResize
aria-label="Copy subject"
- class={cn(
- 'inline-flex align-middle size-6 items-center justify-center rounded-md select-none text-inherit hover:bg-ink/10',
- props.class
- )}
+ class={cn('align-middle text-inherit', props.class)}
onClick={handleCopy}
>
- <Show when={copied()} fallback={<CopyIcon class="size-3.5" />}>
- <IconCheck class="size-3.5" />
- </Show>
- </button>
+ <CopyIcon class="size-3.5" />
+ </CopyButton>
</Show>
);
}
diff --git a/apps/web/src/features/email-thread/components/email-thread-title.tsx b/apps/web/src/features/email-thread/components/email-thread-title.tsx
index 6fde4f6285..952e17c208 100644
--- a/apps/web/src/features/email-thread/components/email-thread-title.tsx
+++ b/apps/web/src/features/email-thread/components/email-thread-title.tsx
@@ -10,7 +10,7 @@ function lastWordCluster(title: string): { lead: string; last: string } {
export function EmailThreadTitle(props: {
title: string;
- onCopy?: (subject: string) => void;
+ onCopy?: (subject: string) => void | boolean | Promise<void | boolean>;
copyReveal?: 'hover' | 'always';
class?: string;
}) {
diff --git a/apps/web/src/features/email-thread/context/email-thread-view-context.tsx b/apps/web/src/features/email-thread/context/email-thread-view-context.tsx
index af699fb083..73e1b846b5 100644
--- a/apps/web/src/features/email-thread/context/email-thread-view-context.tsx
+++ b/apps/web/src/features/email-thread/context/email-thread-view-context.tsx
@@ -12,10 +12,11 @@ import type { EmailThreadContext } from './email-thread-context';
export interface EmailThreadViewContext {
thread: EmailThreadContext;
- copySubject?: (subject: string) => void;
+ copySubject?: (subject: string) => void | boolean | Promise<void | boolean>;
compose: EmailComposeContext;
composeHost?: EmailComposeHost;
rendering: {
+ renderTags?: () => JSX.Element;
renderInvitation?: (
message: EmailMessage,
invitation: CalendarInvitation
diff --git a/apps/web/src/features/email-thread/core/email-thread.ts b/apps/web/src/features/email-thread/core/email-thread.ts
index 56eb463213..1f6b149945 100644
--- a/apps/web/src/features/email-thread/core/email-thread.ts
+++ b/apps/web/src/features/email-thread/core/email-thread.ts
@@ -4,6 +4,8 @@ import type { EmailMessage } from '../../email-message/core/email-message';
export interface EmailThread {
access_level: 'view' | 'comment' | 'edit' | 'owner';
db_id: string;
+ created_at?: string;
+ updated_at?: string;
inbox_visible: boolean;
is_read: boolean;
latest_inbound_message_ts?: string | null;
diff --git a/apps/web/src/features/email-thread/email-thread.test.tsx b/apps/web/src/features/email-thread/email-thread.test.tsx
index 4206717802..78b83f17d9 100644
--- a/apps/web/src/features/email-thread/email-thread.test.tsx
+++ b/apps/web/src/features/email-thread/email-thread.test.tsx
@@ -13,6 +13,7 @@ const mocks = vi.hoisted(() => ({
source: vi.fn(),
composeOptions: vi.fn<(options: EmailComposeContextOptions) => void>(),
}));
+vi.mock('@property/tags', () => ({ InlineFetchedEntityTagsPill: () => null }));
vi.mock('@queries/email/thread', () => ({ useThreadQuery: mocks.query }));
vi.mock('@queries/email/draft-cache', () => ({
clearSavedDraftThreadCache: mocks.clearDraft,
diff --git a/apps/web/src/features/email-thread/email-thread.tsx b/apps/web/src/features/email-thread/email-thread.tsx
index e109c1b9a8..9226da79c6 100644
--- a/apps/web/src/features/email-thread/email-thread.tsx
+++ b/apps/web/src/features/email-thread/email-thread.tsx
@@ -4,9 +4,16 @@ import { isMobile } from '@core/mobile/isMobile';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { useContacts } from '@core/user';
import { createEffectOnEntityTypeNotification } from '@notifications';
+import { InlineFetchedEntityTagsPill } from '@property/tags';
import { clearSavedDraftThreadCache } from '@queries/email/draft-cache';
import type { ThreadQueryTransport } from '@queries/email/thread';
-import { type Accessor, createEffect, createMemo, onCleanup } from 'solid-js';
+import {
+ type Accessor,
+ createEffect,
+ createMemo,
+ onCleanup,
+ Suspense,
+} from 'solid-js';
import { useCalendarPreferences } from '../calendar/utils/preferences';
import { createEmailComposeContext } from '../email-compose/compose-adapter';
import { createEmailComposeHost } from '../email-compose/compose-host-adapter';
@@ -64,18 +71,33 @@ export function EmailThread(props: EmailThreadProps) {
createThreadActionAdapter(source.id, snapshot),
};
const viewContext = {
- copySubject: (subject: string) => {
- void navigator.clipboard
- .writeText(subject)
- .then(() => compose.notices.feedback.success('Subject copied'))
- .catch(() =>
- compose.notices.feedback.failure('Unable to copy subject')
- );
+ copySubject: async (subject: string) => {
+ try {
+ await navigator.clipboard.writeText(subject);
+ return true;
+ } catch {
+ compose.notices.feedback.failure('Unable to copy subject');
+ return false;
+ }
},
thread: threadContext,
compose,
composeHost: createEmailComposeHost(),
rendering: {
+ renderTags: () => (
+ <Suspense
+ fallback={
+ <span class="h-6 w-24 rounded-full bg-skeleton skeleton-shimmer" />
+ }
+ >
+ <InlineFetchedEntityTagsPill
+ entityId={props.threadId()}
+ entityType="THREAD"
+ class="bg-surface-2"
+ showAddButton
+ />
+ </Suspense>
+ ),
renderInvitation: (
message: EmailMessage,
invitation: CalendarInvitation
diff --git a/apps/web/src/features/email-thread/queries/thread-source.ts b/apps/web/src/features/email-thread/queries/thread-source.ts
index 25932a8454..77326ba677 100644
--- a/apps/web/src/features/email-thread/queries/thread-source.ts
+++ b/apps/web/src/features/email-thread/queries/thread-source.ts
@@ -10,6 +10,8 @@ export function toEmailThread(thread: ApiThread): EmailThread {
return {
access_level: thread.access_level,
db_id: thread.db_id,
+ created_at: thread.created_at,
+ updated_at: thread.updated_at,
inbox_visible: thread.inbox_visible,
is_read: thread.is_read,
latest_inbound_message_ts: thread.latest_inbound_message_ts,
diff --git a/apps/web/src/features/email-thread/views/email-participants.tsx b/apps/web/src/features/email-thread/views/email-participants.tsx
index 9873684559..b3e62a0c7c 100644
--- a/apps/web/src/features/email-thread/views/email-participants.tsx
+++ b/apps/web/src/features/email-thread/views/email-participants.tsx
@@ -2,6 +2,7 @@ import { EmailUserTooltip } from '@app/features/email-message/components/email-u
import { UserIcon, type UserIconProps } from '@core/component/UserIcon';
import { emailToMacroId } from '@core/user/macroId';
import { Key } from '@solid-primitives/keyed';
+import { Badge, Button, badgeTriggerClasses } from '@ui';
import { createMemo, createSignal, Show } from 'solid-js';
import { useEmailThreadState } from '../context/email-thread-state-context';
import { useEmailThreadViewContext } from '../context/email-thread-view-context';
@@ -16,7 +17,8 @@ const DEFAULT_VISIBLE_COUNT = 5;
export function EmailParticipants() {
const context = useEmailThreadState();
- const currentUserEmail = useEmailThreadViewContext().thread.viewerEmail;
+ const viewContext = useEmailThreadViewContext();
+ const currentUserEmail = viewContext.thread.viewerEmail;
const [expanded, setExpanded] = createSignal(false);
const participants = createMemo(() => {
@@ -75,16 +77,27 @@ export function EmailParticipants() {
};
return (
- <div class="flex flex-wrap gap-1.5" role="list">
+ <div class="flex flex-wrap items-center gap-2" role="list">
+ <Show
+ when={context.permissions().isOwner && viewContext.rendering.renderTags}
+ >
+ {(renderTags) => (
+ <div role="listitem" class="inline-flex">
+ {renderTags()()}
+ </div>
+ )}
+ </Show>
<Key each={visibleParticipants()} by="email">
{(participant) => (
<EmailUserTooltip
recipient={{ email: participant().email, name: participant().name }}
photoUrl={participant().photoUrl}
>
- <div
+ <Badge
role="listitem"
- class="inline-flex items-center gap-1.5 rounded-full border border-ink-muted/8 bg-ink-muted/[0.025] py-1 pr-2.5 pl-1.5 text-sm text-ink hover:bg-ink-muted/[0.06] cursor-default"
+ variant="outline"
+ size="sm"
+ class="gap-1.5 bg-surface-2 border-edge"
>
<UserIcon
{...getIconProps(participant())}
@@ -96,18 +109,24 @@ export function EmailParticipants() {
<span class="truncate max-w-32">
{getDisplayName(participant())}
</span>
- </div>
+ </Badge>
</EmailUserTooltip>
)}
</Key>
<Show when={hiddenCount() > 0}>
- <button
- type="button"
+ <Button
+ variant="outline"
+ size="sm"
+ noTouchResize
onClick={() => setExpanded((v) => !v)}
- class="inline-flex items-center rounded-full border border-ink-muted/8 bg-ink-muted/[0.025] px-3 py-1 text-sm text-ink-muted hover:text-ink hover:bg-ink-muted/[0.06] tabular-nums"
+ class={badgeTriggerClasses({
+ variant: 'outline',
+ size: 'sm',
+ class: 'bg-surface-2 border-edge tabular-nums',
+ })}
>
{expanded() ? 'Show less' : `+${hiddenCount()} more`}
- </button>
+ </Button>
</Show>
</div>
);
diff --git a/apps/web/src/features/email-thread/views/message-list.tsx b/apps/web/src/features/email-thread/views/message-list.tsx
index 49b4403d58..aa460412ca 100644
--- a/apps/web/src/features/email-thread/views/message-list.tsx
+++ b/apps/web/src/features/email-thread/views/message-list.tsx
@@ -125,12 +125,11 @@ export function MessageList(props: MessageListProps) {
title={props.title ?? ''}
copyReveal={viewContext.thread.isTouch() ? 'always' : 'hover'}
class={
- viewContext.thread.isTouch()
- ? 'text-xl pt-1 pb-0'
- : 'text-2xl pb-1.5'
+ viewContext.thread.isTouch() ? 'text-xl pt-1 pb-0' : 'text-2xl'
}
/>
<Show when={!viewContext.thread.isTouch()}>
+ <div class="h-4.5" aria-hidden="true" />
<EmailParticipants />
</Show>
</div>
diff --git a/apps/web/src/features/email-view/components/EmailDetailView.tsx b/apps/web/src/features/email-view/components/EmailDetailView.tsx
index 7a7c15441a..75e9afa879 100644
--- a/apps/web/src/features/email-view/components/EmailDetailView.tsx
+++ b/apps/web/src/features/email-view/components/EmailDetailView.tsx
@@ -36,6 +36,7 @@ import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { buildEntityData } from '@entity';
import { useThreadQuery } from '@queries/email/thread';
import { representativeThreadMessage } from '@queries/email/thread-subject';
+import { ButtonGroup } from '@ui';
import { createMemo, createSignal, Show } from 'solid-js';
import { Portal } from 'solid-js/web';
import { emailDetailSearch } from '../email-route';
@@ -94,7 +95,17 @@ function EmailDetailHeader(
<Show when={props.controlsMount}>
{(mount) => (
<Portal mount={mount()}>
- <EmailThreadControls {...controls} />
+ <ButtonGroup variant="outline" size="icon-md" class="touch:hidden">
+ <EmailThreadControls {...controls} />
+ <Show when={props.listNavigation}>
+ {(navigation) => (
+ <ListNavigationButtons
+ navigation={navigation()}
+ class="gap-0"
+ />
+ )}
+ </Show>
+ </ButtonGroup>
</Portal>
)}
</Show>
@@ -221,7 +232,7 @@ export function EmailDetailView(props: {
};
return (
- <SidePanel.Root defaultOpen={false}>
+ <SidePanel.Root floating defaultOpen={false}>
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<ViewShell.TopBar class="touch:flex">
<ViewBreadcrumbs.Outlet
@@ -229,11 +240,9 @@ export function EmailDetailView(props: {
aria-label="Email location"
fallback={<EntityDetailBreadcrumbSkeleton />}
/>
- <div class="ml-auto flex shrink-0 items-center gap-2">
- <div ref={setControlsMount} class="flex items-center gap-0.5" />
- <div class="touch:hidden">
- <ListNavigationButtons navigation={listNavigation} />
- </div>
+ <div class="ml-auto flex shrink-0 items-center gap-1 @max-[900px]/split-header:[&_[data-header-action]]:w-8 @max-[900px]/split-header:[&_[data-header-action]]:p-0 @max-[900px]/split-header:[&_[data-header-action-label]]:hidden">
+ <div ref={setControlsMount} class="flex items-center" />
+ <SidePanel.HeaderActionsOutlet />
<Show when={ENABLE_EMAIL_SHARING}>
<ShareTrigger
onClick={openShare}
diff --git a/apps/web/src/features/entity/owner/owner-display.tsx b/apps/web/src/features/entity/owner/owner-display.tsx
index 1779d8938b..fbd45cc7ba 100644
--- a/apps/web/src/features/entity/owner/owner-display.tsx
+++ b/apps/web/src/features/entity/owner/owner-display.tsx
@@ -12,11 +12,15 @@ import { type JSX, Match, type ParentProps, Show, Switch } from 'solid-js';
import { botOwnerName, type Owner, parseOwner } from './owner';
function IconAndName(
- props: ParentProps<{ name: string | undefined; title?: string }>
+ props: ParentProps<{
+ name: string | undefined;
+ title?: string;
+ textOnly?: boolean;
+ }>
): JSX.Element {
return (
<span class="inline-flex min-w-0 items-center gap-1.5" title={props.title}>
- {props.children}
+ <Show when={!props.textOnly}>{props.children}</Show>
<Show when={props.name !== undefined}>
<span class="truncate">{props.name}</span>
</Show>
@@ -24,9 +28,9 @@ function IconAndName(
);
}
-function TeamBadge(props: { name: string }): JSX.Element {
+function TeamBadge(props: { name: string; textOnly?: boolean }): JSX.Element {
return (
- <IconAndName name={props.name} title={props.name}>
+ <IconAndName name={props.name} title={props.name} textOnly={props.textOnly}>
<UsersThreeIcon class="size-4 shrink-0" />
</IconAndName>
);
@@ -47,6 +51,7 @@ function UserOwner(props: {
suppressClick?: boolean;
showTooltip?: boolean;
userAvatarOnly?: boolean;
+ textOnly?: boolean;
}): JSX.Element {
const userId = useUserId();
const name = () => {
@@ -54,7 +59,10 @@ function UserOwner(props: {
return label && props.id === userId() ? label : getDisplayName(props.id);
};
return (
- <IconAndName name={props.userAvatarOnly ? undefined : name()}>
+ <IconAndName
+ name={props.userAvatarOnly ? undefined : name()}
+ textOnly={props.textOnly}
+ >
<UserIcon
id={props.id}
size="sm"
@@ -69,15 +77,16 @@ function BotFace(props: {
principal: string;
name: string;
avatarUrl?: string;
+ textOnly?: boolean;
}): JSX.Element {
return (
- <IconAndName name={props.name}>
+ <IconAndName name={props.name} textOnly={props.textOnly}>
<UserIcon id={props.principal} photoUrl={props.avatarUrl} size="sm" />
</IconAndName>
);
}
-function ProfileBot(props: { botId: string }): JSX.Element {
+function ProfileBot(props: { botId: string; textOnly?: boolean }): JSX.Element {
const profile = useBotProfile(() => props.botId);
const settled = () => (queryReadyGate(profile) ? profile.data : undefined);
const name = () => {
@@ -90,20 +99,30 @@ function ProfileBot(props: { botId: string }): JSX.Element {
principal={`bot|${props.botId}`}
name={name()}
avatarUrl={settled()?.avatarUrl}
+ textOnly={props.textOnly}
/>
);
}
-function BotOwner(props: { botId: string }): JSX.Element {
+function BotOwner(props: { botId: string; textOnly?: boolean }): JSX.Element {
const firstParty = () => firstPartyBotName(props.botId);
return (
- <Show when={firstParty()} fallback={<ProfileBot botId={props.botId} />}>
- {(name) => <BotFace principal={`bot|${props.botId}`} name={name()} />}
+ <Show
+ when={firstParty()}
+ fallback={<ProfileBot botId={props.botId} textOnly={props.textOnly} />}
+ >
+ {(name) => (
+ <BotFace
+ principal={`bot|${props.botId}`}
+ name={name()}
+ textOnly={props.textOnly}
+ />
+ )}
</Show>
);
}
-function TeamOwner(props: { teamId: string }): JSX.Element {
+function TeamOwner(props: { teamId: string; textOnly?: boolean }): JSX.Element {
const teams = useUserTeamsQuery();
const name = () => {
if (queryReadyGate(teams)) {
@@ -113,12 +132,12 @@ function TeamOwner(props: { teamId: string }): JSX.Element {
}
return teams.isError ? 'Team' : '';
};
- return <TeamBadge name={name()} />;
+ return <TeamBadge name={name()} textOnly={props.textOnly} />;
}
-function UnknownOwner(): JSX.Element {
+function UnknownOwner(props: { textOnly?: boolean }): JSX.Element {
return (
- <IconAndName name="Unknown">
+ <IconAndName name="Unknown" textOnly={props.textOnly}>
<Avatar size="sm">
<Avatar.Fallback>?</Avatar.Fallback>
</Avatar>
@@ -139,6 +158,7 @@ export function OwnerLabel(props: {
suppressClick?: boolean;
showTooltip?: boolean;
userAvatarOnly?: boolean;
+ textOnly?: boolean;
}): JSX.Element {
const owner = () => parseOwner(props.ownerId);
return (
@@ -151,17 +171,20 @@ export function OwnerLabel(props: {
suppressClick={props.suppressClick}
showTooltip={props.showTooltip}
userAvatarOnly={props.userAvatarOnly}
+ textOnly={props.textOnly}
/>
)}
</Match>
<Match when={asKind(owner(), 'bot')}>
- {(bot) => <BotOwner botId={bot().botId} />}
+ {(bot) => <BotOwner botId={bot().botId} textOnly={props.textOnly} />}
</Match>
<Match when={asKind(owner(), 'team')}>
- {(team) => <TeamOwner teamId={team().teamId} />}
+ {(team) => (
+ <TeamOwner teamId={team().teamId} textOnly={props.textOnly} />
+ )}
</Match>
<Match when={asKind(owner(), 'unknown')}>
- <UnknownOwner />
+ <UnknownOwner textOnly={props.textOnly} />
</Match>
</Switch>
);
diff --git a/apps/web/src/features/home/components/HomeEntityDetailRouteView.tsx b/apps/web/src/features/home/components/HomeEntityDetailRouteView.tsx
index 225f3928b2..7f014641a8 100644
--- a/apps/web/src/features/home/components/HomeEntityDetailRouteView.tsx
+++ b/apps/web/src/features/home/components/HomeEntityDetailRouteView.tsx
@@ -1,4 +1,7 @@
-import { EntityDetail } from '@app/components/entity-detail/EntityDetail';
+import {
+ EntityDetail,
+ entityDetailBlockType,
+} from '@app/components/entity-detail/EntityDetail';
import type { EntityDetailTarget } from '@app/components/entity-detail/entity-detail-target';
import { ViewBreadcrumbs, ViewShell } from '@app/components/view-shell';
import { channelsSearch } from '@app/features/channels-view/channels-route';
@@ -13,6 +16,8 @@ import {
useSplitDisplayName,
useSplitPanelOrThrow,
} from '@components/app/split-layout/layoutUtils';
+import { ShareTrigger } from '@core/component/TopBar/ShareButton';
+import { useDocumentShareModal } from '@core/component/TopBar/shareModal';
import { type Accessor, createMemo, Match, Show, Switch } from 'solid-js';
import { isHomeDocumentType } from '../home-route-schema';
import { useHomeView } from '../home-view-context';
@@ -84,12 +89,32 @@ function HomeEntityDetailBody(props: {
value: Accessor<string>;
navigationRequest: number | string;
}) {
+ const panel = useSplitPanelOrThrow();
+ const documentShareTarget = () => {
+ const blockAlias = entityDetailBlockType(props.target);
+ return props.target.type === 'document' && blockAlias
+ ? { documentId: props.target.id, blockAlias }
+ : undefined;
+ };
+ const openShare = useDocumentShareModal(documentShareTarget);
+
return (
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<Show when={props.target.type !== 'channel'}>
- <ViewShell.TopBar>
+ <ViewShell.TopBar class="touch:flex">
<ViewBreadcrumbs.Outlet aria-label="Home location" />
- <div class="ml-auto">
+ <div class="ml-auto flex items-center gap-1">
+ <SidePanel.HeaderActionsOutlet />
+ <Show when={documentShareTarget()}>
+ {(target) => (
+ <ShareTrigger
+ onClick={openShare}
+ id={target().documentId}
+ blockType={target().blockAlias}
+ hotkeyScope={panel.splitHotkeyScope}
+ />
+ )}
+ </Show>
<SidePanel.Toggle />
</div>
</ViewShell.TopBar>
diff --git a/apps/web/src/features/projects/views/project-workspace.tsx b/apps/web/src/features/projects/views/project-workspace.tsx
index 55bc431132..8a4b10579f 100644
--- a/apps/web/src/features/projects/views/project-workspace.tsx
+++ b/apps/web/src/features/projects/views/project-workspace.tsx
@@ -1,5 +1,5 @@
import { SidePanel } from '@components/app/side-panel';
-import { EntityDetailsGrid } from '@components/app/side-panel/EntityDetailsGrid';
+import { EntityMetadata } from '@components/app/side-panel/EntityMetadata';
import { InlineTitleEditor } from '@core/component/InlineTitleEditor';
import { PropertyValuePill } from '@property/component/PropertyValuePill';
import { SYSTEM_PROPERTY_IDS } from '@property/identifiers';
@@ -60,14 +60,14 @@ export function ProjectWorkspace(props: {
};
return (
- <SidePanel.Layout headerToggle={false}>
- <SidePanel.Section id="details" title="Details" defaultOpen order={0}>
- <EntityDetailsGrid
+ <SidePanel.Layout headerToggle={false} floating defaultOpen={false}>
+ <SidePanel.Footer>
+ <EntityMetadata
ownerId={props.project.ownerId}
createdAt={props.project.createdAt}
updatedAt={props.project.updatedAt}
/>
- </SidePanel.Section>
+ </SidePanel.Footer>
<SidePanel.Section
id="properties"
title="Properties"
@@ -91,9 +91,12 @@ export function ProjectWorkspace(props: {
</Show>
</SidePanel.Section>
<Show when={canDeleteProject(props.project)}>
- <SidePanel.Section id="actions" title="Actions" order={3}>
+ <SidePanel.HeaderActions>
<Button
+ variant="ghost"
size="sm"
+ depth={2}
+ class="gap-1.5 border border-edge-muted px-2"
onClick={() => {
setError(undefined);
setDeleting(true);
@@ -101,7 +104,7 @@ export function ProjectWorkspace(props: {
>
Delete project
</Button>
- </SidePanel.Section>
+ </SidePanel.HeaderActions>
</Show>
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<Show when={error()}>
diff --git a/apps/web/src/features/property/component/AddPropertyButton.tsx b/apps/web/src/features/property/component/AddPropertyButton.tsx
new file mode 100644
index 0000000000..3bd24a9108
--- /dev/null
+++ b/apps/web/src/features/property/component/AddPropertyButton.tsx
@@ -0,0 +1,21 @@
+import PlusIcon from '@phosphor/plus.svg';
+import { badgeTriggerClasses } from '@ui';
+import { usePropertiesContext } from '../context/PropertiesContext';
+
+export function AddPropertyButton(props: { class?: string }) {
+ const { openPropertySelector } = usePropertiesContext();
+ return (
+ <button
+ type="button"
+ onClick={openPropertySelector}
+ class={badgeTriggerClasses({
+ variant: 'outline',
+ size: 'sm',
+ class: props.class,
+ })}
+ >
+ <PlusIcon class="size-3 shrink-0" />
+ <span>Add property</span>
+ </button>
+ );
+}
diff --git a/apps/web/src/features/property/component/PropertyValuePill.tsx b/apps/web/src/features/property/component/PropertyValuePill.tsx
index 3a36be4147..bb1eac43ee 100644
--- a/apps/web/src/features/property/component/PropertyValuePill.tsx
+++ b/apps/web/src/features/property/component/PropertyValuePill.tsx
@@ -1,13 +1,15 @@
-import { type ComponentProps, type JSX, Match, Switch } from 'solid-js';
+import { type ComponentProps, type JSX, Match, Show, Switch } from 'solid-js';
import { Property } from '../property';
-import { getEntityValues } from '../utils';
+import { getEntityValues, hasValue } from '../utils';
type PropertyValuePillProps = Pick<
ComponentProps<typeof Property.Root>,
- 'property' | 'canEdit' | 'onSave' | 'onRefresh'
+ 'property' | 'canEdit' | 'onSave' | 'onRefresh' | 'onEdit'
> & {
emptyLabel?: JSX.Element;
+ showLabel?: boolean;
class?: string;
+ hoverActions?: JSX.Element;
entitySelfFilter?: ComponentProps<
typeof Property.PopoverEditor
>['entitySelfFilter'];
@@ -27,9 +29,15 @@ export function PropertyValuePill(props: PropertyValuePillProps) {
canEdit={props.canEdit}
onSave={props.onSave}
onRefresh={props.onRefresh}
+ onEdit={props.onEdit}
>
- <Property.Tooltip property={props.property}>
+ <Property.Tooltip property={props.property} actions={props.hoverActions}>
<Property.Pill class={props.class} variant="outline">
+ <Show when={props.showLabel && hasValue(props.property)}>
+ <span class="shrink-0 text-ink-muted">
+ {props.property.displayName}:
+ </span>
+ </Show>
<Switch
fallback={
<Property.Icon
@@ -47,6 +55,8 @@ export function PropertyValuePill(props: PropertyValuePillProps) {
</Switch>
<Property.Text
property={props.property}
+ resolveSingleEntity={props.showLabel}
+ class="min-w-0 max-w-60"
fallback={
<Property.Empty
label={props.emptyLabel ?? props.property.displayName}
diff --git a/apps/web/src/features/property/extractors/PropertyText.tsx b/apps/web/src/features/property/extractors/PropertyText.tsx
index eb4f77b00f..c0c5133d34 100644
--- a/apps/web/src/features/property/extractors/PropertyText.tsx
+++ b/apps/web/src/features/property/extractors/PropertyText.tsx
@@ -1,6 +1,8 @@
import { isBotPrincipalId } from '@core/constant/macroAgent';
+import type { EntityReference } from '@service-properties/generated/schemas/entityReference';
import { cn } from '@ui';
import { type JSX, Show } from 'solid-js';
+import { usePropertyEntityDisplay } from '../hooks/usePropertyEntityDisplay';
import { usePropertyUserDisplay } from '../hooks/usePropertyUserDisplay';
import type { Property } from '../types';
import {
@@ -30,6 +32,8 @@ type Props = {
class?: string;
/** Override the rendered text (overrides default extraction). */
text?: string;
+ /** Resolve a single linked item to its name instead of showing "1 item". */
+ resolveSingleEntity?: boolean;
};
/**
@@ -58,10 +62,51 @@ export function PropertyText(props: Props) {
return entities.length === 1 ? entities[0].entity_id : undefined;
};
+ const singleEntity = () => {
+ if (!props.resolveSingleEntity || props.text !== undefined) return;
+ if (!isEntityProperty(props.property)) return;
+ if (props.property.specificEntityType === 'USER') return;
+ const entities = getEntityValues(props.property);
+ return entities.length === 1 ? entities[0] : undefined;
+ };
+
+ return (
+ <Show
+ keyed
+ when={singleEntity()}
+ fallback={<PropertyTextValue {...props} userId={userId()} />}
+ >
+ {(entity) => <EntityPropertyText entity={entity} class={props.class} />}
+ </Show>
+ );
+}
+
+function EntityPropertyText(props: {
+ entity: EntityReference;
+ class?: string;
+}) {
+ const { name, icon } = usePropertyEntityDisplay(
+ () => props.entity.entity_id,
+ () => props.entity.entity_type
+ );
+ return (
+ <span class={cn('inline-flex min-w-0 items-center gap-1.5', props.class)}>
+ <span
+ aria-hidden="true"
+ class="flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5"
+ >
+ {icon()}
+ </span>
+ <span class="truncate">{name()}</span>
+ </span>
+ );
+}
+
+function PropertyTextValue(props: Props & { userId?: string }) {
return (
<Show
keyed
- when={userId()}
+ when={props.userId}
fallback={
<PrimitivePropertyText
property={props.property}
diff --git a/apps/web/src/features/property/extractors/PropertyTooltip.tsx b/apps/web/src/features/property/extractors/PropertyTooltip.tsx
index 4d736cab8c..c851e1bad4 100644
--- a/apps/web/src/features/property/extractors/PropertyTooltip.tsx
+++ b/apps/web/src/features/property/extractors/PropertyTooltip.tsx
@@ -1,12 +1,13 @@
import { PropertyTooltip as CorePropertyTooltip } from '@property/component/propertyValue/PropertyTooltip';
import { HoverCard } from '@ui';
-import { type JSX, useContext } from 'solid-js';
+import { children, type JSX, Show, useContext } from 'solid-js';
import { PropertyRootContext } from '../core/context';
import type { Property } from '../types';
type Props = {
property: Property;
children: JSX.Element;
+ actions?: JSX.Element;
};
/**
@@ -21,11 +22,25 @@ type Props = {
*/
export function PropertyTooltip(props: Props) {
const ctx = useContext(PropertyRootContext);
+ const actions = children(() => props.actions);
+ const hasActions = () => actions.toArray().length > 0;
return (
<HoverCard
- content={<CorePropertyTooltip property={props.property} />}
+ content={
+ <div class="min-w-0">
+ <CorePropertyTooltip property={props.property} />
+ <Show when={hasActions()}>
+ <div class="mt-2 border-t border-edge-muted pt-1.5">
+ {actions()}
+ </div>
+ </Show>
+ </div>
+ }
disabled={ctx?.editorOpen() ?? false}
- contentClass="rounded-xl p-1.5 px-3 glass bg-menu-glass"
+ placement={hasActions() ? 'bottom-start' : 'bottom'}
+ contentClass={
+ hasActions() ? undefined : 'rounded-xl p-1.5 px-3 glass bg-menu-glass'
+ }
>
{props.children}
</HoverCard>
diff --git a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.test.tsx b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.test.tsx
index bc13b0a7fe..425379935e 100644
--- a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.test.tsx
+++ b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.test.tsx
@@ -8,6 +8,7 @@ import { EntityPropertiesSection } from './EntityPropertiesSection';
type PropertiesContext = ReturnType<typeof usePropertiesContext>;
const mocks = vi.hoisted(() => ({
properties: [] as Property[],
+ getProperties: undefined as (() => Property[]) | undefined,
context: undefined as unknown as PropertiesContext,
add: vi.fn(),
remove: vi.fn(),
@@ -58,7 +59,7 @@ vi.mock('@property/editor/hooks/useAllProperties', () => ({
}));
vi.mock('@property/hooks', () => ({
useEntityProperties: () => ({
- properties: () => mocks.properties,
+ properties: () => mocks.getProperties?.() ?? mocks.properties,
isLoading: () => false,
error: () => undefined,
refetch: mocks.refetch,
@@ -83,7 +84,7 @@ vi.mock('@queries/properties/entity', () => ({
useBulkSaveEntityPropertiesMutation: () => ({ mutateAsync: mocks.save }),
}));
vi.mock('@queries/properties/tags', () => ({
- useTagsQuery: () => ({ data: [] }),
+ useTagsQuery: () => ({ isSuccess: true, data: [] }),
}));
vi.mock('@ui', () => ({
Button: (props: JSX.ButtonHTMLAttributes<HTMLButtonElement>) => (
@@ -91,6 +92,7 @@ vi.mock('@ui', () => ({
),
Layer: (props: { children: JSX.Element }) => props.children,
Badge: () => null,
+ badgeTriggerClasses: () => '',
}));
function field(id: string, value: string | null = null): Property {
@@ -109,6 +111,7 @@ function field(id: string, value: string | null = null): Property {
beforeEach(() => {
mocks.properties = [];
+ mocks.getProperties = undefined;
mocks.add.mockReset().mockResolvedValue(undefined);
mocks.remove.mockReset().mockResolvedValue(undefined);
mocks.save.mockReset().mockResolvedValue(undefined);
@@ -184,8 +187,50 @@ it('refreshes native projections after successful add, remove, and save, never b
expect(changed).toHaveBeenCalledTimes(3);
});
-it('pins a definition the entity already carries instead of attaching it again', async () => {
- const pinned = vi.fn();
+it('keeps unpinned assignments visible in the panel when title pins change', () => {
+ mocks.properties = [field('Pinned', 'first'), field('Unpinned', 'second')];
+ const [pins, setPins] = createSignal(['instance-Pinned']);
+ render(() => (
+ <EntityPropertiesSection
+ entityId="document"
+ entityType="DOCUMENT"
+ canEdit
+ showTags={false}
+ defaultPinnedPropertyIds={() => []}
+ pinnedPropertyIds={pins}
+ />
+ ));
+ expect(screen.getByText('"first"')).toBeTruthy();
+ expect(screen.getByText('"second"')).toBeTruthy();
+ setPins([]);
+ expect(screen.getByText('"first"')).toBeTruthy();
+ expect(screen.getByText('"second"')).toBeTruthy();
+ expect(mocks.context.properties()).toHaveLength(2);
+ expect(mocks.remove).not.toHaveBeenCalled();
+});
+
+it('adds side-panel properties without exposing an automatic pin callback', () => {
+ const pins: string[] = [];
+ const [properties, setProperties] = createSignal<Property[]>([]);
+ mocks.getProperties = properties;
+ render(() => (
+ <EntityPropertiesSection
+ entityId="document"
+ entityType="DOCUMENT"
+ canEdit
+ showTags={false}
+ pinnedPropertyIds={() => pins}
+ />
+ ));
+ mocks.context.onPropertyAdded(['Custom']);
+ setProperties([field('Custom', 'saved value')]);
+ mocks.context.onPropertyAdded(['Custom']);
+ expect(screen.getByText('"saved value"')).toBeTruthy();
+ expect(mocks.context.onPropertyPinned).toBeUndefined();
+ expect(pins).toEqual([]);
+});
+
+it('preserves an existing property without reattaching or pinning it', async () => {
// Set when the task was created from a CRM record, but never pinned.
mocks.properties = [field('Companies', 'Acme')];
render(() => (
@@ -195,14 +240,14 @@ it('pins a definition the entity already carries instead of attaching it again',
canEdit
showTags={false}
pinnedPropertyIds={() => []}
- onPropertyPinned={pinned}
/>
));
- expect(screen.queryByText('"Acme"')).toBeNull();
+ expect(screen.getByText('"Acme"')).toBeTruthy();
mocks.context.onPropertyAdded(['Companies']);
await mocks.context.addProperty!('Companies');
expect(mocks.add).not.toHaveBeenCalled();
- expect(pinned).toHaveBeenCalledWith('instance-Companies');
+ expect(mocks.context.onPropertyPinned).toBeUndefined();
+ expect(screen.getByText('"Acme"')).toBeTruthy();
});
diff --git a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx
index 0a3359505b..1aeeb620a5 100644
--- a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx
+++ b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx
@@ -10,6 +10,7 @@ import Plus from '@phosphor/plus.svg';
import TrashIcon from '@phosphor/trash.svg';
import DeleteIcon from '@phosphor/x.svg';
import { Property as PropertyNS, useProperty } from '@property';
+import { AddPropertyButton } from '@property/component/AddPropertyButton';
import { Modals } from '@property/component/modal';
import { PropertyValueIcon } from '@property/component/propertyValue/PropertyValueIcon';
import {
@@ -61,7 +62,6 @@ export interface EntityPropertiesSectionProps {
requiredPropertyDefinitionIds?: readonly string[];
pinnedPropertyIds?: () => string[];
pinnedPropertyDefinitionOrder?: readonly string[];
- onPropertyPinned?: (propertyId: string) => void;
onPropertyUnpinned?: (propertyId: string) => void;
/**
* Placeholder properties shown (and editable) even when the entity has no
@@ -121,15 +121,15 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
props.includeMetadata ?? false
);
const allProperties = useAllProperties();
- const [pendingPinDefIds, setPendingPinDefIds] = createSignal<Set<string>>(
- new Set()
- );
+ const [pendingDefinitionIds, setPendingDefinitionIds] = createSignal<
+ Set<string>
+ >(new Set());
const tagsQuery = useTagsQuery();
const tagDefinitionIds = createMemo(
() =>
new Set(
- (tagsQuery.data ?? [])
+ (tagsQuery.isSuccess ? tagsQuery.data : [])
.map((set) => set.definition?.id)
.filter((id): id is string => !!id)
)
@@ -152,7 +152,7 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
);
const pendingPlaceholderProperties = allProperties().flatMap(
(definition) => {
- if (!pendingPinDefIds().has(definition.id)) return [];
+ if (!pendingDefinitionIds().has(definition.id)) return [];
if (hiddenDefinitionIds.has(definition.id)) return [];
if (fetchedDefinitionIds.has(definition.id)) return [];
if (defaultDefinitionIds.has(definition.id)) return [];
@@ -169,13 +169,9 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
];
});
- const filteredPinnedProperties = createMemo(() => {
- const defaultPinnedIds = props.defaultPinnedPropertyIds?.() ?? [];
- const pinnedIds = props.pinnedPropertyIds?.() ?? [];
- const usesPinnedFilter =
- props.defaultPinnedPropertyIds !== undefined ||
- props.pinnedPropertyIds !== undefined;
- const pinned = mergedProperties().filter((property) => {
+ const filteredProperties = createMemo(() => {
+ // Pins control the title row only. The panel lists every assigned property.
+ const visible = mergedProperties().filter((property) => {
if (tagDefinitionIds().has(property.propertyDefinitionId)) {
return false;
}
@@ -183,24 +179,19 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
return false;
}
if (property.isMetadata) return props.includeMetadata === true;
- if (pendingPinDefIds().has(property.propertyDefinitionId)) return true;
- if (!usesPinnedFilter) return true;
- return (
- defaultPinnedIds.includes(property.propertyDefinitionId) ||
- pinnedIds.includes(property.propertyId)
- );
+ return true;
});
- return sortPinnedProperties(pinned, props.pinnedPropertyDefinitionOrder);
+ return sortPinnedProperties(visible, props.pinnedPropertyDefinitionOrder);
});
- const gridPinnedProperties = createMemo(() =>
- filteredPinnedProperties().filter(
+ const gridProperties = createMemo(() =>
+ filteredProperties().filter(
(property) => !isNonUserMultiEntityProperty(property)
)
);
- const collectionPinnedProperties = createMemo(() =>
- filteredPinnedProperties().filter(isNonUserMultiEntityProperty)
+ const collectionProperties = createMemo(() =>
+ filteredProperties().filter(isNonUserMultiEntityProperty)
);
const defaultPinnedDefinitionIds = createMemo(
() =>
@@ -212,8 +203,7 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
const addEntityProperty = async (definitionId: string) => {
// The entity can carry a definition it never pinned (set at creation or
- // through the API); attaching it again would clear the value. The
- // pending pin above then pins the existing property instead.
+ // through the API); attaching it again would clear the value.
if (
properties().some(
(property) => property.propertyDefinitionId === definitionId
@@ -230,7 +220,7 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
const handlePropertyAdded = (addedDefinitionIds?: string[]) => {
if (addedDefinitionIds && addedDefinitionIds.length > 0) {
- setPendingPinDefIds((prev) => {
+ setPendingDefinitionIds((prev) => {
const next = new Set(prev);
for (const id of addedDefinitionIds) next.add(id);
return next;
@@ -241,7 +231,7 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
const removePendingProperty = (property: Property) => {
if (!property.propertyId.startsWith('pending:')) return;
- setPendingPinDefIds((prev) => {
+ setPendingDefinitionIds((prev) => {
const next = new Set(prev);
next.delete(property.propertyDefinitionId);
return next;
@@ -249,7 +239,7 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
};
const handlePropertyAddFailed = (definitionId: string) => {
- setPendingPinDefIds((prev) => {
+ setPendingDefinitionIds((prev) => {
const next = new Set(prev);
next.delete(definitionId);
return next;
@@ -258,7 +248,7 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
};
createEffect(() => {
- const pending = pendingPinDefIds();
+ const pending = pendingDefinitionIds();
if (pending.size === 0) return;
const remaining = new Set(pending);
@@ -267,13 +257,12 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
(property) => property.propertyDefinitionId === defId
);
if (instance) {
- props.onPropertyPinned?.(instance.propertyId);
remaining.delete(defId);
}
}
if (remaining.size !== pending.size) {
- setPendingPinDefIds(remaining);
+ setPendingDefinitionIds(remaining);
}
});
@@ -311,12 +300,11 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
entityType={props.entityType}
canEdit={props.canEdit}
documentName={props.documentName}
- properties={filteredPinnedProperties}
+ properties={filteredProperties}
onRefresh={refetch}
onPropertyAdded={handlePropertyAdded}
onPropertyAddFailed={handlePropertyAddFailed}
onPropertyDeleted={refetch}
- onPropertyPinned={props.onPropertyPinned}
onPropertyUnpinned={props.onPropertyUnpinned}
pinnedPropertyIds={props.pinnedPropertyIds}
addProperty={addEntityProperty}
@@ -342,9 +330,9 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
</div>
</Show>
- <Show when={gridPinnedProperties().length > 0}>
+ <Show when={gridProperties().length > 0}>
<SidePanel.Grid class="auto-rows-[minmax(1.75rem,auto)]">
- <For each={gridPinnedProperties()}>
+ <For each={gridProperties()}>
{(property) => (
<SidePanelPropertyRow
entityId={props.entityId}
@@ -362,9 +350,9 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
</SidePanel.Grid>
</Show>
- <Show when={collectionPinnedProperties().length > 0}>
+ <Show when={collectionProperties().length > 0}>
<div class="flex flex-col gap-2 pb-2">
- <For each={collectionPinnedProperties()}>
+ <For each={collectionProperties()}>
{(property) => (
<EntityCollectionProperty
entityId={props.entityId}
@@ -382,8 +370,13 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
</Show>
<Show when={props.canEdit && props.showAddProperty !== false}>
- <div class="mt-2">
- <AddPinnedPropertyButton />
+ <div
+ class={cn(
+ 'flex items-center',
+ filteredProperties().length > 0 && 'mt-2'
+ )}
+ >
+ <AddPropertyButton class="m-px gap-1.5" />
</div>
</Show>
<Modals />
@@ -393,23 +386,6 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {
);
}
-function AddPinnedPropertyButton() {
- const { openPropertySelector } = usePropertiesContext();
- return (
- <Button
- type="button"
- variant="ghost"
- size="sm"
- noTouchResize
- onClick={openPropertySelector}
- class="m-px"
- >
- <Plus class="size-3" />
- <span>Add property</span>
- </Button>
- );
-}
-
function propertyFromPendingDefinition(
definition: PropertyDefinitionDomain
): Property | undefined {
@@ -551,6 +527,7 @@ function SidePanelPropertyRow(props: {
/>
</PropertyNS.Root>
<PropertyRowActions
+ class="absolute right-0 top-1/2 z-1 -translate-y-1/2"
canRemoveFromEntity={props.canRemoveFromEntity}
property={props.property}
onRemovePendingProperty={props.onRemovePendingProperty}
@@ -566,6 +543,7 @@ function isPendingProperty(property: Property): boolean {
}
function PropertyRowActions(props: {
+ class?: string;
canRemoveFromEntity: boolean;
onRemovePendingProperty: (property: Property) => void;
property: Property;
@@ -611,9 +589,10 @@ function PropertyRowActions(props: {
<Show when={hasActions()}>
<div
class={cn(
- 'absolute right-0 top-1/2 z-1 flex -translate-y-1/2 items-center gap-0.5',
+ 'flex shrink-0 items-center gap-0.5',
'pointer-events-none opacity-0 transition-opacity',
- 'group-hover/property-row:opacity-100 group-focus-within/property-row:opacity-100 focus-within:opacity-100'
+ 'group-hover/property-row:opacity-100 group-focus-within/property-row:opacity-100 focus-within:opacity-100',
+ props.class
)}
onMouseDown={stopRowInteraction}
>
@@ -873,15 +852,15 @@ function EntityCollectionPropertyBody(props: {
};
return (
- <SidePanel.Card>
- <div class="group/property-row relative p-2">
- <div class="flex items-center justify-between gap-2">
- <span
- class="min-w-0 truncate text-ink-muted"
- title={props.property.displayName}
- >
- {props.property.displayName}
- </span>
+ <div class="group/property-row min-w-0 py-2">
+ <div class="flex items-center justify-between gap-2">
+ <span
+ class="min-w-0 truncate text-ink-muted"
+ title={props.property.displayName}
+ >
+ {props.property.displayName}
+ </span>
+ <div class="ml-auto flex shrink-0 items-center gap-1">
<Show when={!isReadOnly()}>
<Button
type="button"
@@ -904,29 +883,29 @@ function EntityCollectionPropertyBody(props: {
onRemovePendingProperty={props.onRemovePendingProperty}
/>
</div>
- <div class="mt-2 flex flex-wrap gap-1.5">
- <For
- each={entities()}
- fallback={<span class="text-ink-extra-muted">Empty</span>}
- >
- {(entityRef) => (
- <NonUserEntityChip
- property={props.property}
- entityId={entityRef.entity_id}
- entityType={entityRef.entity_type}
- specificMessageId={entityRef.specific_message_id}
- canEdit={!isReadOnly()}
- onRemove={() => handleRemoveEntity(entityRef.entity_id)}
- onEdit={(anchor) => {
- if (isReadOnly()) return;
- propertyCtx.openEditor(anchor);
- }}
- />
- )}
- </For>
- </div>
</div>
- </SidePanel.Card>
+ <div class="mt-2 flex flex-wrap gap-1.5">
+ <For
+ each={entities()}
+ fallback={<span class="text-ink-extra-muted">Empty</span>}
+ >
+ {(entityRef) => (
+ <NonUserEntityChip
+ property={props.property}
+ entityId={entityRef.entity_id}
+ entityType={entityRef.entity_type}
+ specificMessageId={entityRef.specific_message_id}
+ canEdit={!isReadOnly()}
+ onRemove={() => handleRemoveEntity(entityRef.entity_id)}
+ onEdit={(anchor) => {
+ if (isReadOnly()) return;
+ propertyCtx.openEditor(anchor);
+ }}
+ />
+ )}
+ </For>
+ </div>
+ </div>
);
}
diff --git a/apps/web/src/features/property/tags/EntityRowTags.tsx b/apps/web/src/features/property/tags/EntityRowTags.tsx
index 2f6e983c7c..01db94b55c 100644
--- a/apps/web/src/features/property/tags/EntityRowTags.tsx
+++ b/apps/web/src/features/property/tags/EntityRowTags.tsx
@@ -2,6 +2,7 @@ import CaretDownIcon from '@phosphor/caret-down.svg';
import CircleDashedEmpty from '@phosphor/circle-dashed.svg';
import FilterIcon from '@phosphor/funnel-simple.svg';
import PencilIcon from '@phosphor/pencil-simple.svg';
+import PlusIcon from '@phosphor/plus.svg';
import { useInFlightEntityPropertyOptions } from '@queries/properties/in-flight-options';
import { EntityType } from '@service-properties/generated/schemas/entityType';
import type { SoupProperty } from '@service-storage/generated/schemas/soupProperty';
@@ -337,6 +338,7 @@ export function InlineTagsPill(props: {
docTags: DocTags;
class?: string;
showPlaceholder?: boolean;
+ showAddButton?: boolean;
/**
* Fires when the tag picker session (popover or its editor dialog) opens or
* closes. Callers that hide the pill once it has no tags should collapse on
@@ -351,7 +353,9 @@ export function InlineTagsPill(props: {
`${tags().length} ${tags().length === 1 ? 'Tag' : 'Tags'}`;
return (
- <Show when={tags().length > 0 || props.showPlaceholder}>
+ <Show
+ when={tags().length > 0 || props.showPlaceholder || props.showAddButton}
+ >
<Layer depth={2}>
<TagPicker
docTags={props.docTags}
@@ -363,13 +367,23 @@ export function InlineTagsPill(props: {
// Capped so a long tag label truncates instead of squeezing
// whatever shares the row with the pill (e.g. a task title).
'min-w-0 max-w-35 gap-1.5 text-left',
- tags().length === 0 && 'text-ink-extra-muted',
+ tags().length === 0 &&
+ !props.showAddButton &&
+ 'text-ink-extra-muted',
props.class
),
})}
- triggerLabel="Change or select tags"
+ triggerLabel={
+ tags().length === 0 && props.showAddButton
+ ? 'Add tags'
+ : 'Change or select tags'
+ }
>
<Switch>
+ <Match when={tags().length === 0 && props.showAddButton}>
+ <PlusIcon class="size-3 shrink-0" />
+ <span>Add tags</span>
+ </Match>
<Match when={tags().length === 0}>
<span class="inline-flex min-w-0 items-center gap-1.5 opacity-50">
<CircleDashedEmpty class="size-3 shrink-0" />
@@ -407,7 +421,9 @@ export function InlineTagsPill(props: {
</span>
</Match>
</Switch>
- <CaretDownIcon class="size-3 shrink-0 @max-2xl/u-list:hidden" />
+ <Show when={tags().length > 0 || !props.showAddButton}>
+ <CaretDownIcon class="size-3 shrink-0 @max-2xl/u-list:hidden" />
+ </Show>
</TagPicker>
</Layer>
</Show>
@@ -438,6 +454,7 @@ export function InlineFetchedEntityTagsPill(props: {
entityId: string;
entityType: EntityType;
class?: string;
+ showAddButton?: boolean;
}) {
const docTags = useDocTags(props.entityId, props.entityType);
return (
@@ -445,6 +462,7 @@ export function InlineFetchedEntityTagsPill(props: {
docTags={docTags}
class={props.class}
showPlaceholder={props.entityType === EntityType.TASK}
+ showAddButton={props.showAddButton}
/>
);
}
diff --git a/apps/web/src/features/tasks-view/components/TasksDetailView.test.tsx b/apps/web/src/features/tasks-view/components/TasksDetailView.test.tsx
index 222effa036..f786c2481c 100644
--- a/apps/web/src/features/tasks-view/components/TasksDetailView.test.tsx
+++ b/apps/web/src/features/tasks-view/components/TasksDetailView.test.tsx
@@ -36,6 +36,7 @@ vi.mock('@components/app/side-panel', () => ({
SidePanel: {
Root: (props: ParentProps) => props.children,
Toggle: () => null,
+ HeaderActionsOutlet: () => null,
},
}));
vi.mock('@components/app/split-layout/layoutUtils', () => ({
diff --git a/apps/web/src/features/tasks-view/components/TasksDetailView.tsx b/apps/web/src/features/tasks-view/components/TasksDetailView.tsx
index e6e37d8cd7..905079489d 100644
--- a/apps/web/src/features/tasks-view/components/TasksDetailView.tsx
+++ b/apps/web/src/features/tasks-view/components/TasksDetailView.tsx
@@ -28,7 +28,8 @@ function TaskDetailTopBar(props: { documentId: string }) {
aria-label="Task location"
fallback={<EntityDetailBreadcrumbSkeleton />}
/>
- <div class="ml-auto flex shrink-0 items-center gap-2">
+ <div class="ml-auto flex shrink-0 items-center gap-1">
+ <SidePanel.HeaderActionsOutlet />
<ShareTrigger
onClick={openShare}
id={props.documentId}
@@ -78,7 +79,7 @@ export function TasksDetailView(props: {
});
return (
- <SidePanel.Root>
+ <SidePanel.Root floating>
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<TaskDetailTopBar documentId={props.task.id} />
<div class="relative min-h-0 min-w-0 flex-1">
diff --git a/apps/web/src/features/tasks-view/route.tsx b/apps/web/src/features/tasks-view/route.tsx
index 5fa87df782..44f1b1e703 100644
--- a/apps/web/src/features/tasks-view/route.tsx
+++ b/apps/web/src/features/tasks-view/route.tsx
@@ -155,7 +155,7 @@ function ProjectDetailRouteView() {
/>
<SplitRouter.Outlet
fallback={() => (
- <SidePanel.Root>
+ <SidePanel.Root floating defaultOpen={false}>
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden">
<ProjectDetail
route={{
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index 76c072bfb4..b2b69d468d 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -720,7 +720,7 @@ html[data-theme-light='false'] {
say), so the flattening stops at an island boundary. */
@utility header-actions {
& [data-button]:is([data-variant="ghost"], [data-variant="outline"]):not([data-header-island] *) {
- @apply glass-none rounded-xl border-0 bg-transparent;
+ @apply glass-none border-0 bg-transparent;
&:not(:hover):not(:active) {
background-image: none;
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/accessory/CodeBoxAccessory.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/accessory/CodeBoxAccessory.tsx
index 2a1cd2cfde..b4adc4ba91 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/accessory/CodeBoxAccessory.tsx
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/accessory/CodeBoxAccessory.tsx
@@ -3,7 +3,6 @@
* language selector.
*/
import { isInBlock, useIsNestedBlock } from '@core/block';
-import { toast } from '@core/component/Toast/Toast';
import { ENABLE_SVG_PREVIEW } from '@core/constant/featureFlags';
import { Switch } from '@kobalte/core/switch';
import { $isCodeNode, CodeNode } from '@lexical/code';
@@ -27,7 +26,7 @@ import FileRs from '@phosphor/file-rs.svg';
import FileSql from '@phosphor/file-sql.svg';
import FileTs from '@phosphor/file-ts.svg';
import TrashCan from '@phosphor/trash-simple.svg';
-import { Button, cn, Dropdown } from '@ui';
+import { Button, CopyButton, cn, Dropdown } from '@ui';
import {
$getNodeByKey,
type EditorThemeClasses,
@@ -181,18 +180,19 @@ export function CodeBoxAccessory(props: {
);
}
- const copyCode = () => {
+ const copyCode = async () => {
const code = props.editor.read(() => {
const node = $getNodeByKey(props.nodeKey);
if (!node) return '';
return node.getTextContent();
});
- if (!code) return;
+ if (!code) return false;
try {
- navigator.clipboard.writeText(code);
- toast.success('Copied code to clipboard');
+ await navigator.clipboard.writeText(code);
+ return true;
} catch (e) {
console.error('Failed to copy code to clipboard', e);
+ return false;
}
};
@@ -276,19 +276,19 @@ export function CodeBoxAccessory(props: {
<TrashCan />
</Button>
</Show>
- <Button
+ <CopyButton
variant="ghost"
size="icon-sm"
class="text-ink-extra-muted/50 h-full"
tooltip="Copy Code"
- on:click={(e) => {
+ onClick={(e) => {
e.stopPropagation();
e.preventDefault();
- copyCode();
+ return copyCode();
}}
>
<Copy />
- </Button>
+ </CopyButton>
</div>
</div>
<Show when={isPreviewMode() && showPreviewToggle()}>
@@ -403,14 +403,15 @@ export const StaticCodeBoxAccessory = (props: {
const isPreviewMode = () => props.isPreviewMode?.() ?? localPreviewMode();
const setIsPreviewMode = props.setIsPreviewMode ?? setLocalPreviewMode;
- const copyCode = () => {
+ const copyCode = async () => {
const code = props.code;
- if (!code) return;
+ if (!code) return false;
try {
- navigator.clipboard.writeText(code);
- toast.success('Copied code to clipboard');
+ await navigator.clipboard.writeText(code);
+ return true;
} catch (e) {
console.error('Failed to copy code to clipboard', e);
+ return false;
}
};
@@ -443,19 +444,19 @@ export const StaticCodeBoxAccessory = (props: {
</Switch>
</div>
</Show>
- <Button
+ <CopyButton
variant="ghost"
size="icon-sm"
class="text-ink-extra-muted/50 h-full"
tooltip="Copy Code"
- on:click={(e) => {
+ onClick={(e) => {
e.stopPropagation();
e.preventDefault();
- copyCode();
+ return copyCode();
}}
>
<Copy />
- </Button>
+ </CopyButton>
</div>
</div>
<Show when={isPreviewMode() && showPreviewToggle()}>
diff --git a/apps/web/src/lib/core/component/References.tsx b/apps/web/src/lib/core/component/References.tsx
index 57e7a53638..5eee52a6d3 100644
--- a/apps/web/src/lib/core/component/References.tsx
+++ b/apps/web/src/lib/core/component/References.tsx
@@ -1,6 +1,5 @@
import { navigateToChannelMessage } from '@block-channel/utils/link';
import { useGlobalBlockOrchestrator } from '@components/app/GlobalAppState';
-import { SidePanel } from '@components/app/side-panel';
import { useSplitLayout } from '@components/app/split-layout/layout';
import type { BlockAlias, BlockName } from '@core/block';
import { toast } from '@core/component/Toast/Toast';
@@ -87,7 +86,7 @@ function ReferenceRow(props: ReferenceRowProps) {
<div
role="button"
tabIndex={0}
- class="group/ref-row flex flex-col px-3 py-2 hover:bg-ink-muted/6 min-w-0 overflow-hidden"
+ class="group/ref-row flex min-w-0 flex-col overflow-hidden rounded-lg py-1 hover:bg-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"
onMouseDown={navHandlers.onMouseDown}
onClick={navHandlers.onClick}
onKeyDown={(e) => {
@@ -97,9 +96,9 @@ function ReferenceRow(props: ReferenceRowProps) {
}
}}
>
- <div class="flex items-center gap-2 min-w-0 text-xs leading-5">
+ <div class="flex min-h-6 min-w-0 items-center gap-1.5 text-xs leading-5">
<Show when={props.senderAvatar}>{props.senderAvatar}</Show>
- <div class="min-w-0 flex flex-1 items-center gap-1.5 overflow-hidden">
+ <div class="min-w-0 flex max-w-max flex-1 items-center gap-1.5 overflow-hidden">
<Show when={props.senderName}>
<span class="ph-no-capture shrink-0 font-medium text-ink truncate max-w-[8rem]">
{props.senderName}
@@ -110,7 +109,10 @@ function ReferenceRow(props: ReferenceRowProps) {
{props.source}
</div>
</div>
- <span class="shrink-0 ml-auto text-ink-extra-muted tabular-nums">
+ <span aria-hidden class="shrink-0 text-ink-extra-muted">
+ ·
+ </span>
+ <span class="shrink-0 text-ink-extra-muted tabular-nums">
{formatRelativeTimestamp(props.timestamp)}
</span>
</div>
@@ -291,7 +293,7 @@ export function References(props: ReferenceProps) {
</div>
}
>
- <SidePanel.Card>
+ <div class="flex flex-col">
<For each={sortedReferences()}>
{(ref) => {
if (isChannelReference(ref)) {
@@ -324,7 +326,7 @@ export function References(props: ReferenceProps) {
);
}}
</For>
- </SidePanel.Card>
+ </div>
</Show>
);
}
diff --git a/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx b/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx
index f75d8a6367..f93fd1d87f 100644
--- a/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx
+++ b/apps/web/src/lib/core/component/TopBar/ShareButton.test.tsx
@@ -256,21 +256,23 @@ vi.mock('@ui', async () => {
onChange?: (value: string) => void;
}>();
const Container = (props: { children?: JSX.Element }) => props.children;
+ const Button = (props: {
+ children?: JSX.Element;
+ disabled?: boolean;
+ tooltip?: string;
+ onClick?: () => void;
+ }) => (
+ <button
+ disabled={props.disabled}
+ onClick={props.onClick}
+ aria-label={props.tooltip}
+ >
+ {props.children}
+ </button>
+ );
return {
- Button: (props: {
- children?: JSX.Element;
- disabled?: boolean;
- tooltip?: string;
- onClick?: () => void;
- }) => (
- <button
- disabled={props.disabled}
- onClick={props.onClick}
- aria-label={props.tooltip}
- >
- {props.children}
- </button>
- ),
+ Button,
+ CopyButton: Button,
Panel: Object.assign(Container, { Header: Container, Body: Container }),
// The owner row draws an unknown owner's avatar.
Avatar: Object.assign(Container, { Fallback: Container }),
diff --git a/apps/web/src/lib/core/component/TopBar/ShareButton.tsx b/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
index dca56154dd..3597bda585 100644
--- a/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
+++ b/apps/web/src/lib/core/component/TopBar/ShareButton.tsx
@@ -1,6 +1,7 @@
import { projectRouteId } from '@app/features/projects/core/route';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
import { useChannelParticipants } from '@channel/use-channel-participants';
+import { HeaderActionButton } from '@components/app/HeaderActionButton';
import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
import { useIsAuthenticated } from '@core/auth';
import {
@@ -74,6 +75,7 @@ import { createCallback } from '@solid-primitives/rootless';
import { useNavigate } from '@solidjs/router';
import {
Button,
+ CopyButton,
cn,
Dropdown,
type ManagedDialogProps,
@@ -1194,7 +1196,10 @@ export function ShareModal(props: ShareModalProps) {
? {
accessLevel: teamShareAccessLevel(),
setAccessLevel: setTeamShareAccessLevel,
- itemNoun: getShareItemNoun(props.itemType),
+ itemNoun:
+ props.blockAlias === 'snippet'
+ ? 'snippet'
+ : getShareItemNoun(props.itemType),
scopeOptions: teamShareScopeOptionsForItem(props.itemType),
}
: undefined;
@@ -1620,19 +1625,20 @@ export function ShareTrigger(props: {
const copyLink = createCallback(() => {
if (props.copyLink) return props.copyLink();
- copyEntityLink(shareUrl(blockType(), blockId()), {
+ const result = copyEntityLink(shareUrl(blockType(), blockId()), {
subtext:
blockType() === 'agent' || blockType() === 'initiative'
? undefined
: SHARE_LINK_SUBTEXT,
});
analytics.track('copy_share_link', { blockType: blockType() });
+ return result;
});
const ShareLinkAction = createMemo(() => ({
action: (e: MouseEvent | KeyboardEvent) => {
e.stopPropagation();
- copyLink();
+ return copyLink();
},
icon: IconLink,
}));
@@ -1664,9 +1670,9 @@ export function ShareTrigger(props: {
: `Share ${blockType()}`)
}
>
- <Button
- variant="ghost"
- size="md"
+ <HeaderActionButton
+ label="Share"
+ icon={<IconShared />}
onClick={() => {
if (!isAuthenticated()) {
openLoginModal();
@@ -1675,20 +1681,17 @@ export function ShareTrigger(props: {
props.onClick();
}
}}
- >
- <IconShared />
- Share
- </Button>
+ />
</Tooltip>
- <Button
+ <CopyButton
variant="ghost"
tooltip="Copy Share Link"
size="icon-md"
onClick={ShareLinkAction().action}
>
<Dynamic component={ShareLinkAction().icon} class="size-3.5!" />
- </Button>
+ </CopyButton>
</div>
);
}
diff --git a/apps/web/src/lib/core/util/branchName.ts b/apps/web/src/lib/core/util/branchName.ts
index 1bf2cb9c36..eaeaca4bdf 100644
--- a/apps/web/src/lib/core/util/branchName.ts
+++ b/apps/web/src/lib/core/util/branchName.ts
@@ -3,19 +3,24 @@ import { toast } from '@core/component/Toast/Toast';
import { storageServiceClient } from '@service-storage/client';
-export const copyBranchNameToClipboard = async (documentId: string) => {
+export const copyBranchNameToClipboard = async (
+ documentId: string,
+ options: { silent?: boolean } = {}
+) => {
const result = await storageServiceClient.getDocumentBranchName({
documentId,
});
if (!result.isOk()) {
toast.failure('Failed to copy branch name');
- return;
+ return false;
}
try {
await navigator.clipboard.writeText(result.value.branchName);
analytics.track('task_copy_branch_name');
- toast.success('Branch name copied to clipboard');
+ if (!options.silent) toast.success('Branch name copied to clipboard');
+ return true;
} catch {
toast.failure('Could not copy branch name');
+ return false;
}
};
diff --git a/apps/web/src/lib/core/util/useCopyLink.test.ts b/apps/web/src/lib/core/util/useCopyLink.test.ts
new file mode 100644
index 0000000000..debdd035b0
--- /dev/null
+++ b/apps/web/src/lib/core/util/useCopyLink.test.ts
@@ -0,0 +1,63 @@
+import { toast } from '@core/component/Toast/Toast';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { useCopyLink } from './useCopyLink';
+
+vi.mock('@core/context/user', () => ({
+ useReferralCode: () => () => 'ref-code',
+}));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { success: vi.fn(), failure: vi.fn() },
+}));
+
+const writeText = vi.fn();
+const originalClipboard = Object.getOwnPropertyDescriptor(
+ navigator,
+ 'clipboard'
+);
+beforeEach(() => {
+ Object.defineProperty(navigator, 'clipboard', {
+ configurable: true,
+ value: { writeText },
+ });
+});
+afterEach(() => {
+ vi.restoreAllMocks();
+ vi.resetAllMocks();
+ if (originalClipboard)
+ Object.defineProperty(navigator, 'clipboard', originalClipboard);
+ else Reflect.deleteProperty(navigator, 'clipboard');
+});
+
+it('waits for clipboard success and preserves informational toast detail', async () => {
+ let complete!: () => void;
+ writeText.mockReturnValue(
+ new Promise<void>((resolve) => (complete = resolve))
+ );
+ const result = useCopyLink()('https://macro.com/app/task/task-1', {
+ subtext: 'Only people with access can open this link.',
+ });
+ expect(writeText).toHaveBeenCalledWith(
+ 'https://macro.com/app/task/task-1?referral_code=ref-code'
+ );
+ expect(toast.success).not.toHaveBeenCalled();
+ complete();
+ expect(await result).toBe(true);
+ expect(toast.success).toHaveBeenCalledWith('Link copied to clipboard.', {
+ subtext: 'Only people with access can open this link.',
+ });
+});
+
+it('returns false on clipboard failure without showing success', async () => {
+ writeText.mockRejectedValue(new Error('Clipboard unavailable'));
+ expect(await useCopyLink()('https://macro.com/app/task/task-1')).toBe(false);
+ expect(toast.success).not.toHaveBeenCalled();
+ expect(toast.failure).toHaveBeenCalledWith('Could not copy link');
+});
+
+it('keeps silent copies silent', async () => {
+ writeText.mockResolvedValue(undefined);
+ expect(
+ await useCopyLink()('https://macro.com/app/task/task-1', { silent: true })
+ ).toBe(true);
+ expect(toast.success).not.toHaveBeenCalled();
+});
diff --git a/apps/web/src/lib/core/util/useCopyLink.ts b/apps/web/src/lib/core/util/useCopyLink.ts
index 0a644c8833..a383b969dc 100644
--- a/apps/web/src/lib/core/util/useCopyLink.ts
+++ b/apps/web/src/lib/core/util/useCopyLink.ts
@@ -15,13 +15,19 @@ export type CopyLinkOptions = {
export function useCopyLink() {
const referralCode = useReferralCode();
- return (link: string, options: CopyLinkOptions = {}) => {
+ return async (link: string, options: CopyLinkOptions = {}) => {
const url = new URL(link);
const code = referralCode();
if (code) url.searchParams.set('referral_code', code);
- void navigator.clipboard.writeText(url.toString());
+ try {
+ await navigator.clipboard.writeText(url.toString());
+ } catch {
+ toast.failure('Could not copy link');
+ return false;
+ }
if (!options.silent) {
toast.success('Link copied to clipboard.', { subtext: options.subtext });
}
+ return true;
};
}
diff --git a/docs/AGENT_GUIDE/documents.md b/docs/AGENT_GUIDE/documents.md
index 8776fbb449..bd50ebeb0a 100644
--- a/docs/AGENT_GUIDE/documents.md
+++ b/docs/AGENT_GUIDE/documents.md
@@ -4,6 +4,29 @@ The document header has separate Share, Copy Share Link, and Side Panel buttons.
They are borderless with a soft rounded background on hover. Share opens the
sharing dialog; copying a link is a separate action.
+Snippet owners manage team sharing under **Share → Team access**. The details
+panel has no separate Sharing section. Choose **Edit** to grant the access the
+old snippet toggle provided, or **None** to remove team access.
+
+Hover or focus a document title in the header to see its owner, created time,
+and last-updated time. This details card is shared
+by documents, tasks, snippets, canvas, and file blocks; unavailable metadata is
+labeled rather than inferred.
+
+Editable documents show matching **Add tags** and **Add property** pills below
+the title. Once tags are applied, **Add tags** becomes the existing tag name or
+count pill; clicking it reopens the picker. **Add property** opens the shared
+property selector for that document.
+Adding or reselecting a property from the title row pins it there. Adding from
+the side panel leaves it unpinned. The side panel shows all assigned properties,
+including unpinned ones.
+Hover or focus an inline property pill to find **Unpin** (keeps its saved
+value) and **Delete from item** (removes the document's assignment, without
+deleting the shared property definition). Pins are saved with the document.
+
+Markdown code blocks have a **Copy Code** button in both editable and read-only
+views. Successful copies briefly animate the icon to a solid green check-circle;
+they do not show a success toast.
## Markdown outline
On desktop, Markdown documents with at least three headings show a tick rail in
@@ -689,6 +712,18 @@ highlight; deleting a placeable's discussion removes the placeable. An anchor bo
to a legacy annotation thread that was never imported stays hidden rather than
shown as a bare highlight.
+## Document history
+
+On desktop, open the title's file menu (**…**) and choose **History**. This
+opens an overlay filling the current document block, with a read-only version
+preview on the left and a timeline graph plus sessions on the right. History is
+no longer a side-panel section and its file-menu item is hidden on mobile.
+Scrub the graph to preview a point in time, or select a session to see its changes.
+**Current version** returns the preview to the live version; **Fork** copies the
+selected version into a separate document. **Close history** or Escape returns
+to the mounted editor without losing its scroll position. The two columns scroll
+independently, and other app splits remain available.
+
## Side panel
Right side of a doc (toggle with `Hide/Show Side Panel`):
@@ -711,7 +746,7 @@ Right side of a doc (toggle with `Hide/Show Side Panel`):
This must also work after background backfills populate more than 128 cached
Soup variants—tag saves must not scan all cached pages.
`Properties` → `Add property`.
-- Collapsed sections: `Stats`, `History` (version time-travel), `Activity`.
+- `Activity` is collapsible; document statistics and ownership timestamps appear in the footer.
- `Activity` lists the same glyph-rail lines as `/app/component/activity` (plain glyphs on a
thin connector, one line each with long names truncated, compact `17h` / `8d` / `1mo`
times; consecutive edits fold into one `made 3 edits` line). Past four entries it shows the
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index fd6b81726b..90904942ef 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -309,6 +309,11 @@ arrow-key browsing keeps it open. Preview headers start with **Home >**. Clickin
sidebar visibility. Use the hamburger to reopen the feed. Mobile continues to
show the activity list alone.
+Document previews opened from Home expose **Share** and **Copy Share Link** before
+the details toggle, including tasks, snippets, skills, canvases, PDFs, images,
+code, and videos. Share uses the selected item's permissions and updates when
+switching items; copied links point to the entity rather than the Home feed.
+
AI chat, agent, and channel message bodies use 15px text, including thread replies.
Desktop AI chats, agents, and channel composers share Home's rounded composer
surface: a muted dark fill or a white light-mode surface with a soft shadow,
@@ -1515,6 +1520,9 @@ the company; click the first breadcrumb to return directly to the originating
view. Shift-click still opens a contact in a separate split. Direct contact links
use the standalone contact page.
Company and contact headers have `Copy link` beside the side-panel toggle.
+Their information panel starts closed and opens as a floating bubble at every
+width, without shrinking the record content. Click outside the bubble or use
+the toggle to dismiss it; the open state is not restored on a later visit.
It copies the record's direct URL and shows a confirmation toast; this is also
available in the embedded company and contact breadcrumb header.
@@ -2042,6 +2050,36 @@ first message. If startup reports a rejected setting or timeout, the first promp
has not been sent. See [effort capabilities](../AGENT_EFFORT.md) for the harness
contracts and test coverage.
+### Floating block information panels
+
+Actions live in the top bar immediately before Share, with consistent compact
+buttons (labels collapse on narrow headers). There are no Actions sections in
+information panels. Markdown/tasks include Ask Macro and document/task dispatch; email
+includes Ask Macro and Create task; PDF and calls include Ask Macro; native
+projects expose Delete project with its existing confirmation dialog.
+
+Standard metadata is quiet, non-collapsible text at the bottom of each panel,
+separated by a muted divider. Owner and available timestamps share one format;
+Markdown adds word/character counts. There is no standard Details or Stats
+disclosure. Agent runtime information remains in its dedicated Session section.
+
+Block information panels float over the right side of the block without changing
+the content width or its centered position. A single rounded bubble fits its
+contents, with `edge-muted` dividers between sections. Its height is capped at
+the block height with internal scrolling. At every width it starts closed and
+acts as a split-local overlay menu on desktop. The top-right sidebar icon, rotated
+180 degrees, opens it, and clicking outside dismisses it. On touch devices the
+control uses the Phosphor info-circle icon and opens the standard bottom drawer
+with a drag handle, scrollable sections, and safe-area/keyboard-aware spacing.
+Dismiss the drawer by swiping down or tapping its backdrop. Opening is never
+restored from saved preferences or triggered by the global chrome shortcut. The 320px bubble enters
+with a slight slide from the right and a 120ms fade;
+closing fades it out in 70ms.
+This applies across Markdown/tasks,
+snippets, email, calls, agents, pull requests, projects, and all file blocks
+including PDFs, images, code, video, canvas, unknown file types, and CRM company
+and contact views (both inside the CRM workspace and in standalone blocks).
+
### Email reminders
The global Reminders workspace uses one continuous collection with completion
diff --git a/docs/AGENT_GUIDE/tasks.md b/docs/AGENT_GUIDE/tasks.md
index a0aaa7413d..c96ecddf34 100644
--- a/docs/AGENT_GUIDE/tasks.md
+++ b/docs/AGENT_GUIDE/tasks.md
@@ -176,10 +176,14 @@ that top bar. Opening an associated task extends the breadcrumb trail; choose
the project breadcrumb to return, or Projects to restore the collection and its
filters, groups, and scroll position. Project URLs retain identity and section:
`/app/component/initiative-view~<project-id>~overview` (or `tasks`).
-Project properties live in the shared Details/Properties side panel and honor
+Project properties live in the shared floating information panel and honor
project access. Editors can rename the project; its owner can delete it.
Deleting a project leaves its tasks in the workspace.
+Project information panels start closed and float over the content at every
+width, both in the Tasks project view and standalone initiative blocks. Opening
+the panel does not resize the content; use its toggle or click outside to close.
+
Share (or Cmd+S) opens the same Share menu as tasks and documents: the
`To: Email or group` field, optional message, access choice, and `Share`
action. Only the owner can share; other members get Copy Link. Owners can open