Skip to content

armgit / macro

Public Imported from GitHub
0

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

fix(tasks): improve project assignment from task and project views (#7384)

gbirmanf8bc860b0323
diff --git a/apps/web/src/components/app/split-layout/components/SplitFileMenu.tsx b/apps/web/src/components/app/split-layout/components/SplitFileMenu.tsx
index f097977b7d..2b26625c55 100644
--- a/apps/web/src/components/app/split-layout/components/SplitFileMenu.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitFileMenu.tsx
@@ -9,6 +9,7 @@ import {
makeMuteAction,
markReminderTargetDone,
} from '@app/features/next-soup/actions';
+import { ProjectAssignmentDialog } from '@app/features/projects/projects';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
@@ -22,7 +23,7 @@ import { useItemOperations } from '@core/component/FileList/useItemOperations';
import { Permissions } from '@core/component/SharePermissions';
import { toast } from '@core/component/Toast/Toast';
import { resolveBlockAlias } from '@core/constant/allBlocks';
-import { enableReminders } from '@core/constant/featureFlags';
+import { enableProjects, enableReminders } from '@core/constant/featureFlags';
import { useQuickAccess } from '@core/context/quickAccess';
import { useUserId } from '@core/context/user';
import { triggerFocusInput } from '@core/directive/focusInput';
@@ -41,6 +42,7 @@ import Copy from '@phosphor/copy.svg';
import DotsThree from '@phosphor/dots-three.svg';
import Link from '@phosphor/link.svg';
import Rename from '@phosphor/pencil-line.svg';
+import Stack from '@phosphor/stack.svg';
import Star from '@phosphor/star.svg';
import Tag from '@phosphor/tag.svg';
import Trash from '@phosphor/trash-simple.svg';
@@ -352,6 +354,8 @@ export function SplitFileMenu(props: SplitFileMenuProps) {
const blockName = resolveBlockAlias(props.entityKind);
const [open, setOpen] = createSignal(false);
+ const [assigningProject, setAssigningProject] = createSignal(false);
+ const projectsFlag = useFeatureFlag(enableProjects);
const itemOperations = useItemOperations();
const quickAccess = useQuickAccess();
const favoriteAction = makeFavoriteAction();
@@ -644,6 +648,22 @@ export function SplitFileMenu(props: SplitFileMenuProps) {
muteOp(),
reminderOp(),
addTagOp(),
+ ...(props.entityKind === 'task' &&
+ projectsFlag().enabled &&
+ (props.permissions === Permissions.OWNER ||
+ props.permissions === Permissions.CAN_EDIT)
+ ? [
+ {
+ label: 'Add to project…',
+ icon: Stack,
+ group: 'file' as const,
+ action: () => {
+ setOpen(false);
+ setAssigningProject(true);
+ },
+ },
+ ]
+ : []),
copyLinkOp(),
copyEntityIdOp(),
...mapped,
@@ -699,25 +719,33 @@ export function SplitFileMenu(props: SplitFileMenuProps) {
onCleanup(() => ctx.setTitleFileMenuActions(undefined));
return (
- <Show
- when={isTouchDevice()}
- fallback={
- <DesktopRender
+ <>
+ <Show
+ when={isTouchDevice()}
+ fallback={
+ <DesktopRender
+ open={open()}
+ onOpenChange={setOpen}
+ triggerClass={props.buttonClass}
+ groups={actionGroups()}
+ />
+ }
+ >
+ <MobileRender
open={open()}
onOpenChange={setOpen}
triggerClass={props.buttonClass}
groups={actionGroups()}
+ views={props.mobileViews}
/>
- }
- >
- <MobileRender
- open={open()}
- onOpenChange={setOpen}
- triggerClass={props.buttonClass}
- groups={actionGroups()}
- views={props.mobileViews}
- />
- </Show>
+ </Show>
+ <Show when={projectsFlag().enabled && assigningProject()}>
+ <ProjectAssignmentDialog
+ taskIds={[props.id]}
+ onClose={() => setAssigningProject(false)}
+ />
+ </Show>
+ </>
);
}
diff --git a/apps/web/src/features/block-md/component/InlineTaskProperties.tsx b/apps/web/src/features/block-md/component/InlineTaskProperties.tsx
index cf3c9c78c2..a2f03526f4 100644
--- a/apps/web/src/features/block-md/component/InlineTaskProperties.tsx
+++ b/apps/web/src/features/block-md/component/InlineTaskProperties.tsx
@@ -90,6 +90,9 @@ export function InlineTaskProperties() {
entityType={entityType}
class="bg-surface-2"
/>
+ <Show when={documentKind === 'task'}>
+ <TaskProjectProperty taskId={blockId} canEdit={canEdit()} />
+ </Show>
<Show when={documentKind === 'task' && state.editor.md.progressStats}>
{(progressStats) => (
<Show when={progressStats().total > 0}>
@@ -103,3 +106,5 @@ export function InlineTaskProperties() {
</Suspense>
);
}
+
+import { TaskProjectProperty } from '@app/features/projects/task-project-property';
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 0e8fa604f1..95212893cb 100644
--- a/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
+++ b/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx
@@ -1,9 +1,11 @@
import { EntityActivitySectionConditional } from '@app/features/activity/views/entity-activity-section';
import { AskMacroButton } from '@app/features/chat/ChatWithAgentButton';
+import { TaskProjectProperty } from '@app/features/projects/task-project-property';
import {
EntityPropertiesSection,
EntityTagsSection,
} from '@app/features/property/side-panel/properties';
+import { ShowFeatureFlag } from '@app/lib/analytics/posthog';
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import {
GithubPullRequestDetailsRows,
@@ -25,6 +27,7 @@ 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';
@@ -130,6 +133,18 @@ export function MarkdownSidePanelSections() {
defaultOpen
order={25}
>
+ <Show when={isTask()}>
+ <ShowFeatureFlag flag={enableProjects}>
+ <SidePanel.Grid>
+ <SidePanel.Row label="Project">
+ <TaskProjectProperty
+ taskId={documentId()}
+ canEdit={canEdit()}
+ />
+ </SidePanel.Row>
+ </SidePanel.Grid>
+ </ShowFeatureFlag>
+ </Show>
<PropertiesSectionContent
documentId={documentId()}
isTask={isTask()}
diff --git a/apps/web/src/features/projects/queries/create-project-task.ts b/apps/web/src/features/projects/queries/create-project-task.ts
index 73d631fbf2..61da1619c6 100644
--- a/apps/web/src/features/projects/queries/create-project-task.ts
+++ b/apps/web/src/features/projects/queries/create-project-task.ts
@@ -87,7 +87,7 @@ export function createProjectTaskMutation(
}
if (!assigned)
toast.failure(
- 'Task created, but could not be added to the project. Use Set project from the task menu to try again.'
+ 'Task created, but could not be added to the project. Use Add to project from the task menu to try again.'
);
return { result, assigned };
},
diff --git a/apps/web/src/features/projects/task-project-property.tsx b/apps/web/src/features/projects/task-project-property.tsx
new file mode 100644
index 0000000000..13652e8cc6
--- /dev/null
+++ b/apps/web/src/features/projects/task-project-property.tsx
@@ -0,0 +1,13 @@
+import { Projects } from './projects';
+import { TaskProjectProperty as TaskProjectPropertyContent } from './views/task-project-property';
+
+export function TaskProjectProperty(props: {
+ taskId: string;
+ canEdit: boolean;
+}) {
+ return (
+ <Projects>
+ <TaskProjectPropertyContent {...props} />
+ </Projects>
+ );
+}
diff --git a/apps/web/src/features/projects/views/add-project-tasks.test.tsx b/apps/web/src/features/projects/views/add-project-tasks.test.tsx
new file mode 100644
index 0000000000..bdf9beb36d
--- /dev/null
+++ b/apps/web/src/features/projects/views/add-project-tasks.test.tsx
@@ -0,0 +1,118 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import type { Accessor, ParentProps } from 'solid-js';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import type { ProjectDetail } from '../core/project';
+import { AddProjectTasks } from './add-project-tasks';
+
+const mock = vi.hoisted(() => ({ assignTasks: vi.fn() }));
+vi.mock('@ui', async () => ({
+ ...(await import('@app/components/ui/components/Button')),
+ ...(await import('@app/components/ui/components/Dialog')),
+ ...(await import('@app/components/ui/components/Surface')),
+ ...(await import('@app/components/ui/utils/classname')),
+ Hotkey: () => null,
+}));
+vi.mock('@app/components/ui/components/Tooltip', () => ({
+ Tooltip: (props: ParentProps) => props.children,
+}));
+vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => false }));
+vi.mock('../context/projects-context', () => ({
+ useProjectsContext: () => ({
+ createCommands: () => ({ assignTasks: mock.assignTasks }),
+ }),
+}));
+vi.mock('@property/editors/selectors/PropertyEntitySelector', () => ({
+ PropertyEntitySelector: (props: {
+ config: { excludedIds: Accessor<ReadonlySet<string>> };
+ selectedOptions: Accessor<Set<string>>;
+ setSelectedOptions(ids: Set<string>): void;
+ }) => (
+ <>
+ <input aria-label="Search tasks" />
+ <button onClick={() => props.setSelectedOptions(new Set(['one', 'two']))}>
+ Select tasks
+ </button>
+ <output data-testid="selection">
+ {[...props.selectedOptions()].join(',')}
+ </output>
+ <output data-testid="excluded">
+ {[...props.config.excludedIds()].join(',')}
+ </output>
+ </>
+ ),
+}));
+beforeEach(() => vi.stubGlobal('scrollTo', vi.fn()));
+afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+ vi.unstubAllGlobals();
+});
+const project: ProjectDetail = {
+ id: 'project',
+ name: 'Launch',
+ taskIds: ['linked'],
+ descriptionDocumentId: 'description',
+ ownerId: 'owner',
+ memberIds: [],
+ access: 'owner',
+ createdAt: new Date(0).toISOString(),
+ updatedAt: new Date(0).toISOString(),
+};
+
+it('adds selected tasks and closes only after the request settles', async () => {
+ const result = Promise.withResolvers<{ taskId: string }[]>();
+ mock.assignTasks.mockReturnValue(result.promise);
+ const close = vi.fn();
+ render(() => <AddProjectTasks project={project} onClose={close} />);
+ expect(screen.getByTestId('excluded').textContent).toBe('linked');
+ expect(
+ screen.getByText(/Tasks already in another project will move here/)
+ ).toBeTruthy();
+ fireEvent.click(screen.getByText('Select tasks'));
+ fireEvent.click(screen.getByRole('button', { name: 'Add 2 tasks' }));
+ expect(mock.assignTasks).toHaveBeenCalledWith('project', ['one', 'two']);
+ expect(screen.getByRole('button', { name: 'Cancel' })).toHaveProperty(
+ 'disabled',
+ true
+ );
+ expect(close).not.toHaveBeenCalled();
+ result.resolve([{ taskId: 'one' }, { taskId: 'two' }]);
+ await vi.waitFor(() => expect(close).toHaveBeenCalledOnce());
+});
+
+it('keeps only failed tasks selected for retry', async () => {
+ mock.assignTasks
+ .mockResolvedValueOnce([
+ { taskId: 'one' },
+ { taskId: 'two', error: 'You need edit access to this task.' },
+ ])
+ .mockResolvedValueOnce([{ taskId: 'two' }]);
+ const close = vi.fn();
+ render(() => <AddProjectTasks project={project} onClose={close} />);
+ fireEvent.click(screen.getByText('Select tasks'));
+ fireEvent.click(screen.getByRole('button', { name: 'Add 2 tasks' }));
+ expect(await screen.findByRole('alert')).toHaveProperty(
+ 'textContent',
+ '1 task could not be added. You need edit access to this task.'
+ );
+ expect(screen.getByTestId('selection').textContent).toBe('two');
+ expect(close).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByRole('button', { name: 'Add 1 task' }));
+ await vi.waitFor(() => expect(close).toHaveBeenCalledOnce());
+ expect(mock.assignTasks).toHaveBeenLastCalledWith('project', ['two']);
+});
+
+it('preserves the selection after a request failure and allows canceling', async () => {
+ mock.assignTasks.mockRejectedValue(new Error('Offline'));
+ const close = vi.fn();
+ render(() => <AddProjectTasks project={project} onClose={close} />);
+ fireEvent.click(screen.getByText('Select tasks'));
+ fireEvent.click(screen.getByRole('button', { name: 'Add 2 tasks' }));
+ expect(await screen.findByRole('alert')).toHaveProperty(
+ 'textContent',
+ 'Offline'
+ );
+ expect(screen.getByTestId('selection').textContent).toBe('one,two');
+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));
+ expect(close).toHaveBeenCalledOnce();
+});
diff --git a/apps/web/src/features/projects/views/add-project-tasks.tsx b/apps/web/src/features/projects/views/add-project-tasks.tsx
new file mode 100644
index 0000000000..26c2c71e08
--- /dev/null
+++ b/apps/web/src/features/projects/views/add-project-tasks.tsx
@@ -0,0 +1,109 @@
+import { PropertyEntitySelector } from '@property/editors/selectors/PropertyEntitySelector';
+import { Button, Dialog } from '@ui';
+import { createMemo, createSignal, Show, Suspense } from 'solid-js';
+import { useProjectsContext } from '../context/projects-context';
+import type { ProjectDetail } from '../core/project';
+
+export function AddProjectTasks(props: {
+ project: ProjectDetail;
+ onClose(): void;
+}) {
+ const commands = useProjectsContext().createCommands();
+ const [selected, setSelected] = createSignal(new Set<string>());
+ const [error, setError] = createSignal<string>();
+ const [saving, setSaving] = createSignal(false);
+ const excludedIds = createMemo(() => new Set(props.project.taskIds));
+ const close = () => {
+ if (!saving()) props.onClose();
+ };
+ const add = async () => {
+ const taskIds = [...selected()].filter((id) => !excludedIds().has(id));
+ if (saving() || !taskIds.length) return;
+ setSaving(true);
+ setError(undefined);
+ try {
+ const results = await commands.assignTasks(props.project.id, taskIds);
+ const failed = results.filter((result) => result.error);
+ if (!failed.length) {
+ props.onClose();
+ return;
+ }
+ setSelected(new Set(failed.map((result) => result.taskId)));
+ setError(
+ `${failed.length} ${failed.length === 1 ? 'task could' : 'tasks could'} not be added. ${failed[0].error}`
+ );
+ } catch (error) {
+ setError(
+ error instanceof Error
+ ? error.message
+ : 'Could not add tasks. Try again.'
+ );
+ } finally {
+ setSaving(false);
+ }
+ };
+
+ return (
+ <Dialog
+ open
+ onOpenChange={(open) => {
+ if (!open) close();
+ }}
+ class="max-w-lg"
+ >
+ <div class="flex flex-col gap-3 p-4">
+ <Dialog.Title>Add existing tasks</Dialog.Title>
+ <Dialog.Description class="text-sm text-ink-muted">
+ Select tasks to add to {props.project.name}. Tasks already in another
+ project will move here.
+ </Dialog.Description>
+ <div inert={saving()} classList={{ 'opacity-50': saving() }}>
+ <Suspense fallback={<p role="status">Loading tasks…</p>}>
+ <PropertyEntitySelector
+ config={{
+ specificEntityType: 'TASK',
+ isMultiSelect: true,
+ placeholder: 'Search tasks…',
+ excludedIds,
+ }}
+ selectedOptions={selected}
+ setSelectedOptions={(ids) => {
+ if (!saving()) setSelected(ids);
+ }}
+ onClose={close}
+ />
+ </Suspense>
+ </div>
+ <Show when={error()}>
+ {(message) => (
+ <p role="alert" class="text-sm text-failure">
+ {message()}
+ </p>
+ )}
+ </Show>
+ <div
+ class="flex justify-end gap-2"
+ onKeyDown={(event) => {
+ // The selector owns document-level list navigation; footer buttons
+ // keep their native Enter behavior without toggling another task.
+ if (['Enter', 'ArrowUp', 'ArrowDown'].includes(event.key))
+ event.stopPropagation();
+ }}
+ >
+ <Button disabled={saving()} onClick={close}>
+ Cancel
+ </Button>
+ <Button
+ variant="cta"
+ disabled={saving() || !selected().size}
+ onClick={() => void add()}
+ >
+ {saving()
+ ? 'Adding tasks…'
+ : `Add ${selected().size || ''} ${selected().size === 1 ? 'task' : 'tasks'}`}
+ </Button>
+ </div>
+ </div>
+ </Dialog>
+ );
+}
diff --git a/apps/web/src/features/projects/views/project-assignment.tsx b/apps/web/src/features/projects/views/project-assignment.tsx
index 2a40c5dea2..2d84bdc7f0 100644
--- a/apps/web/src/features/projects/views/project-assignment.tsx
+++ b/apps/web/src/features/projects/views/project-assignment.tsx
@@ -55,7 +55,7 @@ export function ProjectAssignment(props: {
>
<div class="flex flex-col gap-3 p-4">
<Dialog.Title>
- Set project
+ Add to project
{remaining().length > 1 ? ` for ${remaining().length} tasks` : ''}
</Dialog.Title>
<SearchBar
diff --git a/apps/web/src/features/projects/views/project-tasks-list.tsx b/apps/web/src/features/projects/views/project-tasks-list.tsx
index 224ff52bbe..bc36360cf9 100644
--- a/apps/web/src/features/projects/views/project-tasks-list.tsx
+++ b/apps/web/src/features/projects/views/project-tasks-list.tsx
@@ -23,6 +23,7 @@ export type ProjectTasksListProps = Omit<
'children'
> & {
onCreateTask?: () => void;
+ onAddTasks?: () => void;
};
/** Embeds the actual Tasks list, including its controllers, menus and row editors. */
@@ -82,6 +83,9 @@ function ProjectTasksListBody(props: ProjectTasksListProps) {
/>
<div class="ml-auto flex shrink-0 items-center gap-3">
<TasksControls />
+ <Show when={props.onAddTasks}>
+ <Button onClick={props.onAddTasks}>Add existing tasks</Button>
+ </Show>
<Show when={props.onCreateTask}>
<Button onClick={props.onCreateTask}>New task</Button>
</Show>
diff --git a/apps/web/src/features/projects/views/project-workspace.tsx b/apps/web/src/features/projects/views/project-workspace.tsx
index f6837ad759..55bc431132 100644
--- a/apps/web/src/features/projects/views/project-workspace.tsx
+++ b/apps/web/src/features/projects/views/project-workspace.tsx
@@ -18,6 +18,7 @@ import {
type ProjectDetail,
type ProjectSection,
} from '../core/project';
+import { AddProjectTasks } from './add-project-tasks';
import {
ProjectTasksList,
type ProjectTasksListProps,
@@ -44,6 +45,7 @@ export function ProjectWorkspace(props: {
}) {
const definitions = useProjectsContext().createPropertyDefinitionsSource();
const [deleting, setDeleting] = createSignal(false);
+ const [addingTasks, setAddingTasks] = createSignal(false);
const [error, setError] = createSignal<string>();
const canEdit = () => canEditProject(props.project);
const run = async (action: () => Promise<void>) => {
@@ -176,6 +178,7 @@ export function ProjectWorkspace(props: {
projectId={props.project.id}
onOpenTask={props.onOpenTask}
onCreateTask={canEdit() ? props.onCreateTask : undefined}
+ onAddTasks={canEdit() ? () => setAddingTasks(true) : undefined}
/>
</Match>
</Switch>
@@ -197,6 +200,12 @@ export function ProjectWorkspace(props: {
}
/>
</Show>
+ <Show when={addingTasks() && canEdit()}>
+ <AddProjectTasks
+ project={props.project}
+ onClose={() => setAddingTasks(false)}
+ />
+ </Show>
</SidePanel.Layout>
);
}
diff --git a/apps/web/src/features/projects/views/task-project-property.tsx b/apps/web/src/features/projects/views/task-project-property.tsx
new file mode 100644
index 0000000000..99d5a94d4e
--- /dev/null
+++ b/apps/web/src/features/projects/views/task-project-property.tsx
@@ -0,0 +1,53 @@
+import CaretDownIcon from '@phosphor/caret-down.svg';
+import StackIcon from '@phosphor/stack.svg';
+import { Button, Tooltip } from '@ui';
+import { createSignal, Show } from 'solid-js';
+import { useProjectsContext } from '../context/projects-context';
+import { ProjectAssignment } from './project-assignment';
+
+/** Project membership is a task relation, rendered alongside its properties. */
+export function TaskProjectProperty(props: {
+ taskId: string;
+ canEdit: boolean;
+}) {
+ const references = useProjectsContext().createReferencesSource(() => [
+ props.taskId,
+ ]);
+ const [open, setOpen] = createSignal(false);
+ const reference = () => references.references().get(props.taskId);
+ const label = () => {
+ const project = reference();
+ if (project?.state === 'visible') return project.name;
+ if (project?.state === 'unavailable') return 'Unavailable project';
+ if (references.loading()) return 'Loading project…';
+ if (references.error()) return 'Could not load project';
+ return 'No project';
+ };
+
+ return (
+ <>
+ <Tooltip label={`Project: ${label()}`}>
+ <Button
+ size="sm"
+ variant="ghost"
+ class="max-w-full gap-1.5 rounded-full border border-edge bg-surface-2 px-2 py-1 text-xs font-normal"
+ aria-label={`Project: ${label()}`}
+ disabled={!props.canEdit}
+ onClick={() => setOpen(true)}
+ >
+ <StackIcon class="size-3 shrink-0" />
+ <span class="max-w-48 truncate">{label()}</span>
+ <Show when={props.canEdit}>
+ <CaretDownIcon class="size-3 shrink-0" />
+ </Show>
+ </Button>
+ </Tooltip>
+ <Show when={open() && props.canEdit}>
+ <ProjectAssignment
+ taskIds={[props.taskId]}
+ onClose={() => setOpen(false)}
+ />
+ </Show>
+ </>
+ );
+}
diff --git a/apps/web/src/features/property/editors/selectors/PropertyEntitySelector.tsx b/apps/web/src/features/property/editors/selectors/PropertyEntitySelector.tsx
index 2cb0555a54..9a52bc752e 100644
--- a/apps/web/src/features/property/editors/selectors/PropertyEntitySelector.tsx
+++ b/apps/web/src/features/property/editors/selectors/PropertyEntitySelector.tsx
@@ -282,7 +282,10 @@ export function PropertyEntitySelector(props: EntityInputProps) {
const filteredEntities = createMemo(() => {
const term = searchTerm();
- const allEntities = entities();
+ const excludedIds = props.config.excludedIds?.();
+ const allEntities = entities().filter(
+ (entity) => !excludedIds?.has(entity.id)
+ );
const userId = currentUserId();
// List is unvirtualized — revisit if these caps grow significantly.
@@ -313,6 +316,7 @@ export function PropertyEntitySelector(props: EntityInputProps) {
if (needsEmailSearch() && term) {
const localIds = new Set(localResults.map((e) => e.id));
const serverResults = serverEmails()
+ .filter((entity) => !excludedIds?.has(entity.id))
.filter((e) => !localIds.has(e.id))
.filter(excludeFilter);
return [...localResults, ...serverResults].slice(0, MAX_SEARCH_RESULTS);
diff --git a/apps/web/src/features/property/editors/selectors/types.ts b/apps/web/src/features/property/editors/selectors/types.ts
index 9ea24fa0eb..b245efda4f 100644
--- a/apps/web/src/features/property/editors/selectors/types.ts
+++ b/apps/web/src/features/property/editors/selectors/types.ts
@@ -18,6 +18,8 @@ export type EntitySelectorConfig = {
placeholder: string;
specificEntityType?: EntityType | null;
selfFilter?: { entityType: EntityType; blockId?: string };
+ /** Entities already linked to the destination are not selectable again. */
+ excludedIds?: Accessor<ReadonlySet<string>>;
/** Explicit pool for USER pickers (e.g. company owner → team members);
* replaces the default quick-access people list. */
users?: Accessor<IUser[]>;
diff --git a/apps/web/src/features/soup/createSoupEntityActions.ts b/apps/web/src/features/soup/createSoupEntityActions.ts
index 0fbdea6f51..334d20fc1c 100644
--- a/apps/web/src/features/soup/createSoupEntityActions.ts
+++ b/apps/web/src/features/soup/createSoupEntityActions.ts
@@ -379,7 +379,7 @@ export function createSoupEntityActions(): {
) {
middleItems.push({
id: 'set-initiative',
- label: 'Set project',
+ label: 'Add to project…',
onClick: () => {
if (isFeatureEnabled(enableProjects)) openProjectPicker();
},
diff --git a/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx b/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx
index 9fe77a8151..611499af68 100644
--- a/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx
+++ b/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx
@@ -19,6 +19,8 @@ import {
} from '@app/lib/signals/store-array-updaters';
import { SwipableRowProvider } from '@components/app/mobile/SwipableRow';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
+import { HotkeyTags } from '@core/hotkey/constants';
+import { registerHotkey } from '@core/hotkey/hotkeys';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import {
type EntityData,
@@ -61,11 +63,11 @@ import { TaskListEntity } from './TaskListEntity';
import { TaskListHeader } from './TaskListHeader';
import { taskGridColumnCount } from './task-grid-template';
import './task-list.css';
+import { ProjectPropertyCell } from '@app/features/projects/project-property';
import {
- ProjectPickerPopover,
- ProjectPropertyCell,
-} from '@app/features/projects/project-property';
-import { useTaskProjectReferences } from '@app/features/projects/projects';
+ ProjectAssignmentDialog,
+ useTaskProjectReferences,
+} from '@app/features/projects/projects';
function ResponsiveTaskListHeader() {
const layout = useListLayout();
@@ -227,10 +229,8 @@ export function TaskList(props: TaskListProps) {
)
);
const columnCount = () => taskGridColumnCount(projectsEnabled());
- const [assigningProjectTasks, setAssigningProjectTasks] = createSignal<{
- ids: string[];
- anchor: HTMLElement;
- }>();
+ const [assigningProjectTasks, setAssigningProjectTasks] =
+ createSignal<string[]>();
const tasksById = createMemo(() => {
const tasks = new Map<string, TaskEntityWithProperties>();
for (const row of visibleRows()) {
@@ -338,6 +338,20 @@ export function TaskList(props: TaskListProps) {
condition: panel.isPanelActive,
});
+ registerHotkey({
+ scopeId: panel.splitHotkeyScope,
+ description: 'Add to project…',
+ tags: [HotkeyTags.SelectionModification],
+ condition: () =>
+ panel.isPanelActive() && projectsEnabled() && selectedTasks().length > 0,
+ keyDownHandler: () => {
+ const ids = selectedTasks().map((task) => task.id);
+ if (!projectsEnabled() || !ids.length) return false;
+ setAssigningProjectTasks(ids);
+ return true;
+ },
+ });
+
let restoredScroll = false;
function registerVirtualizer(handle?: VirtualizerHandle) {
setVirtualizer(handle);
@@ -664,32 +678,13 @@ export function TaskList(props: TaskListProps) {
selected={selectedTasks()}
onClear={listInteractions.selection.clear}
analyticsSource="tasks_view_selection_toolbar"
- >
- <Show when={projectsEnabled()}>
- <Button
- size="sm"
- class="whitespace-nowrap"
- onClick={(event) =>
- setAssigningProjectTasks({
- ids: selectedTasks().map((task) => task.id),
- anchor: event.currentTarget,
- })
- }
- >
- Set project
- </Button>
- </Show>
- </EntitySelectionToolbar>
+ />
</Show>
<Show when={projectsEnabled() && assigningProjectTasks()}>
{(assigning) => (
- <ProjectPickerPopover
- taskIds={assigning().ids}
- open
- onOpenChange={(open) => {
- if (!open) setAssigningProjectTasks(undefined);
- }}
- getAnchorRect={() => assigning().anchor.getBoundingClientRect()}
+ <ProjectAssignmentDialog
+ taskIds={assigning()}
+ onClose={() => setAssigningProjectTasks(undefined)}
/>
)}
</Show>
diff --git a/docs/AGENT_GUIDE/tasks.md b/docs/AGENT_GUIDE/tasks.md
index e2376eaa67..a0aaa7413d 100644
--- a/docs/AGENT_GUIDE/tasks.md
+++ b/docs/AGENT_GUIDE/tasks.md
@@ -203,7 +203,7 @@ Assigning an agent to the project does not start work on tasks already in it.
Removing the project agent stops assignment to future tasks; it does not cancel
sessions already started for its tasks.
For verification, create a task from the project's Tasks tab, then move another
-task into the project through `Set project…`; both should start the assigned
+task into the project through `Add to project…`; both should start the assigned
agent's normal task session and show its message in the task's Discussion.
Overview's Description uses the shared collaborative Markdown editor and saves
@@ -222,14 +222,21 @@ inserted into the query cache before the composer closes, including its selected
properties and project chip. It stays in its group while saving and assigning,
then uses the saved task ID. Failed creations or assignments roll back that row.
Verify this with GraphQL Soup both enabled and disabled. The section tabs
-use the same control as Channels. Existing tasks can be assigned through their
-`Set project…` context menu; there is no bulk-add dialog in the project view.
-The regular Tasks list includes a Project column; clicking a project chip opens
-that project. Right-click a task and choose `Set project…` to choose or clear its
-project. On mobile the same action is in the long-press menu. Selecting several
-tasks exposes `Set project` in the selection toolbar, and a context action on a
-selected row applies to the selection. Partial assignment failures leave only
-failed tasks in the picker for retry.
+use the same control as Channels. Editors can choose `Add existing tasks` beside
+`New task`, search for tasks, select several, and confirm `Add N tasks`. Tasks
+already in this project are excluded. Adding a task moves it from its previous
+project; the dialog explains this before saving. A partial failure keeps only
+failed tasks selected for retry, and a request failure preserves the selection.
+
+The regular Tasks list includes a Project column; clicking its cell opens the
+project picker. Right-click a task and choose `Add to project…` to choose or clear
+its project. On mobile the same action is in the long-press menu. For a selection,
+choose `Actions → Add to project…`; there is no separate assignment button in the
+selection toolbar. A context action on a selected row applies to the selection.
+Inside an open task, use the Project pill below the title, the Project row in
+the Properties side panel, or `Add to project…` in the title's actions menu.
+The property shows `No project` until assigned and stays read-only without edit
+access. Choose `No project` in the assignment dialog to remove the association.
Discussion at the bottom of Overview uses the new discussions system. Comments
appear from oldest to newest, with the comment input below them. The Discussion