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.

feat(tasks): open the project from a task's project pill (#9227)

gbirman649d09b960bd
diff --git a/apps/web/src/features/block-md/component/InlinePropertyValue.project.test.tsx b/apps/web/src/features/block-md/component/InlinePropertyValue.project.test.tsx
new file mode 100644
index 0000000000..9b62a15faa
--- /dev/null
+++ b/apps/web/src/features/block-md/component/InlinePropertyValue.project.test.tsx
@@ -0,0 +1,85 @@
+import { SYSTEM_PROPERTY_IDS } from '@property/constants';
+import { PropertiesProvider } from '@property/context/PropertiesContext';
+import { useProperty } from '@property/core/context';
+import type { Property } from '@property/types';
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { Show } from 'solid-js';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { InlinePropertyValue } from './InlinePropertyValue';
+
+const { openProject } = vi.hoisted(() => ({ openProject: vi.fn() }));
+
+vi.mock('@app/features/projects/open-project', () => ({ openProject }));
+vi.mock('@components/app/split-layout/layout', () => ({
+ useSplitLayout: () => 'layout',
+}));
+vi.mock('@property/editors/popover/EntityEditor', () => ({
+ EntityEditor: () => (
+ <Show when={useProperty().editorOpen()}>
+ <div>Project picker</div>
+ </Show>
+ ),
+}));
+vi.mock('@property/hooks/usePropertyEntityDisplay', () => ({
+ usePropertyEntityDisplay: () => ({
+ name: () => 'Launch',
+ icon: () => null,
+ nativeProjectId: () => 'launch',
+ isLoading: () => false,
+ }),
+}));
+
+const project: Property = {
+ propertyId: 'assignment',
+ propertyDefinitionId: SYSTEM_PROPERTY_IDS.PROJECT,
+ displayName: 'Project',
+ valueType: 'ENTITY',
+ specificEntityType: 'INITIATIVE',
+ isMultiSelect: false,
+ value: [{ entity_id: 'launch', entity_type: 'INITIATIVE' }],
+ owner: { scope: 'system' },
+ createdAt: '2026-01-01',
+ updatedAt: '2026-01-01',
+};
+
+function renderPill(entityId?: string) {
+ render(() => (
+ <PropertiesProvider
+ entityId={entityId ?? 'draft'}
+ entityType="TASK"
+ canEdit
+ properties={() => [project]}
+ onRefresh={vi.fn()}
+ onPropertyAdded={vi.fn()}
+ onPropertyDeleted={vi.fn()}
+ saveHandler={{ saveProperty: vi.fn(), saveDate: vi.fn() }}
+ >
+ <InlinePropertyValue property={project} entityId={entityId} />
+ </PropertiesProvider>
+ ));
+}
+
+beforeEach(() => openProject.mockClear());
+afterEach(cleanup);
+
+it("opens a saved task's project from its name", () => {
+ renderPill('task');
+
+ fireEvent.click(screen.getByRole('button', { name: 'Open project Launch' }));
+
+ expect(openProject).toHaveBeenCalledWith('layout', 'launch', {
+ newSplit: false,
+ });
+});
+
+it("keeps a composer's draft in place when its project is clicked", () => {
+ renderPill();
+
+ expect(screen.queryByRole('button', { name: 'Change project' })).toBeNull();
+ expect(screen.queryByText('Project picker')).toBeNull();
+
+ fireEvent.click(screen.getByRole('button', { name: /Launch/ }));
+
+ expect(screen.getByText('Project picker')).toBeTruthy();
+ expect(openProject).not.toHaveBeenCalled();
+});
diff --git a/apps/web/src/features/block-md/component/InlinePropertyValue.tsx b/apps/web/src/features/block-md/component/InlinePropertyValue.tsx
index 29b3b40986..d65e0cd81d 100644
--- a/apps/web/src/features/block-md/component/InlinePropertyValue.tsx
+++ b/apps/web/src/features/block-md/component/InlinePropertyValue.tsx
@@ -16,7 +16,7 @@ import {
type InlinePropertyValueProps = {
property: PropertyT;
- /** Owning entity ID, when the pill is rendered outside its entity block. */
+ /** Owning entity ID; a composer has no entity yet, so it passes none. */
entityId?: string;
/** Label rendered when the property is empty. Defaults to "None". */
emptyLabel?: JSX.Element;
@@ -95,6 +95,11 @@ export const InlinePropertyValue: Component<InlinePropertyValueProps> = (
}
class={props.class}
emptyLabel={props.emptyLabel}
+ opensProject={
+ props.entityId !== undefined &&
+ ctx.entityType === 'TASK' &&
+ props.property.propertyDefinitionId === SYSTEM_PROPERTY_IDS.PROJECT
+ }
hoverTrailingAction={
<Show when={canManage()}>
<Button
diff --git a/apps/web/src/features/block-md/component/Notebook.tsx b/apps/web/src/features/block-md/component/Notebook.tsx
index 0d647ac4a9..3aa7877070 100644
--- a/apps/web/src/features/block-md/component/Notebook.tsx
+++ b/apps/web/src/features/block-md/component/Notebook.tsx
@@ -32,6 +32,7 @@ import {
untrack,
} from 'solid-js';
import { useMarkdownDocument } from '../context/markdown-document-context';
+import { createKeyboardFocusedControl } from '../util/createKeyboardFocusedControl';
import { DocumentDiscussion } from './DocumentDiscussion';
import { InlineTaskGithubPullRequests } from './InlineTaskGithubPullRequests';
import { InlineTaskProperties } from './InlineTaskProperties';
@@ -98,6 +99,7 @@ export function Notebook(props: {
const { md, setMd } = state.editor;
const { displayName: documentName } = useMarkdownName();
const scopeId = () => props.hotkeyScope;
+ const ownsEnter = createKeyboardFocusedControl();
const resolveAppLink = useMacroMentionLinkResolver();
let notebookRef!: HTMLDivElement;
@@ -205,7 +207,8 @@ export function Notebook(props: {
scopeId: currentScopeId,
hotkeyToken: TOKENS.block.focus,
description: 'Focus Title or Markdown Editor',
- keyDownHandler: () => {
+ keyDownHandler: (event) => {
+ if (ownsEnter(event?.target)) return false;
const titleEditor = md.titleEditor;
const markdownEditor = md.editor;
const docName = untrack(documentName);
diff --git a/apps/web/src/features/block-md/util/createKeyboardFocusedControl.test.ts b/apps/web/src/features/block-md/util/createKeyboardFocusedControl.test.ts
new file mode 100644
index 0000000000..81d6d12a7c
--- /dev/null
+++ b/apps/web/src/features/block-md/util/createKeyboardFocusedControl.test.ts
@@ -0,0 +1,83 @@
+import { createRoot } from 'solid-js';
+import { afterEach, expect, it, vi } from 'vitest';
+import { createKeyboardFocusedControl } from './createKeyboardFocusedControl';
+
+let dispose = () => {};
+
+function track() {
+ return createRoot((disposer) => {
+ dispose = disposer;
+ return createKeyboardFocusedControl();
+ });
+}
+
+function add(html: string) {
+ document.body.insertAdjacentHTML('beforeend', html);
+ return document.body.lastElementChild as HTMLElement;
+}
+
+afterEach(() => {
+ dispose();
+ document.body.replaceChildren();
+});
+
+it('leaves Enter to a control keyboard focus landed on', () => {
+ const ownsEnter = track();
+
+ for (const html of [
+ '<button>Open</button>',
+ '<a href="/x">Open</a>',
+ '<div role="button" tabindex="0"></div>',
+ ]) {
+ const control = add(html);
+ control.focus();
+ expect(ownsEnter(control)).toBe(true);
+ }
+});
+
+it('keeps Enter for the document everywhere else', () => {
+ const ownsEnter = track();
+ const button = add('<button>Open</button>');
+ const pane = add('<div tabindex="0"></div>');
+
+ pane.focus();
+
+ expect(ownsEnter(pane)).toBe(false);
+ expect(ownsEnter(button)).toBe(false);
+ expect(ownsEnter(undefined)).toBe(false);
+});
+
+it('keeps Enter for the document after a click on a control', () => {
+ const ownsEnter = track();
+ const button = add('<button>Copy</button>');
+ const matches = vi.spyOn(button, 'matches').mockReturnValue(false);
+
+ button.focus();
+ matches.mockRestore();
+
+ expect(button.matches(':focus-visible')).toBe(true);
+ expect(ownsEnter(button)).toBe(false);
+});
+
+it('hands Enter back after a click on the control keyboard focus is on', () => {
+ const ownsEnter = track();
+ const button = add('<button>Copy</button>');
+
+ button.focus();
+ expect(ownsEnter(button)).toBe(true);
+
+ button.dispatchEvent(new Event('pointerdown', { bubbles: true }));
+
+ expect(ownsEnter(button)).toBe(false);
+});
+
+it('forgets a control once focus moves on', () => {
+ const ownsEnter = track();
+ const button = add('<button>Open</button>');
+ const pane = add('<div tabindex="0"></div>');
+
+ button.focus();
+ pane.focus();
+
+ expect(ownsEnter(button)).toBe(false);
+});
diff --git a/apps/web/src/features/block-md/util/createKeyboardFocusedControl.ts b/apps/web/src/features/block-md/util/createKeyboardFocusedControl.ts
new file mode 100644
index 0000000000..4ec6f596c0
--- /dev/null
+++ b/apps/web/src/features/block-md/util/createKeyboardFocusedControl.ts
@@ -0,0 +1,30 @@
+import { onCleanup } from 'solid-js';
+
+/**
+ * Tracks the control keyboard focus landed on, which owns Enter. Read when
+ * focus arrives, because Chrome makes a focused element `:focus-visible` on any
+ * key press: Enter after a mouse click still moves on to the editor.
+ */
+export function createKeyboardFocusedControl() {
+ let control: Element | undefined;
+ const track = ({ target }: FocusEvent) => {
+ control =
+ target instanceof Element &&
+ target.matches(':focus-visible') &&
+ target.matches('button, a[href], [role="button"]')
+ ? target
+ : undefined;
+ };
+ // Clicking the focused control fires no focusin, so a press has to clear it.
+ const clear = () => {
+ control = undefined;
+ };
+ document.addEventListener('focusin', track);
+ document.addEventListener('pointerdown', clear, true);
+ onCleanup(() => {
+ document.removeEventListener('focusin', track);
+ document.removeEventListener('pointerdown', clear, true);
+ });
+ return (target: EventTarget | null | undefined) =>
+ control !== undefined && target === control;
+}
diff --git a/apps/web/src/features/property/component/ProjectLinkPill.test.tsx b/apps/web/src/features/property/component/ProjectLinkPill.test.tsx
new file mode 100644
index 0000000000..adf9e52348
--- /dev/null
+++ b/apps/web/src/features/property/component/ProjectLinkPill.test.tsx
@@ -0,0 +1,173 @@
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { useProperty } from '../core/context';
+import { Root } from '../core/Root';
+import type { EntityProperty } from '../types';
+import { ProjectLinkPill } from './ProjectLinkPill';
+
+const mocks = vi.hoisted(() => ({
+ openProject: vi.fn(),
+ nativeProjectId: (): string | undefined => undefined,
+ isLoading: (): boolean => false,
+}));
+
+vi.mock('@app/features/projects/open-project', () => ({
+ openProject: mocks.openProject,
+}));
+vi.mock('@components/app/split-layout/layout', () => ({
+ useSplitLayout: () => 'layout',
+}));
+vi.mock('../hooks', () => ({
+ usePropertyEntityDisplay: () => ({
+ name: () => 'Launch',
+ nativeProjectId: () => mocks.nativeProjectId(),
+ isLoading: () => mocks.isLoading(),
+ }),
+}));
+
+const project: EntityProperty = {
+ propertyId: 'assignment',
+ propertyDefinitionId: 'project',
+ displayName: 'Project',
+ valueType: 'ENTITY',
+ specificEntityType: 'INITIATIVE',
+ isMultiSelect: false,
+ value: [{ entity_id: 'launch', entity_type: 'INITIATIVE' }],
+ owner: { scope: 'system' },
+ createdAt: '2026-01-01',
+ updatedAt: '2026-01-01',
+};
+
+function EditorState() {
+ const ctx = useProperty();
+ return <output>{ctx.editorOpen() ? 'Editing' : 'Not editing'}</output>;
+}
+
+function renderPill(options: { canEdit?: boolean; property?: EntityProperty }) {
+ const property = options.property ?? project;
+ render(() => (
+ <Root property={property} canEdit={options.canEdit ?? true}>
+ <ProjectLinkPill property={property} fallback={<span>Plain pill</span>} />
+ <EditorState />
+ </Root>
+ ));
+}
+
+beforeEach(() => {
+ mocks.openProject.mockClear();
+ mocks.nativeProjectId = () => 'launch';
+ mocks.isLoading = () => false;
+});
+afterEach(cleanup);
+
+it('opens the project from its name, in a new split on shift', () => {
+ renderPill({});
+ const name = screen.getByRole('button', { name: 'Open project Launch' });
+
+ fireEvent.click(name);
+ expect(mocks.openProject).toHaveBeenLastCalledWith('layout', 'launch', {
+ newSplit: false,
+ });
+
+ fireEvent.click(name, { shiftKey: true });
+ expect(mocks.openProject).toHaveBeenLastCalledWith('layout', 'launch', {
+ newSplit: true,
+ });
+ expect(screen.getByText('Not editing')).toBeTruthy();
+});
+
+it('changes the project from the caret without opening it', () => {
+ renderPill({});
+ const caret = screen.getByRole('button', { name: 'Change project' });
+ expect(caret.getAttribute('aria-expanded')).toBe('false');
+
+ fireEvent.click(caret);
+
+ expect(screen.getByText('Editing')).toBeTruthy();
+ expect(caret.getAttribute('aria-expanded')).toBe('true');
+ expect(mocks.openProject).not.toHaveBeenCalled();
+});
+
+it('still opens the project for someone who cannot change it', () => {
+ renderPill({ canEdit: false });
+
+ expect(screen.queryByRole('button', { name: 'Change project' })).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'Open project Launch' }));
+ expect(mocks.openProject).toHaveBeenCalledOnce();
+});
+
+it('stays a plain pill when there is no project to open', () => {
+ mocks.nativeProjectId = () => undefined;
+ renderPill({ property: { ...project, value: [] } });
+ expect(screen.getByText('Plain pill')).toBeTruthy();
+ cleanup();
+
+ renderPill({});
+ expect(screen.getByText('Plain pill')).toBeTruthy();
+ expect(screen.queryByRole('button')).toBeNull();
+});
+
+it('returns focus to the caret when the first project replaces the pill', async () => {
+ const [property, setProperty] = createSignal<EntityProperty>({
+ ...project,
+ value: [],
+ });
+ const EmptyPill = () => {
+ const ctx = useProperty();
+ return (
+ <button
+ type="button"
+ onClick={(event) => ctx.openEditor(event.currentTarget)}
+ >
+ Set project
+ </button>
+ );
+ };
+ const ClosePicker = () => {
+ const ctx = useProperty();
+ return (
+ <button type="button" onClick={() => ctx.closeEditor()}>
+ Close picker
+ </button>
+ );
+ };
+ render(() => (
+ <Root property={property()} canEdit>
+ <ProjectLinkPill property={property()} fallback={<EmptyPill />} />
+ <ClosePicker />
+ </Root>
+ ));
+
+ fireEvent.click(screen.getByRole('button', { name: 'Set project' }));
+ setProperty(project);
+ fireEvent.click(screen.getByText('Close picker'));
+
+ await waitFor(() =>
+ expect(document.activeElement?.getAttribute('aria-label')).toBe(
+ 'Change project'
+ )
+ );
+});
+
+it('keeps the caret mounted while a picked project loads', () => {
+ const [loading, setLoading] = createSignal(true);
+ mocks.isLoading = loading;
+ mocks.nativeProjectId = () => (loading() ? undefined : 'launch');
+ renderPill({});
+ const caret = screen.getByRole('button', { name: 'Change project' });
+
+ fireEvent.click(screen.getByRole('button', { name: 'Open project Launch' }));
+ expect(mocks.openProject).not.toHaveBeenCalled();
+
+ setLoading(false);
+ expect(screen.getByRole('button', { name: 'Change project' })).toBe(caret);
+ fireEvent.click(screen.getByRole('button', { name: 'Open project Launch' }));
+ expect(mocks.openProject).toHaveBeenCalledOnce();
+});
diff --git a/apps/web/src/features/property/component/ProjectLinkPill.tsx b/apps/web/src/features/property/component/ProjectLinkPill.tsx
new file mode 100644
index 0000000000..10c551afe1
--- /dev/null
+++ b/apps/web/src/features/property/component/ProjectLinkPill.tsx
@@ -0,0 +1,79 @@
+import { openProject } from '@app/features/projects/open-project';
+import { t } from '@app/lib/i18n';
+import { useSplitLayout } from '@components/app/split-layout/layout';
+import ArrowUpRightIcon from '@icon/system/regular/arrow-up-right.svg';
+import CaretDownIcon from '@icon/system/regular/caret-down.svg';
+import ProjectIcon from '@icon/system/regular/stack.svg';
+import { ButtonGroup, cn } from '@ui';
+import { type JSX, Show } from 'solid-js';
+import { useProperty } from '../core/context';
+import { usePropertyEntityDisplay } from '../hooks';
+import type { Property as PropertyValue } from '../types';
+import { getEntityValues } from '../utils';
+
+/**
+ * A task's project as a split pill: the name opens the project and the caret
+ * changes it. An empty or unavailable project stays the plain `fallback` pill.
+ * A project still loading keeps the split, so a pick doesn't remount the caret
+ * that takes focus back when the picker closes. The name counts as a row action
+ * so that focus returns to the caret when the first project replaces the pill.
+ */
+export function ProjectLinkPill(props: {
+ property: PropertyValue;
+ fallback: JSX.Element;
+ class?: string;
+ variant?: 'secondary' | 'ghost';
+}) {
+ const ctx = useProperty();
+ const layout = useSplitLayout();
+ const variant = () => props.variant ?? 'secondary';
+ const reference = () => getEntityValues(props.property)[0];
+ const { name, nativeProjectId, isLoading } = usePropertyEntityDisplay(
+ () => reference()?.entity_id ?? '',
+ () => 'INITIATIVE'
+ );
+ const open = (event: MouseEvent) => {
+ event.stopPropagation();
+ const id = nativeProjectId();
+ if (id) openProject(layout, id, { newSplit: event.shiftKey });
+ };
+
+ return (
+ <Show
+ when={reference() && (isLoading() || nativeProjectId())}
+ fallback={props.fallback}
+ >
+ <ButtonGroup
+ finish={variant() === 'secondary' ? 'raised' : undefined}
+ variant={variant()}
+ size="xs"
+ class={cn('min-w-0 max-w-full border-0', props.class)}
+ >
+ <ButtonGroup.Button
+ data-property-row-action
+ aria-label={t('entityActions.openProjectNamed', { name: name() })}
+ class="group/project-link min-w-0 shrink justify-start"
+ onClick={open}
+ >
+ <ProjectIcon class="size-3 shrink-0 not-touch:group-hover/project-link:hidden not-touch:group-focus-visible/project-link:hidden" />
+ <ArrowUpRightIcon class="hidden size-3 shrink-0 not-touch:group-hover/project-link:block not-touch:group-focus-visible/project-link:block" />
+ <span class="min-w-0 max-w-60 truncate">{name()}</span>
+ </ButtonGroup.Button>
+ <Show when={ctx.canEdit()}>
+ <ButtonGroup.Divider />
+ <ButtonGroup.Button
+ size="icon-xs"
+ aria-label={t('entityActions.changeProject')}
+ aria-expanded={ctx.editorOpen()}
+ onClick={(event) => {
+ event.stopPropagation();
+ ctx.openEditor(event.currentTarget);
+ }}
+ >
+ <CaretDownIcon class="size-3 shrink-0" />
+ </ButtonGroup.Button>
+ </Show>
+ </ButtonGroup>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/property/component/PropertyValuePill.tsx b/apps/web/src/features/property/component/PropertyValuePill.tsx
index 44796d15e8..b7487f4595 100644
--- a/apps/web/src/features/property/component/PropertyValuePill.tsx
+++ b/apps/web/src/features/property/component/PropertyValuePill.tsx
@@ -2,6 +2,7 @@ import { type ComponentProps, type JSX, Match, Show, Switch } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { Property } from '../property';
import { getEntityValues, hasValue } from '../utils';
+import { ProjectLinkPill } from './ProjectLinkPill';
type PropertyValuePillProps = Pick<
ComponentProps<typeof Property.Root>,
@@ -17,6 +18,8 @@ type PropertyValuePillProps = Pick<
entitySelfFilter?: ComponentProps<
typeof Property.PopoverEditor
>['entitySelfFilter'];
+ /** The pill's name opens the task's project, leaving the caret to change it. */
+ opensProject?: boolean;
/** The editor the pill opens; `Property.SheetEditor` inside a touch sheet. */
editor?: typeof Property.PopoverEditor;
};
@@ -37,6 +40,51 @@ export function PropertyValuePill(props: PropertyValuePillProps) {
const isMultiUserEntity = () =>
isUserEntity() && getEntityValues(property()).length > 1;
+ const pill = () => (
+ <Property.Pill
+ class={props.class}
+ variant={props.variant ?? 'outline'}
+ size={props.size}
+ >
+ <Show when={props.showLabel && hasValue(property())}>
+ <span class="shrink-0 text-ink-muted">
+ {property().displayName}:
+ </span>
+ </Show>
+ <span class="inline-flex min-w-0 items-center gap-1">
+ <Switch
+ fallback={
+ <Property.Icon
+ property={property()}
+ class="size-3 shrink-0"
+ />
+ }
+ >
+ <Match when={isMultiUserEntity()}>
+ <Property.UserStack property={property()} maxUsers={2} />
+ </Match>
+ <Match when={isUserEntity()}>
+ <Property.Icon property={property()} />
+ </Match>
+ </Switch>
+ <Property.Text
+ property={property()}
+ resolveSingleEntity={
+ props.showLabel ||
+ property().specificEntityType === 'INITIATIVE'
+ }
+ class="min-w-0 max-w-60"
+ fallback={
+ <Property.Empty
+ label={props.emptyLabel ?? property().displayName}
+ />
+ }
+ />
+ </span>
+ <Property.Caret />
+ </Property.Pill>
+ );
+
return (
<>
<Property.Tooltip
@@ -44,48 +92,13 @@ export function PropertyValuePill(props: PropertyValuePillProps) {
actions={props.hoverActions}
trailingAction={props.hoverTrailingAction}
>
- <Property.Pill
- class={props.class}
- variant={props.variant ?? 'outline'}
- size={props.size}
- >
- <Show when={props.showLabel && hasValue(property())}>
- <span class="shrink-0 text-ink-muted">
- {property().displayName}:
- </span>
- </Show>
- <span class="inline-flex min-w-0 items-center gap-1">
- <Switch
- fallback={
- <Property.Icon
- property={property()}
- class="size-3 shrink-0"
- />
- }
- >
- <Match when={isMultiUserEntity()}>
- <Property.UserStack property={property()} maxUsers={2} />
- </Match>
- <Match when={isUserEntity()}>
- <Property.Icon property={property()} />
- </Match>
- </Switch>
- <Property.Text
- property={property()}
- resolveSingleEntity={
- props.showLabel ||
- property().specificEntityType === 'INITIATIVE'
- }
- class="min-w-0 max-w-60"
- fallback={
- <Property.Empty
- label={props.emptyLabel ?? property().displayName}
- />
- }
- />
- </span>
- <Property.Caret />
- </Property.Pill>
+ <Show when={props.opensProject} fallback={pill()}>
+ <ProjectLinkPill
+ property={property()}
+ class={props.class}
+ fallback={pill()}
+ />
+ </Show>
</Property.Tooltip>
<Dynamic
component={props.editor ?? Property.PopoverEditor}
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 618a8d91f5..cf825df2f6 100644
--- a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx
+++ b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx
@@ -8,6 +8,7 @@ import Plus from '@icon/system/regular/plus.svg';
import { Property as PropertyNS, useProperty } from '@property';
import { AddPropertyButton } from '@property/component/AddPropertyButton';
import { Modals } from '@property/component/modal';
+import { ProjectLinkPill } from '@property/component/ProjectLinkPill';
import { PropertyValueIcon } from '@property/component/propertyValue/PropertyValueIcon';
import {
PropertiesProvider,
@@ -17,6 +18,7 @@ import {
import { resolvePinnedPropertyIds } from '@property/core/pinned-property-ids';
import { useAllProperties } from '@property/editor/hooks/useAllProperties';
import { useEntityProperties, usePropertyEntityDisplay } from '@property/hooks';
+import { SYSTEM_PROPERTY_IDS } from '@property/identifiers';
import { isTaggableEntityType, TagsRow } from '@property/tags';
import type {
Property,
@@ -613,6 +615,11 @@ function SidePanelPropertyRow(props: {
fallback={
<SinglePill
getEmptyLabel={props.getEmptyLabel}
+ opensProject={
+ ctx.entityType === 'TASK' &&
+ props.property.propertyDefinitionId ===
+ SYSTEM_PROPERTY_IDS.PROJECT
+ }
property={property()}
/>
}
@@ -664,6 +671,7 @@ function SidePanelPropertyRow(props: {
function SinglePill(props: {
getEmptyLabel?: (property: Property) => JSX.Element | undefined;
+ opensProject?: boolean;
property: Property;
}) {
const empty = () => !hasValue(props.property);
@@ -682,37 +690,43 @@ function SinglePill(props: {
}
);
- return (
- <PropertyNS.Tooltip property={props.property}>
- <PropertyNS.Pill class="w-fit overflow-hidden">
+ const pill = () => (
+ <PropertyNS.Pill class="w-fit overflow-hidden">
+ <Show
+ when={!empty()}
+ fallback={
+ <SidePanel.EmptyPill label={props.getEmptyLabel?.(props.property)} />
+ }
+ >
<Show
- when={!empty()}
+ when={isNonUserEntity() && entity()}
fallback={
- <SidePanel.EmptyPill
- label={props.getEmptyLabel?.(props.property)}
- />
+ <>
+ <PropertyNS.Icon
+ property={props.property}
+ class="size-3 shrink-0"
+ />
+ <PropertyNS.Text property={props.property} class="min-w-0" />
+ </>
}
>
- <Show
- when={isNonUserEntity() && entity()}
- fallback={
- <>
- <PropertyNS.Icon
- property={props.property}
- class="size-3 shrink-0"
- />
- <PropertyNS.Text property={props.property} class="min-w-0" />
- </>
- }
- >
- <span class="shrink-0 flex items-center">
- {entityDisplay.icon()}
- </span>
- <span class="min-w-0 truncate">{entityDisplay.name()}</span>
- </Show>
+ <span class="shrink-0 flex items-center">{entityDisplay.icon()}</span>
+ <span class="min-w-0 truncate">{entityDisplay.name()}</span>
</Show>
- <PropertyNS.Caret />
- </PropertyNS.Pill>
+ </Show>
+ <PropertyNS.Caret />
+ </PropertyNS.Pill>
+ );
+
+ return (
+ <PropertyNS.Tooltip property={props.property}>
+ <Show when={props.opensProject} fallback={pill()}>
+ <ProjectLinkPill
+ property={props.property}
+ variant="ghost"
+ fallback={pill()}
+ />
+ </Show>
</PropertyNS.Tooltip>
);
}
diff --git a/apps/web/src/lib/i18n/locales/en/entity-actions.ts b/apps/web/src/lib/i18n/locales/en/entity-actions.ts
index 5ded64857e..d7cec0474c 100644
--- a/apps/web/src/lib/i18n/locales/en/entity-actions.ts
+++ b/apps/web/src/lib/i18n/locales/en/entity-actions.ts
@@ -27,6 +27,8 @@ export default {
remindMe: 'Remind me',
addTag: 'Add tag',
addToProject: 'Add to project…',
+ openProjectNamed: 'Open project {{name}}',
+ changeProject: 'Change project',
moveToFolder: 'Move to folder',
removeFromFolder: 'Remove from folder',
duplicate: 'Duplicate',
diff --git a/docs/agent-guide/tasks.md b/docs/agent-guide/tasks.md
index 225f81bd69..91a3d2f998 100644
--- a/docs/agent-guide/tasks.md
+++ b/docs/agent-guide/tasks.md
@@ -92,7 +92,14 @@ and `Project` when empty. Multiple linked projects show an item count.
Long assignee and project names truncate within their columns; hover the cell
to read the full value.
The project pill beneath a task title shows the project icon and name without
-a `Project:` prefix.
+a `Project:` prefix. It and the Project row in the Properties side panel split in
+two once a project is set: the name opens the project (shift-click for a new
+split, and an already open project is focused instead of opened again), and the
+caret changes the project. Hovering the name turns its icon into an arrow. People
+who can't edit the task get the name alone, so they can still open the project.
+An empty or unavailable project keeps the plain pill, and composers never split it.
+Enter activates a pill or any other document control reached by keyboard. After a
+mouse click, Enter still moves to the editor.
Click a task row or favorite to replace the list with the editable task document. Its top
bar shows the originating task tab as a text-only return breadcrumb,