Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(projects): project page as a document, with an insights sidebar and an Activity tab (#10627)

Jiayuan Zhang6c23dac8bc18
diff --git a/CLI_AND_DAEMON.md b/CLI_AND_DAEMON.md
index 20de4abe99..ffa6e3348c 100644
--- a/CLI_AND_DAEMON.md
+++ b/CLI_AND_DAEMON.md
@@ -984,12 +984,26 @@ The response includes `progress`: `scope` is every issue except cancelled ones,
`completed` counts done issues, `started` issues are tracked but do not add to
`percent`. The table output shows it as a PROGRESS column (`5/11 (45%)`).
+### Project Overview
+
+```bash
+multica project overview <id> # JSON by default
+multica project overview <id> --output table
+```
+
+Returns everything on the project page in one read:
+`{"project": ..., "progress": ..., "resources": [...], "working_agents": [...], "activity": [...]}`.
+`working_agents` lists the agents running a task on one of the project's issues
+right now, with the issue ids; `activity` is the 10 newest entries of
+`multica project activity`. New sections are added as new top-level keys.
+
### Project Progress
```bash
multica project progress <id> # summary and forecast
multica project progress <id> --history # weekly scope / started / completed
multica project progress <id> --by assignee # per-assignee breakdown
+multica project progress <id> --by label # per-label breakdown
multica project progress <id> --output json # everything above
```
@@ -997,6 +1011,19 @@ The forecast is a completion date from the trailing 4-week completion rate;
it is omitted when there is less than a week of history or nothing was
completed recently.
+### Project Activity
+
+```bash
+multica project activity <id> # newest 30, table by default
+multica project activity <id> --limit 100 --output json
+multica project activity <id> --before <next_cursor> # older entries
+```
+
+What changed on the project's issues, newest first: issue creation and status,
+assignee, priority, start/due date, title and duplicate changes. Each entry names
+the issue (`issue_identifier`, `issue_title`, `issue_status`), the actor and the
+`details` of the change. JSON output carries `next_cursor` until the last page.
+
### Create Project
```bash
diff --git a/packages/core/api/client.ts b/packages/core/api/client.ts
index ee4a0c44e7..5031f5af38 100644
--- a/packages/core/api/client.ts
+++ b/packages/core/api/client.ts
@@ -147,6 +147,7 @@ import type {
Project,
ArchiveProjectResponse,
ProjectProgressDetail,
+ ProjectActivityPage,
CreateProjectRequest,
UpdateProjectRequest,
ListProjectsResponse,
@@ -430,6 +431,8 @@ import {
ArchiveProjectResponseSchema,
ProjectProgressDetailSchema,
EMPTY_PROJECT_PROGRESS_DETAIL,
+ ProjectActivityPageSchema,
+ EMPTY_PROJECT_ACTIVITY_PAGE,
ListProjectMembersResponseSchema,
ListPrivateProjectsResponseSchema,
ProjectSubscriptionSchema,
@@ -4982,6 +4985,20 @@ export class ApiClient {
});
}
+ async listProjectActivity(
+ id: string,
+ params: { before?: string; limit?: number } = {},
+ ): Promise<ProjectActivityPage> {
+ const search = new URLSearchParams();
+ if (params.before) search.set("before", params.before);
+ if (params.limit) search.set("limit", String(params.limit));
+ const query = search.toString();
+ const raw = await this.fetch<unknown>(`/api/projects/${id}/activity${query ? `?${query}` : ""}`);
+ return parseWithFallback(raw, ProjectActivityPageSchema, EMPTY_PROJECT_ACTIVITY_PAGE, {
+ endpoint: "GET /api/projects/:id/activity",
+ });
+ }
+
async createProject(data: CreateProjectRequest): Promise<Project> {
const raw = await this.fetch<unknown>("/api/projects", {
method: "POST",
diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.ts
index eb77e6b83f..eafff8ab39 100644
--- a/packages/core/api/schemas.ts
+++ b/packages/core/api/schemas.ts
@@ -81,6 +81,7 @@ import type {
Label,
Project,
ProjectProgressDetail,
+ ProjectActivityPage,
ListProjectsResponse,
MemberWithUser,
IssueProperty,
@@ -1878,6 +1879,13 @@ export const ProjectProgressDetailSchema = z.object({
completed: z.number().default(0),
started: z.number().default(0),
}).loose()).default([]),
+ // Older servers omit it; the label breakdown then has nothing to show.
+ by_label: z.array(z.object({
+ label_id: z.string().nullable().default(null),
+ scope: z.number().default(0),
+ completed: z.number().default(0),
+ started: z.number().default(0),
+ }).loose()).default([]).catch([]),
history: z.array(z.object({
date: z.string(),
scope: z.number().default(0),
@@ -1893,10 +1901,29 @@ export const ProjectProgressDetailSchema = z.object({
export const EMPTY_PROJECT_PROGRESS_DETAIL: ProjectProgressDetail = {
progress: { unit: "issues", scope: 0, completed: 0, started: 0, unstarted: 0, cancelled: 0, percent: 0 },
by_assignee: [],
+ by_label: [],
history: [],
forecast: null,
};
+export const ProjectActivityPageSchema = z.object({
+ entries: z.array(z.object({
+ id: z.string(),
+ issue_id: z.string(),
+ issue_identifier: z.string().default(""),
+ issue_title: z.string().default(""),
+ issue_status: z.string().default(""),
+ actor_type: z.string().default(""),
+ actor_id: z.string().default(""),
+ action: z.string(),
+ details: z.record(z.string(), z.unknown()).default({}).catch({}),
+ created_at: z.string(),
+ }).loose()).default([]),
+ next_cursor: z.string().nullable().default(null),
+}).loose();
+
+export const EMPTY_PROJECT_ACTIVITY_PAGE: ProjectActivityPage = { entries: [], next_cursor: null };
+
export const EMPTY_LIST_PROJECTS_RESPONSE: ListProjectsResponse = { projects: [], total: 0 };
export const ProjectMemberSchema = z.object({
diff --git a/packages/core/package.json b/packages/core/package.json
index b54081a7d0..ae0c9c45f4 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -115,6 +115,7 @@
"./projects": "./projects/index.ts",
"./projects/deletion-permissions": "./projects/deletion-permissions.ts",
"./projects/queries": "./projects/queries.ts",
+ "./projects/tab-store": "./projects/tab-store.ts",
"./projects/mutations": "./projects/mutations.ts",
"./projects/access": "./projects/access.ts",
"./projects/config": "./projects/config.ts",
diff --git a/packages/core/projects/queries.ts b/packages/core/projects/queries.ts
index e44b391353..48531c6cfb 100644
--- a/packages/core/projects/queries.ts
+++ b/packages/core/projects/queries.ts
@@ -1,4 +1,4 @@
-import { queryOptions } from "@tanstack/react-query";
+import { infiniteQueryOptions, queryOptions } from "@tanstack/react-query";
import { api } from "../api";
export const projectKeys = {
@@ -15,6 +15,7 @@ export const projectKeys = {
// Under detail so the issue mutations that invalidate projectKeys.all also
// refresh the trend and breakdown.
progress: (wsId: string, id: string) => [...projectKeys.detail(wsId, id), "progress"] as const,
+ activity: (wsId: string, id: string) => [...projectKeys.detail(wsId, id), "activity"] as const,
};
// The cached list includes archived projects: it doubles as the id → project
@@ -43,6 +44,17 @@ export function projectProgressOptions(wsId: string, id: string) {
});
}
+// Newest first, a page at a time. Under detail, so issue changes refresh it
+// with the progress.
+export function projectActivityOptions(wsId: string, id: string, pageSize = 30) {
+ return infiniteQueryOptions({
+ queryKey: [...projectKeys.activity(wsId, id), pageSize],
+ queryFn: ({ pageParam }) => api.listProjectActivity(id, { before: pageParam, limit: pageSize }),
+ initialPageParam: undefined as string | undefined,
+ getNextPageParam: (last) => last.next_cursor ?? undefined,
+ });
+}
+
export function projectMembersOptions(wsId: string, id: string) {
return queryOptions({
queryKey: projectKeys.members(wsId, id),
diff --git a/packages/core/projects/tab-store.ts b/packages/core/projects/tab-store.ts
new file mode 100644
index 0000000000..25c3614a2d
--- /dev/null
+++ b/packages/core/projects/tab-store.ts
@@ -0,0 +1,57 @@
+import { create } from "zustand";
+import { createJSONStorage, persist } from "zustand/middleware";
+import { defaultStorage } from "../platform/storage";
+
+export type ProjectTab = "overview" | "issues" | "activity";
+
+export function isProjectTab(value: unknown): value is ProjectTab {
+ return value === "overview" || value === "issues" || value === "activity";
+}
+
+// Older entries are dropped past this many projects so the saved map stays small.
+const MAX_REMEMBERED = 100;
+
+interface ProjectTabState {
+ /** The tab each project was last left on, keyed by project id (ids are globally unique). */
+ lastTab: Record<string, ProjectTab>;
+ remember: (projectId: string, tab: ProjectTab) => void;
+}
+
+// A personal navigation habit, saved on this device like the issue opening mode.
+export const useProjectTabStore = create<ProjectTabState>()(
+ persist(
+ (set) => ({
+ lastTab: {},
+ remember: (projectId, tab) =>
+ set((state) => {
+ if (state.lastTab[projectId] === tab) return state;
+ const { [projectId]: _previous, ...rest } = state.lastTab;
+ const entries = Object.entries({ ...rest, [projectId]: tab });
+ return { lastTab: Object.fromEntries(entries.slice(-MAX_REMEMBERED)) };
+ }),
+ }),
+ {
+ name: "multica_project_tab",
+ storage: createJSONStorage(() => defaultStorage),
+ partialize: ({ lastTab }) => ({ lastTab }),
+ merge: (persisted, current) => {
+ const saved = persisted && typeof persisted === "object" && "lastTab" in persisted ? persisted.lastTab : null;
+ const lastTab: Record<string, ProjectTab> = {};
+ if (saved && typeof saved === "object") {
+ for (const [id, tab] of Object.entries(saved)) if (isProjectTab(tab)) lastTab[id] = tab;
+ }
+ return { ...current, lastTab };
+ },
+ },
+ ),
+);
+
+/**
+ * The tab a project opens on when the URL doesn't name one: the tab this
+ * person last left it on, else Overview. A project without issues opens on
+ * Overview, since its Issues tab would only show an empty state.
+ */
+export function defaultProjectTab(remembered: ProjectTab | undefined, issueCount: number): ProjectTab {
+ if (issueCount === 0) return "overview";
+ return remembered ?? "overview";
+}
diff --git a/packages/core/types/index.ts b/packages/core/types/index.ts
index 4896e1d8e6..f243e2a2af 100644
--- a/packages/core/types/index.ts
+++ b/packages/core/types/index.ts
@@ -217,6 +217,9 @@ export type {
ProjectProgressPoint,
ProjectProgressForecast,
ProjectProgressDetail,
+ ProjectProgressLabel,
+ ProjectActivityEntry,
+ ProjectActivityPage,
ListProjectMembersResponse,
PrivateProjectOverview,
ListPrivateProjectsResponse,
diff --git a/packages/core/types/project.ts b/packages/core/types/project.ts
index ef75e9dad5..8238c3cd77 100644
--- a/packages/core/types/project.ts
+++ b/packages/core/types/project.ts
@@ -69,6 +69,15 @@ export interface ProjectProgressAssignee {
started: number;
}
+/** Issues carrying one label; an issue with several labels counts under each. */
+export interface ProjectProgressLabel {
+ /** Null for the issues with no label. */
+ label_id: string | null;
+ scope: number;
+ completed: number;
+ started: number;
+}
+
/** One weekly sample; `date` is a calendar day ("YYYY-MM-DD"), the last one is today. */
export interface ProjectProgressPoint {
date: string;
@@ -85,10 +94,31 @@ export interface ProjectProgressForecast {
export interface ProjectProgressDetail {
progress: ProjectProgress;
by_assignee: ProjectProgressAssignee[];
+ by_label: ProjectProgressLabel[];
history: ProjectProgressPoint[];
forecast: ProjectProgressForecast | null;
}
+/** One activity on an issue in the project, with the issue it happened on. */
+export interface ProjectActivityEntry {
+ id: string;
+ issue_id: string;
+ issue_identifier: string;
+ issue_title: string;
+ issue_status: string;
+ actor_type: string;
+ actor_id: string;
+ action: string;
+ details: Record<string, unknown>;
+ created_at: string;
+}
+
+export interface ProjectActivityPage {
+ entries: ProjectActivityEntry[];
+ /** Reads the next older page; null on the last one. */
+ next_cursor: string | null;
+}
+
export interface Project {
id: string;
workspace_id: string;
diff --git a/packages/views/issue-views/view-header.tsx b/packages/views/issue-views/view-header.tsx
index 3a177385ed..324f452551 100644
--- a/packages/views/issue-views/view-header.tsx
+++ b/packages/views/issue-views/view-header.tsx
@@ -130,6 +130,7 @@ export function IssueViewHeader({
baseMenu,
baseBadge,
hideCreate = false,
+ afterTitle,
trailing,
}: {
controller: IssueSurfaceController;
@@ -140,6 +141,8 @@ export function IssueViewHeader({
baseBadge?: ReactNode;
/** Drops the new-issue button, e.g. on an archived project. */
hideCreate?: boolean;
+ /** Page-level navigation right after the title, e.g. the project's tabs. */
+ afterTitle?: ReactNode;
/** Layout toggles at the far end, e.g. the project's properties panel. */
trailing?: ReactNode;
}) {
@@ -381,7 +384,7 @@ export function IssueViewHeader({
return (
<>
<PageHeader className="@container/issue-header">
- <div className="flex min-w-0 flex-1 items-center gap-1 overflow-x-clip">
+ <div className="flex min-w-0 flex-1 items-center gap-1 self-stretch overflow-x-clip">
{renaming && activeView ? (
<span className="flex min-w-0 shrink-0 items-center gap-2">
<Layers className="size-4 shrink-0 text-muted-foreground" />
@@ -507,6 +510,8 @@ export function IssueViewHeader({
</DropdownMenu>
)}
+ {afterTitle}
+
<IssueFilterMenu
align="start"
open={filterOpen}
diff --git a/packages/views/issues/components/activity-text.ts b/packages/views/issues/components/activity-text.ts
new file mode 100644
index 0000000000..f7ce9d3ecb
--- /dev/null
+++ b/packages/views/issues/components/activity-text.ts
@@ -0,0 +1,169 @@
+import { isBuiltInIssueStatus } from "@multica/core/issue-statuses";
+import { formatDateOnly } from "@multica/core/issues/date";
+import type { TimelineEntry } from "@multica/core/types";
+import type { useT } from "../../i18n";
+import { priorityLabel } from "../utils/priority-label";
+
+/** The activity fields the copy reads, shared by issue timelines and the project feed. */
+export type ActivityTextEntry = Pick<
+ TimelineEntry,
+ "action" | "details" | "actor_type" | "actor_id" | "coalesced_count"
+>;
+
+export type ActivityT = ReturnType<typeof useT<"issues">>["t"];
+
+/**
+ * Labels a status key from the activity feed. `resolveLabel` is the workspace
+ * catalog resolver, which names custom statuses; without it — or for a status
+ * since deleted — a built-in still gets its i18n name and anything else falls
+ * back to the raw key. (MUL-6243)
+ */
+export function statusLabel(
+ status: string,
+ t: ActivityT,
+ resolveLabel?: (statusKey: string) => string,
+): string {
+ if (resolveLabel) return resolveLabel(status);
+ if (isBuiltInIssueStatus(status)) {
+ return t(($) => $.status[status]);
+ }
+ return status;
+}
+
+export function formatActivity(
+ entry: ActivityTextEntry,
+ t: ActivityT,
+ locale: string,
+ resolveActorName?: (type: string, id: string) => string,
+ resolveStatusLabel?: (statusKey: string) => string,
+ requesterName?: string,
+): string {
+ const details = (entry.details ?? {}) as Record<string, string>;
+ switch (entry.action) {
+ case "created":
+ if (requesterName && entry.actor_type === "agent") {
+ return t(($) => $.activity.created_on_behalf_of, { name: requesterName });
+ }
+ return t(($) => $.activity.created);
+ case "status_changed":
+ // PR auto-complete (MUL-7429) says why the status moved.
+ if (details.source === "pr_automation") {
+ return t(($) => $.activity.status_changed_pr, {
+ from: statusLabel(details.from ?? "?", t, resolveStatusLabel),
+ to: statusLabel(details.to ?? "?", t, resolveStatusLabel),
+ prs: details.pull_requests ?? "",
+ });
+ }
+ return t(($) => $.activity.status_changed, {
+ from: statusLabel(details.from ?? "?", t, resolveStatusLabel),
+ to: statusLabel(details.to ?? "?", t, resolveStatusLabel),
+ });
+ case "pr_auto_complete_changed":
+ return (entry.details as { disabled?: unknown } | undefined)?.disabled === true
+ ? t(($) => $.activity.pr_auto_complete_disabled)
+ : t(($) => $.activity.pr_auto_complete_enabled);
+ case "priority_changed":
+ return t(($) => $.activity.priority_changed, {
+ from: priorityLabel(details.from ?? "?", t),
+ to: priorityLabel(details.to ?? "?", t),
+ });
+ case "assignee_changed": {
+ const isSelfAssign = details.to_type === entry.actor_type && details.to_id === entry.actor_id;
+ if (isSelfAssign) return t(($) => $.activity.self_assigned);
+ const toName = details.to_id && details.to_type && resolveActorName
+ ? resolveActorName(details.to_type, details.to_id)
+ : null;
+ if (toName) return t(($) => $.activity.assigned_to, { name: toName });
+ if (details.from_id && !details.to_id) return t(($) => $.activity.removed_assignee);
+ return t(($) => $.activity.changed_assignee);
+ }
+ case "start_date_changed": {
+ if (!details.to) return t(($) => $.activity.start_date_removed);
+ const formatted = formatDateOnly(details.to, { month: "short", day: "numeric" }, locale);
+ return t(($) => $.activity.start_date_set, { date: formatted });
+ }
+ case "due_date_changed": {
+ if (!details.to) return t(($) => $.activity.due_date_removed);
+ const formatted = formatDateOnly(details.to, { month: "short", day: "numeric" }, locale);
+ return t(($) => $.activity.due_date_set, { date: formatted });
+ }
+ case "title_changed":
+ return t(($) => $.activity.title_renamed, {
+ from: details.from ?? "?",
+ to: details.to ?? "?",
+ });
+ case "description_updated":
+ return t(($) => $.activity.description_updated);
+ case "duplicate_marked":
+ return t(($) => $.activity.duplicate_marked, {
+ identifier: details.original_identifier || "?",
+ });
+ case "duplicate_unmarked": {
+ const identifier = details.original_identifier || "?";
+ if (details.reason === "original_deleted") {
+ return t(($) => $.activity.duplicate_unmarked_original_deleted, { identifier });
+ }
+ // The row stands in for the status row of the reopen, so it says where
+ // the status went.
+ if (details.to) {
+ return t(($) => $.activity.duplicate_unmarked_to, {
+ identifier,
+ status: statusLabel(details.to, t, resolveStatusLabel),
+ });
+ }
+ return t(($) => $.activity.duplicate_unmarked, { identifier });
+ }
+ case "duplicate_added":
+ return t(($) => $.activity.duplicate_added, {
+ identifier: details.duplicate_identifier || "?",
+ });
+ case "duplicate_removed":
+ return t(($) => $.activity.duplicate_removed, {
+ identifier: details.duplicate_identifier || "?",
+ });
+ case "task_completed": {
+ const count = entry.coalesced_count ?? 1;
+ return count === 1
+ ? t(($) => $.activity.task_completed_single)
+ : t(($) => $.activity.task_completed, { count });
+ }
+ case "task_failed": {
+ const count = entry.coalesced_count ?? 1;
+ return count === 1
+ ? t(($) => $.activity.task_failed_single)
+ : t(($) => $.activity.task_failed, { count });
+ }
+ case "squad_leader_evaluated": {
+ const reason = details.reason?.trim();
+ switch (details.outcome) {
+ case "action":
+ return reason
+ ? t(($) => $.activity.squad_leader_action_reason, { reason })
+ : t(($) => $.activity.squad_leader_action);
+ case "no_action":
+ return reason
+ ? t(($) => $.activity.squad_leader_no_action_reason, { reason })
+ : t(($) => $.activity.squad_leader_no_action);
+ case "failed":
+ return reason
+ ? t(($) => $.activity.squad_leader_failed_reason, { reason })
+ : t(($) => $.activity.squad_leader_failed);
+ default:
+ return t(($) => $.activity.squad_leader_evaluated);
+ }
+ }
+ case "environment_controlled": {
+ const name = details.label || details.name || "?";
+ switch (details.action) {
+ case "stop":
+ return t(($) => $.activity.environment_stopped, { name });
+ case "restart":
+ return t(($) => $.activity.environment_restarted, { name });
+ default:
+ return t(($) => $.activity.environment_started, { name });
+ }
+ }
+ default:
+ return entry.action ?? "";
+ }
+}
diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
index 89fb16d05a..1a7f0f1f11 100644
--- a/packages/views/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -9,7 +9,7 @@ import {
import { IssueFlowCard } from "../../workflows/issue-flow-card";
import { IssueAppRequests } from "../../common/app-requests";
import { useStatusLabel } from "../utils/status-label";
-import { priorityLabel } from "../utils/priority-label";
+import { formatActivity, type ActivityT } from "./activity-text";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import { useState, useEffect, useCallback, useMemo, useRef, useId, Fragment, type ComponentProps, type ReactNode } from "react";
import { Virtuoso, type ListRange, type VirtuosoHandle } from "react-virtuoso";
@@ -86,7 +86,6 @@ import { TimelineHandoff } from "../../workflows/timeline-handoff";
import { PropertyIcon } from "../../common/property-icon";
import type { Attachment, InboxItem, Issue, IssueProperty, IssueStatus, IssueStatusCategory, IssuePriority, TimelineEntry, UpdateIssueRequest } from "@multica/core/types";
import { contentReferencesAttachment } from "@multica/core/types";
-import { isBuiltInIssueStatus } from "@multica/core/issue-statuses";
import { commentLandingTarget, isDeletedComment } from "@multica/core/issues/comment-deletion";
import { formatDateOnly, isPastDateOnly } from "@multica/core/issues/date";
import { useUpdateIssue } from "@multica/core/issues/mutations";
@@ -350,164 +349,6 @@ function shortDate(date: string | null, locale: string): string {
return formatDateOnly(date, { month: "short", day: "numeric" }, locale);
}
-type ActivityT = ReturnType<typeof useT<"issues">>["t"];
-
-/**
- * Labels a status key from the activity feed. `resolveLabel` is the workspace
- * catalog resolver, which names custom statuses; without it — or for a status
- * since deleted — a built-in still gets its i18n name and anything else falls
- * back to the raw key. (MUL-6243)
- */
-function statusLabel(
- status: string,
- t: ActivityT,
- resolveLabel?: (statusKey: string) => string,
-): string {
- if (resolveLabel) return resolveLabel(status);
- if (isBuiltInIssueStatus(status)) {
- return t(($) => $.status[status]);
- }
- return status;
-}
-
-function formatActivity(
- entry: TimelineEntry,
- t: ActivityT,
- locale: string,
- resolveActorName?: (type: string, id: string) => string,
- resolveStatusLabel?: (statusKey: string) => string,
- requesterName?: string,
-): string {
- const details = (entry.details ?? {}) as Record<string, string>;
- switch (entry.action) {
- case "created":
- if (requesterName && entry.actor_type === "agent") {
- return t(($) => $.activity.created_on_behalf_of, { name: requesterName });
- }
- return t(($) => $.activity.created);
- case "status_changed":
- // PR auto-complete (MUL-7429) says why the status moved.
- if (details.source === "pr_automation") {
- return t(($) => $.activity.status_changed_pr, {
- from: statusLabel(details.from ?? "?", t, resolveStatusLabel),
- to: statusLabel(details.to ?? "?", t, resolveStatusLabel),
- prs: details.pull_requests ?? "",
- });
- }
- return t(($) => $.activity.status_changed, {
- from: statusLabel(details.from ?? "?", t, resolveStatusLabel),
- to: statusLabel(details.to ?? "?", t, resolveStatusLabel),
- });
- case "pr_auto_complete_changed":
- return (entry.details as { disabled?: unknown } | undefined)?.disabled === true
- ? t(($) => $.activity.pr_auto_complete_disabled)
- : t(($) => $.activity.pr_auto_complete_enabled);
- case "priority_changed":
- return t(($) => $.activity.priority_changed, {
- from: priorityLabel(details.from ?? "?", t),
- to: priorityLabel(details.to ?? "?", t),
- });
- case "assignee_changed": {
- const isSelfAssign = details.to_type === entry.actor_type && details.to_id === entry.actor_id;
- if (isSelfAssign) return t(($) => $.activity.self_assigned);
- const toName = details.to_id && details.to_type && resolveActorName
- ? resolveActorName(details.to_type, details.to_id)
- : null;
- if (toName) return t(($) => $.activity.assigned_to, { name: toName });
- if (details.from_id && !details.to_id) return t(($) => $.activity.removed_assignee);
- return t(($) => $.activity.changed_assignee);
- }
- case "start_date_changed": {
- if (!details.to) return t(($) => $.activity.start_date_removed);
- const formatted = formatDateOnly(details.to, { month: "short", day: "numeric" }, locale);
- return t(($) => $.activity.start_date_set, { date: formatted });
- }
- case "due_date_changed": {
- if (!details.to) return t(($) => $.activity.due_date_removed);
- const formatted = formatDateOnly(details.to, { month: "short", day: "numeric" }, locale);
- return t(($) => $.activity.due_date_set, { date: formatted });
- }
- case "title_changed":
- return t(($) => $.activity.title_renamed, {
- from: details.from ?? "?",
- to: details.to ?? "?",
- });
- case "description_updated":
- return t(($) => $.activity.description_updated);
- case "duplicate_marked":
- return t(($) => $.activity.duplicate_marked, {
- identifier: details.original_identifier || "?",
- });
- case "duplicate_unmarked": {
- const identifier = details.original_identifier || "?";
- if (details.reason === "original_deleted") {
- return t(($) => $.activity.duplicate_unmarked_original_deleted, { identifier });
- }
- // The row stands in for the status row of the reopen, so it says where
- // the status went.
- if (details.to) {
- return t(($) => $.activity.duplicate_unmarked_to, {
- identifier,
- status: statusLabel(details.to, t, resolveStatusLabel),
- });
- }
- return t(($) => $.activity.duplicate_unmarked, { identifier });
- }
- case "duplicate_added":
- return t(($) => $.activity.duplicate_added, {
- identifier: details.duplicate_identifier || "?",
- });
- case "duplicate_removed":
- return t(($) => $.activity.duplicate_removed, {
- identifier: details.duplicate_identifier || "?",
- });
- case "task_completed": {
- const count = entry.coalesced_count ?? 1;
- return count === 1
- ? t(($) => $.activity.task_completed_single)
- : t(($) => $.activity.task_completed, { count });
- }
- case "task_failed": {
- const count = entry.coalesced_count ?? 1;
- return count === 1
- ? t(($) => $.activity.task_failed_single)
- : t(($) => $.activity.task_failed, { count });
- }
- case "squad_leader_evaluated": {
- const reason = details.reason?.trim();
- switch (details.outcome) {
- case "action":
- return reason
- ? t(($) => $.activity.squad_leader_action_reason, { reason })
- : t(($) => $.activity.squad_leader_action);
- case "no_action":
- return reason
- ? t(($) => $.activity.squad_leader_no_action_reason, { reason })
- : t(($) => $.activity.squad_leader_no_action);
- case "failed":
- return reason
- ? t(($) => $.activity.squad_leader_failed_reason, { reason })
- : t(($) => $.activity.squad_leader_failed);
- default:
- return t(($) => $.activity.squad_leader_evaluated);
- }
- }
- case "environment_controlled": {
- const name = details.label || details.name || "?";
- switch (details.action) {
- case "stop":
- return t(($) => $.activity.environment_stopped, { name });
- case "restart":
- return t(($) => $.activity.environment_restarted, { name });
- default:
- return t(($) => $.activity.environment_started, { name });
- }
- }
- default:
- return entry.action ?? "";
- }
-}
-
/**
* The issue a duplicate-mark activity (MUL-7349) names, when it can still be
* opened. A mark removed because its original was deleted has nowhere to
diff --git a/packages/views/layout/object-page.test.tsx b/packages/views/layout/object-page.test.tsx
index 4f6a0b242f..c8e25b53aa 100644
--- a/packages/views/layout/object-page.test.tsx
+++ b/packages/views/layout/object-page.test.tsx
@@ -104,6 +104,28 @@ describe("ObjectPage", () => {
});
});
+describe("ObjectSection collapsible", () => {
+ it("folds its content and action away from the title, keeping the content mounted", async () => {
+ renderWithI18n(
+ <ObjectSection collapsible title="Description" action={<button type="button">Hint</button>}>
+ <p>Agent context</p>
+ </ObjectSection>,
+ );
+ const toggle = screen.getByRole("button", { name: "Description" });
+ expect(toggle).toHaveAttribute("aria-expanded", "true");
+ expect(screen.getByText("Agent context")).toBeVisible();
+
+ await userEvent.click(toggle);
+ expect(toggle).toHaveAttribute("aria-expanded", "false");
+ expect(screen.getByText("Agent context")).not.toBeVisible();
+ expect(screen.queryByRole("button", { name: "Hint" })).not.toBeInTheDocument();
+ expect(screen.getByRole("heading", { name: "Description" })).toBeInTheDocument();
+
+ await userEvent.click(toggle);
+ expect(screen.getByText("Agent context")).toBeVisible();
+ });
+});
+
describe("ObjectProperty label", () => {
afterEach(() => {
vi.useRealTimers();
diff --git a/packages/views/layout/object-page.tsx b/packages/views/layout/object-page.tsx
index 23d44c0522..b9647f119e 100644
--- a/packages/views/layout/object-page.tsx
+++ b/packages/views/layout/object-page.tsx
@@ -267,23 +267,54 @@ export function ObjectSection({
action,
children,
className,
+ collapsible = false,
+ defaultOpen = true,
}: {
title: ReactNode;
count?: ReactNode;
action?: ReactNode;
children: ReactNode;
className?: string;
+ /** The title folds the section away, like a panel section; the action hides with it. */
+ collapsible?: boolean;
+ defaultOpen?: boolean;
}) {
+ const [stateOpen, setOpen] = useState(defaultOpen);
+ const open = !collapsible || stateOpen;
return (
<section className={cn("space-y-2", className)}>
<div className="flex h-7 items-center gap-2">
- <h2 className="text-body font-medium">{title}</h2>
+ <h2 className="text-body font-medium">
+ {collapsible ? (
+ <button
+ type="button"
+ aria-expanded={open}
+ className={cn(
+ "-ml-1.5 flex items-center gap-1 rounded-md px-1.5 py-0.5 transition-colors hover:bg-accent/70",
+ !open && "text-muted-foreground hover:text-foreground",
+ )}
+ onClick={() => setOpen(!open)}
+ >
+ {title}
+ <ChevronRight
+ aria-hidden="true"
+ className={cn(
+ "!size-3 shrink-0 stroke-[2.5] text-muted-foreground transition-transform motion-reduce:transition-none",
+ open && "rotate-90",
+ )}
+ />
+ </button>
+ ) : (
+ title
+ )}
+ </h2>
{count !== undefined && count !== null ? (
<span className="text-caption tabular-nums text-muted-foreground">{count}</span>
) : null}
- {action ? <div className="ml-auto flex items-center gap-1">{action}</div> : null}
+ {open && action ? <div className="ml-auto flex items-center gap-1">{action}</div> : null}
</div>
- {children}
+ {/* Folded content stays mounted, so an editor's unsaved draft survives. */}
+ {collapsible ? <div hidden={!open}>{children}</div> : children}
</section>
);
}
@@ -357,33 +388,39 @@ export function ObjectSectionEmpty({
/** A titled group in the properties panel, collapsible like the issue page's. */
export function ObjectPanelSection({
title,
+ action,
children,
defaultOpen = true,
}: {
title: ReactNode;
+ /** A quiet action at the right of the title (View all), shown while open. */
+ action?: ReactNode;
children: ReactNode;
defaultOpen?: boolean;
}) {
const [open, setOpen] = useState(defaultOpen);
return (
<div>
- <button
- type="button"
- aria-expanded={open}
- className={cn(
- "mb-2 flex w-full items-center gap-1 rounded-md px-2 py-1 text-caption font-medium transition-colors hover:bg-accent/70",
- !open && "text-muted-foreground hover:text-foreground",
- )}
- onClick={() => setOpen(!open)}
- >
- {title}
- <ChevronRight
+ <div className="mb-2 flex items-center gap-1">
+ <button
+ type="button"
+ aria-expanded={open}
className={cn(
- "!size-3 shrink-0 stroke-[2.5] text-muted-foreground transition-transform",
- open && "rotate-90",
+ "flex min-w-0 flex-1 items-center gap-1 rounded-md px-2 py-1 text-caption font-medium transition-colors hover:bg-accent/70",
+ !open && "text-muted-foreground hover:text-foreground",
)}
- />
- </button>
+ onClick={() => setOpen(!open)}
+ >
+ {title}
+ <ChevronRight
+ className={cn(
+ "!size-3 shrink-0 stroke-[2.5] text-muted-foreground transition-transform",
+ open && "rotate-90",
+ )}
+ />
+ </button>
+ {open && action ? <div className="flex shrink-0 items-center">{action}</div> : null}
+ </div>
{open ? <div className="space-y-0.5 pl-2">{children}</div> : null}
</div>
);
diff --git a/packages/views/locales/en/projects.json b/packages/views/locales/en/projects.json
index 02cd48fff5..2c368c7850 100644
--- a/packages/views/locales/en/projects.json
+++ b/packages/views/locales/en/projects.json
@@ -82,6 +82,8 @@
"copy_link": "Copy link",
"copy_title_as_link": "Copy link with title",
"delete_action": "Delete project",
+ "tab_overview": "Overview",
+ "tab_issues": "Issues",
"section_properties": "Properties",
"section_progress": "Progress",
"section_description": "Description",
@@ -123,7 +125,22 @@
"forecast_none": "Too few recent completions to forecast a finish date.",
"by_assignee": "By assignee",
"agent_tag": "Agent",
- "unassigned": "Unassigned"
+ "unassigned": "Unassigned",
+ "axis_assignee": "Assignee",
+ "axis_label": "Label",
+ "by_label": "By label",
+ "no_labels": "No issues yet.",
+ "unlabeled": "No label"
+ },
+ "tab_activity": "Activity",
+ "agent_context_badge": "Agent context",
+ "section_breakdown": "Breakdown",
+ "section_activity": "Recent activity",
+ "activity": {
+ "empty": "No activity on this project's issues yet.",
+ "load_more": "Load more",
+ "view_all": "View all",
+ "hint": "Status, assignee, priority and date changes across this project's issues."
}
},
"resources": {
diff --git a/packages/views/locales/es/projects.json b/packages/views/locales/es/projects.json
index 4939b7e440..23717fdf13 100644
--- a/packages/views/locales/es/projects.json
+++ b/packages/views/locales/es/projects.json
@@ -80,6 +80,8 @@
"copy_link": "Copiar enlace",
"copy_title_as_link": "Copiar enlace con título",
"delete_action": "Eliminar proyecto",
+ "tab_overview": "Resumen",
+ "tab_issues": "Tareas",
"section_properties": "Propiedades",
"section_progress": "Progreso",
"section_description": "Descripción",
@@ -123,7 +125,22 @@
"forecast_none": "Hay muy pocas tareas completadas recientemente para prever una fecha de fin.",
"by_assignee": "Por responsable",
"agent_tag": "Agente",
- "unassigned": "Sin asignar"
+ "unassigned": "Sin asignar",
+ "axis_assignee": "Responsable",
+ "axis_label": "Etiqueta",
+ "by_label": "Por etiqueta",
+ "no_labels": "Aún no hay incidencias.",
+ "unlabeled": "Sin etiqueta"
+ },
+ "tab_activity": "Actividad",
+ "agent_context_badge": "Contexto del agente",
+ "section_breakdown": "Desglose",
+ "section_activity": "Actividad reciente",
+ "activity": {
+ "empty": "Las incidencias de este proyecto aún no tienen actividad.",
+ "load_more": "Cargar más",
+ "view_all": "Ver todo",
+ "hint": "Cambios de estado, responsable, prioridad y fechas en las incidencias de este proyecto."
}
},
"resources": {
diff --git a/packages/views/locales/fr/projects.json b/packages/views/locales/fr/projects.json
index c72afba911..05bbc610d6 100644
--- a/packages/views/locales/fr/projects.json
+++ b/packages/views/locales/fr/projects.json
@@ -82,6 +82,8 @@
"copy_link": "Copier le lien",
"copy_title_as_link": "Copier le lien avec le titre",
"delete_action": "Supprimer le projet",
+ "tab_overview": "Aperçu",
+ "tab_issues": "Tâches",
"section_properties": "Propriétés",
"section_progress": "Avancement",
"section_description": "Description",
@@ -123,7 +125,22 @@
"forecast_none": "Trop peu de tâches terminées récemment pour prévoir une date de fin.",
"by_assignee": "Par responsable",
"agent_tag": "Agent",
- "unassigned": "Non assigné"
+ "unassigned": "Non assigné",
+ "axis_assignee": "Assigné",
+ "axis_label": "Étiquette",
+ "by_label": "Par étiquette",
+ "no_labels": "Aucun ticket pour l'instant.",
+ "unlabeled": "Sans étiquette"
+ },
+ "tab_activity": "Activité",
+ "agent_context_badge": "Contexte des agents",
+ "section_breakdown": "Répartition",
+ "section_activity": "Activité récente",
+ "activity": {
+ "empty": "Aucune activité sur les tickets de ce projet pour l'instant.",
+ "load_more": "Charger plus",
+ "view_all": "Tout voir",
+ "hint": "Changements de statut, d'assignation, de priorité et de dates sur les tickets de ce projet."
}
},
"resources": {
diff --git a/packages/views/locales/ja/projects.json b/packages/views/locales/ja/projects.json
index 6dacfefa19..3c5cac5327 100644
--- a/packages/views/locales/ja/projects.json
+++ b/packages/views/locales/ja/projects.json
@@ -82,6 +82,8 @@
"copy_link": "リンクをコピー",
"copy_title_as_link": "タイトル付きリンクをコピー",
"delete_action": "プロジェクトを削除",
+ "tab_overview": "概要",
+ "tab_issues": "タスク",
"section_properties": "プロパティ",
"section_progress": "進捗",
"section_description": "説明",
@@ -119,7 +121,22 @@
"forecast_none": "最近の完了が少ないため、完了日を予測できません。",
"by_assignee": "担当者別",
"agent_tag": "エージェント",
- "unassigned": "未割り当て"
+ "unassigned": "未割り当て",
+ "axis_assignee": "担当者",
+ "axis_label": "ラベル",
+ "by_label": "ラベル別",
+ "no_labels": "まだ課題がありません。",
+ "unlabeled": "ラベルなし"
+ },
+ "tab_activity": "アクティビティ",
+ "agent_context_badge": "エージェントのコンテキスト",
+ "section_breakdown": "内訳",
+ "section_activity": "最近のアクティビティ",
+ "activity": {
+ "empty": "このプロジェクトの課題にはまだアクティビティがありません。",
+ "load_more": "さらに読み込む",
+ "view_all": "すべて表示",
+ "hint": "このプロジェクトの課題のステータス、担当者、優先度、日付の変更。"
}
},
"resources": {
diff --git a/packages/views/locales/ko/projects.json b/packages/views/locales/ko/projects.json
index a8e5b32ccb..46c38846aa 100644
--- a/packages/views/locales/ko/projects.json
+++ b/packages/views/locales/ko/projects.json
@@ -82,6 +82,8 @@
"copy_link": "링크 복사",
"copy_title_as_link": "제목이 포함된 링크 복사",
"delete_action": "프로젝트 삭제",
+ "tab_overview": "개요",
+ "tab_issues": "태스크",
"section_properties": "속성",
"section_progress": "진행률",
"section_description": "설명",
@@ -119,7 +121,22 @@
"forecast_none": "최근 완료된 태스크가 적어 완료일을 예측할 수 없습니다.",
"by_assignee": "담당자별",
"agent_tag": "에이전트",
- "unassigned": "미배정"
+ "unassigned": "미배정",
+ "axis_assignee": "담당자",
+ "axis_label": "라벨",
+ "by_label": "라벨별",
+ "no_labels": "아직 이슈가 없습니다.",
+ "unlabeled": "라벨 없음"
+ },
+ "tab_activity": "활동",
+ "agent_context_badge": "에이전트 컨텍스트",
+ "section_breakdown": "분포",
+ "section_activity": "최근 활동",
+ "activity": {
+ "empty": "이 프로젝트의 이슈에 아직 활동이 없습니다.",
+ "load_more": "더 불러오기",
+ "view_all": "모두 보기",
+ "hint": "이 프로젝트 이슈의 상태, 담당자, 우선순위, 날짜 변경 내역입니다."
}
},
"resources": {
diff --git a/packages/views/locales/ru/projects.json b/packages/views/locales/ru/projects.json
index 177fb4d57c..61a76e691d 100644
--- a/packages/views/locales/ru/projects.json
+++ b/packages/views/locales/ru/projects.json
@@ -80,6 +80,8 @@
"copy_link": "Скопировать ссылку",
"copy_title_as_link": "Копировать ссылку с заголовком",
"delete_action": "Удалить проект",
+ "tab_overview": "Обзор",
+ "tab_issues": "Задачи",
"section_properties": "Свойства",
"section_progress": "Прогресс",
"section_description": "Описание",
@@ -131,7 +133,22 @@
"forecast_none": "Недавно завершённых задач слишком мало, чтобы спрогнозировать дату окончания.",
"by_assignee": "По исполнителям",
"agent_tag": "Агент",
- "unassigned": "Не назначено"
+ "unassigned": "Не назначено",
+ "axis_assignee": "Исполнитель",
+ "axis_label": "Метка",
+ "by_label": "По меткам",
+ "no_labels": "Задач пока нет.",
+ "unlabeled": "Без метки"
+ },
+ "tab_activity": "Активность",
+ "agent_context_badge": "Контекст для агентов",
+ "section_breakdown": "Распределение",
+ "section_activity": "Последние события",
+ "activity": {
+ "empty": "По задачам этого проекта пока нет событий.",
+ "load_more": "Загрузить ещё",
+ "view_all": "Показать все",
+ "hint": "Изменения статуса, исполнителя, приоритета и дат в задачах этого проекта."
}
},
"resources": {
diff --git a/packages/views/locales/zh-Hans/projects.json b/packages/views/locales/zh-Hans/projects.json
index 85019f2865..b91fe12dcf 100644
--- a/packages/views/locales/zh-Hans/projects.json
+++ b/packages/views/locales/zh-Hans/projects.json
@@ -82,6 +82,8 @@
"copy_link": "复制链接",
"copy_title_as_link": "复制带标题的链接",
"delete_action": "删除项目",
+ "tab_overview": "概览",
+ "tab_issues": "任务",
"section_properties": "属性",
"section_progress": "进度",
"section_description": "描述",
@@ -119,7 +121,22 @@
"forecast_none": "近期完成的任务太少,暂时无法预测完成日期。",
"by_assignee": "按负责人",
"agent_tag": "智能体",
- "unassigned": "未分配"
+ "unassigned": "未分配",
+ "axis_assignee": "负责人",
+ "axis_label": "标签",
+ "by_label": "按标签",
+ "no_labels": "还没有任务。",
+ "unlabeled": "无标签"
+ },
+ "tab_activity": "活动",
+ "agent_context_badge": "智能体上下文",
+ "section_breakdown": "分布",
+ "section_activity": "动态",
+ "activity": {
+ "empty": "这个项目的任务还没有动态。",
+ "load_more": "加载更多",
+ "view_all": "查看全部",
+ "hint": "项目内所有任务的状态、负责人、优先级和日期变化。"
}
},
"resources": {
diff --git a/packages/views/locales/zh-Hant/projects.json b/packages/views/locales/zh-Hant/projects.json
index 271287bcb0..eb74bbaa2f 100644
--- a/packages/views/locales/zh-Hant/projects.json
+++ b/packages/views/locales/zh-Hant/projects.json
@@ -82,6 +82,8 @@
"copy_link": "複製連結",
"copy_title_as_link": "複製帶標題的連結",
"delete_action": "刪除專案",
+ "tab_overview": "概覽",
+ "tab_issues": "任務",
"section_properties": "屬性",
"section_progress": "進度",
"section_description": "描述",
@@ -119,7 +121,22 @@
"forecast_none": "近期完成的任務太少,暫時無法預測完成日期。",
"by_assignee": "按負責人",
"agent_tag": "AI 代理",
- "unassigned": "未指派"
+ "unassigned": "未指派",
+ "axis_assignee": "負責人",
+ "axis_label": "標籤",
+ "by_label": "按標籤",
+ "no_labels": "還沒有任務。",
+ "unlabeled": "無標籤"
+ },
+ "tab_activity": "活動",
+ "agent_context_badge": "智慧體上下文",
+ "section_breakdown": "分佈",
+ "section_activity": "動態",
+ "activity": {
+ "empty": "這個專案的任務還沒有動態。",
+ "load_more": "載入更多",
+ "view_all": "查看全部",
+ "hint": "專案內所有任務的狀態、負責人、優先級和日期變化。"
}
},
"resources": {
diff --git a/packages/views/projects/components/project-access.tsx b/packages/views/projects/components/project-access.tsx
index cb3a04de2c..623bf2b495 100644
--- a/packages/views/projects/components/project-access.tsx
+++ b/packages/views/projects/components/project-access.tsx
@@ -132,7 +132,7 @@ export function ProjectAccessControl({ project }: { project: Project }) {
const Icon = project.visibility === "private" ? Lock : Globe;
return (
<Dialog open={open} onOpenChange={(value) => { if (!changeAccess.isPending) setOpen(value); }}>
- <DialogTrigger render={<Button type="button" variant="ghost" size="sm" className="h-auto min-h-7 max-w-full justify-start px-0" aria-label={t(($) => $.access.label)}><Icon /><span className="truncate">{project.visibility === "private" ? t(($) => $.access.private) : t(($) => $.access.workspace)}</span></Button>} />
+ <DialogTrigger render={<Button type="button" variant="ghost" size="sm" className="h-auto min-h-7 max-w-full justify-start gap-1.5 px-0 text-caption font-normal hover:bg-transparent dark:hover:bg-transparent" aria-label={t(($) => $.access.label)}><Icon className="size-3.5 text-muted-foreground" /><span className="truncate">{project.visibility === "private" ? t(($) => $.access.private) : t(($) => $.access.workspace)}</span></Button>} />
<DialogContent className="flex max-h-[90%] flex-col sm:max-w-lg">
<DialogHeader><DialogTitle>{t(($) => $.access.title, { title: project.title })}</DialogTitle><DialogDescription>{t(($) => $.access.description)}</DialogDescription></DialogHeader>
{open ? <ProjectAccessEditor project={project} onClose={() => setOpen(false)} changeAccess={changeAccess} /> : null}
diff --git a/packages/views/projects/components/project-activity.tsx b/packages/views/projects/components/project-activity.tsx
new file mode 100644
index 0000000000..16015115cd
--- /dev/null
+++ b/packages/views/projects/components/project-activity.tsx
@@ -0,0 +1,132 @@
+"use client";
+
+import { useInfiniteQuery } from "@tanstack/react-query";
+import { Button } from "@multica/ui/components/ui/button";
+import { Skeleton } from "@multica/ui/components/ui/skeleton";
+import { cn } from "@multica/ui/lib/utils";
+import type { ProjectActivityEntry } from "@multica/core/types";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { issueRouteRef, useWorkspacePaths } from "@multica/core/paths";
+import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
+import { projectActivityOptions } from "@multica/core/projects/queries";
+import { useActorName } from "@multica/core/workspace/hooks";
+import { ActorAvatar } from "../../common/actor-avatar";
+import { AppLink } from "../../navigation";
+import { formatActivity } from "../../issues/components/activity-text";
+import { StatusIcon } from "../../issues/components/status-icon";
+import { useStatusLabel } from "../../issues/utils/status-label";
+import { useLocale, useT, useTimeAgo } from "../../i18n";
+
+function useProjectActivity(projectId: string) {
+ const wsId = useWorkspaceId();
+ return useInfiniteQuery(projectActivityOptions(wsId, projectId));
+}
+
+/** What changed on this project's issues, newest first. */
+export function ProjectActivityFeed({
+ projectId,
+ limit,
+ dense = false,
+}: {
+ projectId: string;
+ /** Show only the newest entries, without paging (the sidebar's digest). */
+ limit?: number;
+ dense?: boolean;
+}) {
+ const { t } = useT("projects");
+ const { data, isPending, hasNextPage, fetchNextPage, isFetchingNextPage } = useProjectActivity(projectId);
+
+ if (isPending) {
+ return (
+ <div className="space-y-2">
+ {Array.from({ length: limit ?? 4 }, (_, i) => (
+ <Skeleton key={i} className="h-8 w-full" />
+ ))}
+ </div>
+ );
+ }
+
+ const all = data?.pages.flatMap((page) => page.entries) ?? [];
+ const entries = limit ? all.slice(0, limit) : all;
+ if (entries.length === 0) {
+ return <p className="text-caption text-muted-foreground">{t(($) => $.detail.activity.empty)}</p>;
+ }
+
+ return (
+ <div>
+ <ol className={cn("flex flex-col", dense ? "gap-2.5" : "gap-4")} data-testid="project-activity">
+ {entries.map((entry) => (
+ <ActivityRow key={entry.id} entry={entry} dense={dense} />
+ ))}
+ </ol>
+ {!limit && hasNextPage && (
+ <Button
+ variant="ghost"
+ size="sm"
+ className="mt-4 text-muted-foreground"
+ disabled={isFetchingNextPage}
+ onClick={() => void fetchNextPage()}
+ >
+ {t(($) => $.detail.activity.load_more)}
+ </Button>
+ )}
+ </div>
+ );
+}
+
+function ActivityRow({ entry, dense }: { entry: ProjectActivityEntry; dense: boolean }) {
+ const { t } = useT("issues");
+ const locale = useLocale();
+ const wsId = useWorkspaceId();
+ const paths = useWorkspacePaths();
+ const timeAgo = useTimeAgo();
+ const { getActorName } = useActorName();
+ const resolveStatusLabel = useStatusLabel(wsId);
+ const statuses = useIssueStatuses(wsId);
+ const actor = getActorName(entry.actor_type, entry.actor_id);
+ const text = formatActivity(entry, t, locale, getActorName, resolveStatusLabel);
+
+ return (
+ <li className="flex gap-2.5">
+ <ActorAvatar actorType={entry.actor_type} actorId={entry.actor_id} size="sm" />
+ <div className="min-w-0 flex-1">
+ <p className={cn("text-muted-foreground", dense ? "text-caption" : "text-body")}>
+ <span className="font-medium text-foreground">{actor}</span> {text}
+ </p>
+ <div className="mt-0.5 flex min-w-0 items-center gap-1.5 text-caption text-muted-foreground">
+ <AppLink
+ href={paths.issueDetail(issueRouteRef({ id: entry.issue_id, identifier: entry.issue_identifier }))}
+ className="flex min-w-0 items-center gap-1.5 hover:text-foreground"
+ >
+ <StatusIcon
+ status={entry.issue_status}
+ category={statuses.categoryOf(entry.issue_status)}
+ color={statuses.colorOf(entry.issue_status)}
+ icon={statuses.iconOf(entry.issue_status)}
+ className="size-3.5 shrink-0"
+ />
+ <span className="shrink-0 tabular-nums">{entry.issue_identifier}</span>
+ <span className="min-w-0 truncate">{entry.issue_title}</span>
+ </AppLink>
+ <span className="ml-auto shrink-0 tabular-nums" title={new Date(entry.created_at).toLocaleString(locale)}>
+ {timeAgo(entry.created_at)}
+ </span>
+ </div>
+ </div>
+ </li>
+ );
+}
+
+/** The Activity tab: the project's full issue history as one readable column. */
+export function ProjectActivityPage({ projectId }: { projectId: string }) {
+ const { t } = useT("projects");
+ return (
+ <div className="min-h-0 flex-1 overflow-y-auto">
+ <div className="mx-auto w-full max-w-3xl px-8 pb-16 pt-8">
+ <h2 className="text-label font-medium">{t(($) => $.detail.tab_activity)}</h2>
+ <p className="mb-6 mt-1 text-caption text-muted-foreground">{t(($) => $.detail.activity.hint)}</p>
+ <ProjectActivityFeed projectId={projectId} />
+ </div>
+ </div>
+ );
+}
diff --git a/packages/views/projects/components/project-detail.test.tsx b/packages/views/projects/components/project-detail.test.tsx
index f8c1f6c54b..7028d414b7 100644
--- a/packages/views/projects/components/project-detail.test.tsx
+++ b/packages/views/projects/components/project-detail.test.tsx
@@ -10,6 +10,8 @@ import userEvent from "@testing-library/user-event";
import type { Project } from "@multica/core/types";
import { renderWithI18n } from "../../test/i18n";
import { NavigationProvider, type NavigationAdapter } from "../../navigation";
+import { useProjectTabStore } from "@multica/core/projects/tab-store";
+import { getIssueSurfaceViewStore, useIssuesScopeStore } from "@multica/core/issues/stores";
import { ProjectDetail } from "./project-detail";
const mocks = vi.hoisted(() => ({
@@ -22,6 +24,7 @@ const mocks = vi.hoisted(() => ({
setProjectSubscription: vi.fn(),
getShareableUrl: vi.fn((path: string) => `https://app.example${path}`),
push: vi.fn(),
+ replace: vi.fn(),
recordVisit: vi.fn(),
toastSuccess: vi.fn(),
toastError: vi.fn(),
@@ -169,6 +172,22 @@ vi.mock("./project-resources-section", () => ({
ProjectResourcesSection: () => null,
}));
+vi.mock("./project-insights", () => ({
+ ProjectInsights: ({ onFilter, onShowActivity }: {
+ onFilter: (filter: unknown) => void;
+ onShowActivity: () => void;
+ }) => (
+ <div data-testid="project-insights">
+ <button type="button" onClick={() => onFilter({ kind: "label", id: "label-1" })}>Filter by Design</button>
+ <button type="button" onClick={onShowActivity}>View all activity</button>
+ </div>
+ ),
+}));
+
+vi.mock("./project-activity", () => ({
+ ProjectActivityPage: () => <div data-testid="project-activity-page" />,
+}));
+
vi.mock("./project-start-date-picker", () => ({
ProjectStartDatePicker: () => null,
}));
@@ -188,13 +207,16 @@ vi.mock("../../issues/surface/issue-surface", () => ({
vi.mock("../../issue-views/view-header", () => ({
IssueViewHeader: ({
baseMenu,
+ afterTitle,
trailing,
}: {
baseMenu?: React.ReactNode;
+ afterTitle?: React.ReactNode;
trailing?: React.ReactNode;
}) => (
- <header>
+ <header data-testid="issue-view-header">
{baseMenu}
+ {afterTitle}
{trailing}
</header>
),
@@ -245,14 +267,14 @@ function deferred() {
return { promise, resolve, reject };
}
-function renderProjectDetail() {
+function renderProjectDetail(search = "") {
qc.setQueryData(["members"], [{ user_id: "user-1", name: "User One", role: mocks.role }]);
const adapter: NavigationAdapter = {
push: mocks.push,
- replace: vi.fn(),
+ replace: mocks.replace,
back: vi.fn(),
pathname: "/test-workspace/projects/project-1",
- searchParams: new URLSearchParams(),
+ searchParams: new URLSearchParams(search),
hash: "",
getShareableUrl: mocks.getShareableUrl,
};
@@ -287,6 +309,8 @@ beforeEach(() => {
} as unknown as ApiClient);
mocks.getShareableUrl.mockClear();
mocks.push.mockReset();
+ mocks.replace.mockReset();
+ useProjectTabStore.setState({ lastTab: {} });
mocks.recordVisit.mockReset();
mocks.toastSuccess.mockReset();
mocks.toastError.mockReset();
@@ -298,6 +322,81 @@ afterEach(() => {
useModalStore.getState().close();
});
+describe("ProjectDetail tabs", () => {
+ it("opens on Overview, with the title and description in the page and not the sidebar", () => {
+ renderProjectDetail();
+ expect(screen.getByRole("tab", { name: "Overview" })).toHaveAttribute("aria-selected", "true");
+ expect(screen.getByRole("tab", { name: /Issues\s*3/ })).toBeInTheDocument();
+ expect(screen.queryByTestId("issue-view-header")).not.toBeInTheDocument();
+ expect(screen.getByRole("heading", { name: "Description" })).toBeInTheDocument();
+ expect(within(screen.getByRole("complementary")).queryByText("Description")).not.toBeInTheDocument();
+ });
+
+ it("opens the panel with the properties, above the insights", () => {
+ renderProjectDetail();
+ const sidebar = screen.getByRole("complementary");
+ const properties = within(sidebar).getByTestId("project-properties");
+ expect(within(properties).getByRole("button", { name: "No lead" })).toBeInTheDocument();
+ expect(within(sidebar).getByTestId("project-insights")).toBeInTheDocument();
+ expect(
+ properties.compareDocumentPosition(within(sidebar).getByTestId("project-insights")) &
+ Node.DOCUMENT_POSITION_FOLLOWING,
+ ).toBeTruthy();
+ });
+
+ it("shows the activity feed for ?tab=activity", async () => {
+ renderProjectDetail("tab=activity");
+ expect(screen.getByRole("tab", { name: "Activity" })).toHaveAttribute("aria-selected", "true");
+ expect(screen.getByTestId("project-activity-page")).toBeInTheDocument();
+ expect(screen.queryByRole("heading", { name: "Description" })).not.toBeInTheDocument();
+ expect(within(screen.getByRole("complementary")).getByTestId("project-properties")).toBeInTheDocument();
+ });
+
+ it("opens the Activity tab from the sidebar digest", async () => {
+ renderProjectDetail();
+ await userEvent.click(screen.getByRole("button", { name: "View all activity" }));
+ expect(mocks.replace).toHaveBeenCalledWith("/test-workspace/projects/project-1?tab=activity");
+ });
+
+ it("opens the Issues tab filtered to a breakdown row", async () => {
+ const store = getIssueSurfaceViewStore("project:project-1");
+ store.setState({ statusFilters: ["todo"] });
+ useIssuesScopeStore.getState().setScope("project:project-1", "members");
+ renderProjectDetail();
+ await userEvent.click(screen.getByRole("button", { name: "Filter by Design" }));
+ expect(store.getState().labelFilters).toEqual(["label-1"]);
+ expect(store.getState().statusFilters).toEqual([]);
+ expect(useIssuesScopeStore.getState().scopes["project:project-1"]).toBe("all");
+ expect(mocks.replace).toHaveBeenCalledWith("/test-workspace/projects/project-1?tab=issues");
+ store.getState().clearFilters();
+ });
+
+ it("shows the issue views for ?tab=issues and remembers that choice", () => {
+ renderProjectDetail("tab=issues");
+ expect(screen.getByTestId("issue-view-header")).toBeInTheDocument();
+ expect(screen.getByRole("tab", { name: /Issues/ })).toHaveAttribute("aria-selected", "true");
+ expect(useProjectTabStore.getState().lastTab["project-1"]).toBe("issues");
+ });
+
+ it("switches tabs through the URL", async () => {
+ renderProjectDetail();
+ await userEvent.click(screen.getByRole("tab", { name: /Issues/ }));
+ expect(mocks.replace).toHaveBeenCalledWith("/test-workspace/projects/project-1?tab=issues");
+ expect(useProjectTabStore.getState().lastTab["project-1"]).toBe("issues");
+ });
+
+ it("reopens on the remembered tab unless the project has no issues", () => {
+ useProjectTabStore.setState({ lastTab: { "project-1": "issues" } });
+ const { unmount } = renderProjectDetail();
+ expect(screen.getByTestId("issue-view-header")).toBeInTheDocument();
+ unmount();
+
+ qc.setQueryData(projectKeys.detail("workspace-1", PROJECT.id), { ...PROJECT, issue_count: 0, done_count: 0 });
+ renderProjectDetail();
+ expect(screen.queryByTestId("issue-view-header")).not.toBeInTheDocument();
+ });
+});
+
describe("ProjectDetail rename", () => {
it("opens the rename dialog with the current name from the header menu", async () => {
const user = userEvent.setup();
diff --git a/packages/views/projects/components/project-detail.tsx b/packages/views/projects/components/project-detail.tsx
index 139cb02437..0942d420b4 100644
--- a/packages/views/projects/components/project-detail.tsx
+++ b/packages/views/projects/components/project-detail.tsx
@@ -3,13 +3,13 @@
import { useMemo, useState, useCallback, useRef, useEffect } from "react";
import { useRegisterCommandBarContext } from "../../search/register-context";
import { useDefaultLayout, usePanelRef } from "react-resizable-panels";
-import { Archive, ArchiveRestore, BellOff, BellRing, Check, ChevronRight, FileQuestion, Link2, PanelRight, Pencil, Pin, PinOff, Trash2, Type } from "@multica/ui/icons";
+import { Archive, ArchiveRestore, BellOff, BellRing, FileQuestion, Link2, PanelRight, Pencil, Pin, PinOff, Trash2, Type } from "@multica/ui/icons";
import { useQuery } from "@tanstack/react-query";
import { cn } from "@multica/ui/lib/utils";
import { copyText, copyTextAndHtml } from "@multica/ui/lib/clipboard";
import { toast } from "sonner";
import { isFeatureLockedError } from "@multica/core/billing";
-import type { Project, ProjectStatus, ProjectPriority } from "@multica/core/types";
+import type { ProjectStatus } from "@multica/core/types";
import { useAuthStore } from "@multica/core/auth";
import { canDeleteProject } from "@multica/core/projects/deletion-permissions";
import { projectDetailOptions, projectSubscriptionOptions } from "@multica/core/projects/queries";
@@ -23,46 +23,37 @@ import { useWorkspaceId } from "@multica/core/hooks";
import { useIssuesScope } from "@multica/core/issues/stores";
import { useRecentContextStore } from "@multica/core/chat";
import { useWorkspacePaths } from "@multica/core/paths";
-import { useActorName } from "@multica/core/workspace/hooks";
-import { PROJECT_STATUS_ORDER, PROJECT_STATUS_CONFIG, PROJECT_PRIORITY_ORDER } from "@multica/core/projects/config";
-import { ProjectProgressSection } from "./project-progress-section";
-import { ActorAvatar } from "../../common/actor-avatar";
+import type { BreakdownFilter } from "./project-progress-section";
+import { ProjectInsights } from "./project-insights";
+import { ProjectPropertiesPanel } from "./project-properties";
+import { ProjectActivityPage } from "./project-activity";
+import { getIssueSurfaceViewStore, useIssuesScopeStore } from "@multica/core/issues/stores";
+import { issueScopeKey } from "@multica/core/issues/surface/scope";
+import { ProjectOverviewBody, ProjectOverviewHeader, ProjectTabs } from "./project-overview";
+import {
+ defaultProjectTab,
+ isProjectTab,
+ useProjectTabStore,
+ type ProjectTab,
+} from "@multica/core/projects/tab-store";
import { AppLink, currentPath, useNavigation } from "../../navigation";
-import { TitleEditor, ContentEditor, type ContentEditorRef } from "../../editor";
-import { PriorityIcon } from "../../issues/components/priority-icon";
-import { ProjectResourcesSection } from "./project-resources-section";
-import { ProjectStartDatePicker } from "./project-start-date-picker";
-import { ProjectDueDatePicker } from "./project-due-date-picker";
import { usePaidFeatureErrorMessage } from "../../billing";
-import { ProjectAccessControl } from "./project-access";
-import { ProjectLeadPicker } from "./project-lead-picker";
-import { ProjectWorkflowControl } from "../../workflows/project-workflow-row";
import { ProjectWorkflowMenuItem, ProjectWorkflowSheet } from "../../workflows/project-workflow-sheet";
import { IssueSurface } from "../../issues/surface/issue-surface";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
import { Button, buttonVariants } from "@multica/ui/components/ui/button";
-import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "@multica/ui/components/ui/resizable";
import { Sheet, SheetContent } from "@multica/ui/components/ui/sheet";
import { useIsMobile } from "@multica/ui/hooks/use-mobile";
import {
- DropdownMenu,
- DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
- DropdownMenuTrigger,
} from "@multica/ui/components/ui/dropdown-menu";
-import {
- Popover,
- PopoverTrigger,
- PopoverContent,
-} from "@multica/ui/components/ui/popover";
import {
Tooltip,
TooltipTrigger,
TooltipContent,
} from "@multica/ui/components/ui/tooltip";
-import { EmojiPicker } from "@multica/ui/components/common/emoji-picker";
import { IssueViewHeader } from "../../issue-views/view-header";
import {
AnimatedRightSidebar,
@@ -84,7 +75,6 @@ import {
} from "@multica/ui/components/ui/alert-dialog";
import { useT } from "../../i18n";
import { titleLinkPayload } from "../../common/title-link";
-import { useProjectStatusLabels, useProjectPriorityLabels, useFormatRelativeDate } from "./labels";
import {
ArchivedProjectNotice,
ArchivedProjectTag,
@@ -94,41 +84,10 @@ import {
} from "./project-archive";
import { PAGE_GUTTER } from "../../layout/page-header";
-// Property row — sidebar property display
-
-function PropRow({
- label,
- children,
-}: {
- label: string;
- children: React.ReactNode;
-}) {
- return (
- <div className="flex min-h-8 items-center gap-2 rounded-md px-2 -mx-2 hover:bg-accent/50 transition-colors">
- <span className="w-16 shrink-0 text-caption text-muted-foreground">{label}</span>
- <div className="flex min-w-0 flex-1 items-center gap-1.5 text-caption truncate">
- {children}
- </div>
- </div>
- );
-}
-
-// The project's workflow (MUL-7420).
-function ProjectWorkflowPropRow({ project, onOpen }: { project: Project; onOpen: () => void }) {
- const { t } = useT("issues");
- return (
- <PropRow label={t(($) => $.workflows.project.label)}>
- <ProjectWorkflowControl project={project} onOpen={onOpen} />
- </PropRow>
- );
-}
-
// ProjectDetail
export function ProjectDetail({ projectId }: { projectId: string }) {
const { t } = useT("projects");
- const statusLabels = useProjectStatusLabels();
- const priorityLabels = useProjectPriorityLabels();
const wsId = useWorkspaceId();
const wsPaths = useWorkspacePaths();
const router = useNavigation();
@@ -138,7 +97,6 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
const { requestArchive, dialog: archiveDialog } = useArchiveProjects();
const restore = useRestoreProjects();
const offerArchive = useOfferArchiveOnComplete();
- const formatRelativeDate = useFormatRelativeDate();
const { data: project, isLoading } = useQuery({
...projectDetailOptions(wsId, projectId),
enabled: !deleted,
@@ -166,7 +124,6 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
);
const { data: members = [] } = useQuery(memberListOptions(wsId));
const { data: agents = [] } = useQuery(agentListOptions(wsId));
- const { getActorName } = useActorName();
const updateProject = useUpdateProject();
const paidFeatureError = usePaidFeatureErrorMessage();
const deleting = deleteProject.isPending;
@@ -195,13 +152,29 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
},
);
};
- const descEditorRef = useRef<ContentEditorRef>(null);
const isMobile = useIsMobile();
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
- const [iconPickerOpen, setIconPickerOpen] = useState(false);
- const [propertiesOpen, setPropertiesOpen] = useState(true);
- const [progressOpen, setProgressOpen] = useState(true);
- const [descriptionOpen, setDescriptionOpen] = useState(true);
+
+ // Overview / Issues. An explicit ?tab= wins and is remembered; otherwise the
+ // project opens on the tab this person last left it on.
+ const tabParam = router.searchParams.get("tab");
+ const rememberedTab = useProjectTabStore((s) => s.lastTab[projectId]);
+ const rememberTab = useProjectTabStore((s) => s.remember);
+ const tab: ProjectTab = isProjectTab(tabParam)
+ ? tabParam
+ : defaultProjectTab(rememberedTab, project?.issue_count ?? 0);
+ useEffect(() => {
+ if (isProjectTab(tabParam)) rememberTab(projectId, tabParam);
+ }, [projectId, tabParam, rememberTab]);
+ const handleTabChange = useCallback(
+ (next: ProjectTab) => {
+ rememberTab(projectId, next);
+ const params = new URLSearchParams(router.searchParams);
+ params.set("tab", next);
+ router.replace(`${router.pathname}?${params.toString()}`);
+ },
+ [projectId, rememberTab, router],
+ );
// Sidebar panel
const { defaultLayout, onLayoutChanged } = useDefaultLayout({
@@ -280,6 +253,27 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
[project, handleUpdateField, offerArchive],
);
+ // A breakdown row opens the Issues tab showing just that slice.
+ const showFilteredIssues = useCallback(
+ (filter: BreakdownFilter) => {
+ // Any slice lands on the All tab: Members or Agents would hide half of
+ // them, and each tab keeps its own filters.
+ useIssuesScopeStore.getState().setScope(`project:${projectId}`, "all");
+ const store = getIssueSurfaceViewStore(issueScopeKey({ type: "project", projectId, actorKind: "all" }));
+ store.getState().clearFilters();
+ if (filter.kind === "assignee") {
+ store.setState({ assigneeFilters: [{ type: filter.type, id: filter.id }] });
+ } else if (filter.kind === "unassigned") {
+ store.setState({ includeNoAssignee: true });
+ } else {
+ store.setState({ labelFilters: [filter.id] });
+ }
+ setMobileSidebarOpen(false);
+ handleTabChange("issues");
+ },
+ [projectId, handleTabChange],
+ );
+
const handleDelete = useCallback(() => {
if (!project || deleteProject.isPending) return;
deleteProject.mutate(project.id, {
@@ -329,186 +323,127 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
}
const archived = !!project.archived_at;
- const statusCfg = PROJECT_STATUS_CONFIG[project.status];
const sidebarContent = (
<div className="space-y-5">
- {/* Icon + Title */}
- <div>
- <Popover open={iconPickerOpen} onOpenChange={setIconPickerOpen}>
- <TooltipHint label={t(($) => $.detail.icon_tooltip)}>
- <PopoverTrigger
- render={
- <button
- type="button"
- className="text-display-sm cursor-pointer rounded-lg p-1 -ml-1 hover:bg-accent/60 transition-colors"
- aria-label={t(($) => $.detail.icon_tooltip)}
- >
- {project.icon || "📁"}
- </button>
- }
- />
- </TooltipHint>
- <PopoverContent align="start" className="w-auto p-0">
- <EmojiPicker
- onSelect={(emoji) => {
- handleUpdateField({ icon: emoji });
- setIconPickerOpen(false);
- }}
- />
- </PopoverContent>
- </Popover>
- <TitleEditor
- key={`title-${projectId}`}
- defaultValue={project.title}
- placeholder={t(($) => $.detail.title_placeholder)}
- className="mt-2 w-full text-title-sm font-semibold leading-snug tracking-tight"
- onBlur={(value) => {
- const trimmed = value.trim();
- if (trimmed && trimmed !== project.title) handleUpdateField({ title: trimmed });
- }}
- />
- </div>
-
- {/* Properties */}
- <div>
- <button
- type="button"
- className={`flex w-full items-center gap-1 rounded-md px-2 py-1 text-caption font-medium transition-colors mb-2 hover:bg-accent/70 ${propertiesOpen ? "" : "text-muted-foreground hover:text-foreground"}`}
- onClick={() => setPropertiesOpen(!propertiesOpen)}
- >
- {t(($) => $.detail.section_properties)}
- <ChevronRight className={`!size-3 shrink-0 stroke-[2.5] text-muted-foreground transition-transform ${propertiesOpen ? "rotate-90" : ""}`} />
- </button>
- {propertiesOpen && <div className="space-y-0.5 pl-2">
- <PropRow label={t(($) => $.table.status)}>
- <DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button type="button" className="inline-flex items-center gap-1.5 text-caption hover:text-foreground transition-colors">
- <span className={cn("size-2 rounded-full", statusCfg.dotColor)} />
- <span>{statusLabels[project.status]}</span>
- </button>
- }
- />
- <DropdownMenuContent align="start" className="w-44">
- {PROJECT_STATUS_ORDER.map((s) => (
- <DropdownMenuItem key={s} onClick={() => handleStatusChange(s as ProjectStatus)}>
- <span className={cn("size-2 rounded-full", PROJECT_STATUS_CONFIG[s].dotColor)} />
- <span>{statusLabels[s]}</span>
- {s === project.status && <Check className="ml-auto h-3.5 w-3.5" />}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- </PropRow>
- <PropRow label={t(($) => $.table.priority)}>
- <DropdownMenu>
- <DropdownMenuTrigger
- render={
- <button type="button" className="inline-flex items-center gap-1.5 text-caption hover:text-foreground transition-colors">
- <PriorityIcon priority={project.priority} />
- <span>{priorityLabels[project.priority]}</span>
- </button>
- }
- />
- <DropdownMenuContent align="start" className="w-44">
- {PROJECT_PRIORITY_ORDER.map((p) => (
- <DropdownMenuItem key={p} onClick={() => handleUpdateField({ priority: p as ProjectPriority })}>
- <PriorityIcon priority={p} />
- <span>{priorityLabels[p]}</span>
- {p === project.priority && <Check className="ml-auto h-3.5 w-3.5" />}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- </PropRow>
- {<PropRow label={t(($) => $.access.label)}>
- <ProjectAccessControl project={project} />
- </PropRow>}
- <PropRow label={t(($) => $.table.lead)}>
- <ProjectLeadPicker
- project={project}
- handleUpdate={handleUpdateField}
- renderTrigger={(leadName) => (
- <button type="button" className="inline-flex items-center gap-1.5 text-caption hover:text-foreground transition-colors">
- {project.lead_type && project.lead_id ? (
- <>
- <ActorAvatar actorType={project.lead_type} actorId={project.lead_id} size="sm" enableHoverCard showStatusDot />
- <span className="cursor-pointer">{leadName}</span>
- </>
- ) : (
- <span className="text-muted-foreground">{t(($) => $.lead.no_lead)}</span>
- )}
- </button>
- )}
- />
- </PropRow>
- <PropRow label={t(($) => $.detail.prop_start_date)}>
- <ProjectStartDatePicker startDate={project.start_date} onUpdate={handleUpdateField} />
- </PropRow>
- <PropRow label={t(($) => $.detail.prop_due_date)}>
- <ProjectDueDatePicker dueDate={project.due_date} onUpdate={handleUpdateField} />
- </PropRow>
- <ProjectWorkflowPropRow project={project} onOpen={openWorkflowSheet} />
- {archived && (
- <PropRow label={t(($) => $.archive.prop_label)}>
- <span className="tabular-nums">{formatRelativeDate(project.archived_at!)}</span>
- {project.archived_by_type && project.archived_by_id && (
- <>
- <span className="text-muted-foreground">·</span>
- <ActorAvatar actorType={project.archived_by_type} actorId={project.archived_by_id} size="sm" enableHoverCard />
- <span className="truncate">{getActorName(project.archived_by_type, project.archived_by_id)}</span>
- </>
- )}
- </PropRow>
- )}
- </div>}
- </div>
+ <ProjectPropertiesPanel
+ project={project}
+ onUpdate={handleUpdateField}
+ onStatusChange={handleStatusChange}
+ onOpenWorkflow={openWorkflowSheet}
+ />
+ <ProjectInsights
+ project={project}
+ onFilter={showFilteredIssues}
+ onShowActivity={() => {
+ setMobileSidebarOpen(false);
+ handleTabChange("activity");
+ }}
+ />
+ </div>
+ );
- {/* Progress */}
- <div>
- <button
- type="button"
- className={`flex w-full items-center gap-1 rounded-md px-2 py-1 text-caption font-medium transition-colors mb-2 hover:bg-accent/70 ${progressOpen ? "" : "text-muted-foreground hover:text-foreground"}`}
- onClick={() => setProgressOpen(!progressOpen)}
+ const projectMenu = (
+ <>
+ <DropdownMenuItem
+ onClick={() =>
+ useModalStore
+ .getState()
+ .open("project-rename", { projectId: project.id, title: project.title })
+ }
+ >
+ <Pencil className="h-3.5 w-3.5" />
+ {t(($) => $.detail.rename_action)}
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => {
+ void copyText(router.getShareableUrl(currentPath(router))).then((ok) => {
+ if (ok) toast.success(t(($) => $.detail.toast_link_copied));
+ });
+ }}>
+ <Link2 className="h-3.5 w-3.5" />
+ {t(($) => $.detail.copy_link)}
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => {
+ const { text, html } = titleLinkPayload(
+ project.title,
+ router.getShareableUrl(currentPath(router)),
+ );
+ void copyTextAndHtml(text, html).then((ok) => {
+ if (ok) {
+ toast.success(t(($) => $.detail.toast_title_link_copied));
+ } else {
+ toast.error(t(($) => $.detail.toast_title_link_copy_failed));
+ }
+ });
+ }}>
+ <Type className="h-3.5 w-3.5" />
+ {t(($) => $.detail.copy_title_as_link)}
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => {
+ if (isPinned) {
+ deletePinMut.mutate({ itemType: "project", itemId: projectId });
+ } else {
+ createPin.mutate({ item_type: "project", item_id: projectId });
+ }
+ }}>
+ {isPinned ? <PinOff className="h-3.5 w-3.5" /> : <Pin className="h-3.5 w-3.5" />}
+ {isPinned ? t(($) => $.detail.unpin_tooltip) : t(($) => $.detail.pin_tooltip)}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ disabled={setSubscription.isPending}
+ onClick={handleToggleSubscription}
+ >
+ {isSubscribed ? <BellOff className="h-3.5 w-3.5" /> : <BellRing className="h-3.5 w-3.5" />}
+ {isSubscribed ? t(($) => $.detail.unsubscribe_action) : t(($) => $.detail.subscribe_action)}
+ </DropdownMenuItem>
+ <ProjectWorkflowMenuItem project={project} onOpen={() => setWorkflowSheetOpen(true)} />
+ <DropdownMenuSeparator />
+ {archived ? (
+ <DropdownMenuItem onClick={() => restore(project)}>
+ <ArchiveRestore className="h-3.5 w-3.5" />
+ {t(($) => $.detail.restore_action)}
+ </DropdownMenuItem>
+ ) : (
+ <DropdownMenuItem onClick={() => requestArchive([project])}>
+ <Archive className="h-3.5 w-3.5" />
+ {t(($) => $.detail.archive_action)}
+ </DropdownMenuItem>
+ )}
+ {canDelete && (
+ <DropdownMenuItem
+ variant="destructive"
+ disabled={deleting}
+ aria-busy={deleting}
+ onClick={() => setDeleteDialogOpen(true)}
>
- {t(($) => $.detail.section_progress)}
- <ChevronRight className={`!size-3 shrink-0 stroke-[2.5] text-muted-foreground transition-transform ${progressOpen ? "rotate-90" : ""}`} />
- </button>
- {progressOpen && <div className="pl-2">
- <ProjectProgressSection project={project} />
- </div>}
- </div>
+ {deleting ? <Spinner className="size-3.5" aria-hidden="true" /> : <Trash2 className="h-3.5 w-3.5" />}
+ {t(($) => $.detail.delete_action)}
+ </DropdownMenuItem>
+ )}
+ </>
+ );
- {/* Description */}
- <div>
- <button
- type="button"
- className={`flex w-full items-center gap-1 rounded-md px-2 py-1 text-caption font-medium transition-colors mb-2 hover:bg-accent/70 ${descriptionOpen ? "" : "text-muted-foreground hover:text-foreground"}`}
- onClick={() => setDescriptionOpen(!descriptionOpen)}
- >
- {t(($) => $.detail.section_description)}
- <ChevronRight className={`!size-3 shrink-0 stroke-[2.5] text-muted-foreground transition-transform ${descriptionOpen ? "rotate-90" : ""}`} />
- </button>
- {descriptionOpen && <div className="pl-2">
- <ContentEditor
- ref={descEditorRef}
- key={projectId}
- value={project.description || ""}
- placeholder={t(($) => $.detail.description_placeholder)}
- onUpdate={(md) => handleUpdateField({ description: md || null })}
- debounceMs={1500}
- />
- <p className="mt-1 px-2 text-caption text-muted-foreground">
- {t(($) => $.detail.description_hint)}
- </p>
- </div>}
- </div>
+ const sidebarToggle = (
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Button
+ variant={sidebarOpen ? "secondary" : "ghost"}
+ size="icon-sm"
+ className={sidebarOpen ? "" : "text-muted-foreground"}
+ aria-label={t(($) => $.detail.sidebar_tooltip)}
+ onClick={handleToggleSidebar}
+ >
+ <PanelRight />
+ </Button>
+ }
+ />
+ <TooltipContent side="bottom">{t(($) => $.detail.sidebar_tooltip)}</TooltipContent>
+ </Tooltip>
+ );
- {/* Resources */}
- <ProjectResourcesSection projectId={projectId} />
- </div>
+ const projectTabs = (
+ <ProjectTabs tab={tab} onTabChange={handleTabChange} issueCount={project.issue_count} />
);
return (
@@ -523,123 +458,51 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
>
<ResizablePanel id="content" minSize="50%">
<div ref={rightSidebarShortcutTargetRef} className="flex h-full flex-col">
- <IssueSurface
- scope={issueScope}
- modes={["board", "list", "table", "swimlane", "gantt"]}
- allowCreate={!archived}
- renderHeader={({ controller }) => (
- <>
- <IssueViewHeader
- controller={controller}
- base={{ kind: "project", project }}
- baseBadge={archived ? <ArchivedProjectTag /> : undefined}
- hideCreate={archived}
- baseMenu={
- <>
- <DropdownMenuItem
- onClick={() =>
- useModalStore
- .getState()
- .open("project-rename", { projectId: project.id, title: project.title })
- }
- >
- <Pencil className="h-3.5 w-3.5" />
- {t(($) => $.detail.rename_action)}
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => {
- void copyText(router.getShareableUrl(currentPath(router))).then((ok) => {
- if (ok) toast.success(t(($) => $.detail.toast_link_copied));
- });
- }}>
- <Link2 className="h-3.5 w-3.5" />
- {t(($) => $.detail.copy_link)}
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => {
- const { text, html } = titleLinkPayload(
- project.title,
- router.getShareableUrl(currentPath(router)),
- );
- void copyTextAndHtml(text, html).then((ok) => {
- if (ok) {
- toast.success(t(($) => $.detail.toast_title_link_copied));
- } else {
- toast.error(t(($) => $.detail.toast_title_link_copy_failed));
- }
- });
- }}>
- <Type className="h-3.5 w-3.5" />
- {t(($) => $.detail.copy_title_as_link)}
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => {
- if (isPinned) {
- deletePinMut.mutate({ itemType: "project", itemId: projectId });
- } else {
- createPin.mutate({ item_type: "project", item_id: projectId });
- }
- }}>
- {isPinned ? <PinOff className="h-3.5 w-3.5" /> : <Pin className="h-3.5 w-3.5" />}
- {isPinned ? t(($) => $.detail.unpin_tooltip) : t(($) => $.detail.pin_tooltip)}
- </DropdownMenuItem>
- <DropdownMenuItem
- disabled={setSubscription.isPending}
- onClick={handleToggleSubscription}
- >
- {isSubscribed ? <BellOff className="h-3.5 w-3.5" /> : <BellRing className="h-3.5 w-3.5" />}
- {isSubscribed ? t(($) => $.detail.unsubscribe_action) : t(($) => $.detail.subscribe_action)}
- </DropdownMenuItem>
- <ProjectWorkflowMenuItem project={project} onOpen={() => setWorkflowSheetOpen(true)} />
- <DropdownMenuSeparator />
- {archived ? (
- <DropdownMenuItem onClick={() => restore(project)}>
- <ArchiveRestore className="h-3.5 w-3.5" />
- {t(($) => $.detail.restore_action)}
- </DropdownMenuItem>
- ) : (
- <DropdownMenuItem onClick={() => requestArchive([project])}>
- <Archive className="h-3.5 w-3.5" />
- {t(($) => $.detail.archive_action)}
- </DropdownMenuItem>
- )}
- {canDelete && (
- <DropdownMenuItem
- variant="destructive"
- disabled={deleting}
- aria-busy={deleting}
- onClick={() => setDeleteDialogOpen(true)}
- >
- {deleting ? <Spinner className="size-3.5" aria-hidden="true" /> : <Trash2 className="h-3.5 w-3.5" />}
- {t(($) => $.detail.delete_action)}
- </DropdownMenuItem>
- )}
- </>
- }
- trailing={
- <Tooltip>
- <TooltipTrigger
- render={
- <Button
- variant={sidebarOpen ? "secondary" : "ghost"}
- size="icon-sm"
- className={sidebarOpen ? "" : "text-muted-foreground"}
- aria-label={t(($) => $.detail.sidebar_tooltip)}
- onClick={handleToggleSidebar}
- >
- <PanelRight />
- </Button>
- }
- />
- <TooltipContent side="bottom">{t(($) => $.detail.sidebar_tooltip)}</TooltipContent>
- </Tooltip>
- }
+ {tab !== "issues" ? (
+ <>
+ <ProjectOverviewHeader
+ project={project}
+ tabs={projectTabs}
+ menu={projectMenu}
+ badge={archived ? <ArchivedProjectTag /> : undefined}
+ trailing={sidebarToggle}
/>
{archived && (
<div className={cn("shrink-0 pt-2", PAGE_GUTTER)}>
<ArchivedProjectNotice project={project} />
</div>
)}
- </>
- )}
- />
+ {tab === "overview" ? (
+ <ProjectOverviewBody project={project} onUpdate={handleUpdateField} />
+ ) : (
+ <ProjectActivityPage projectId={project.id} />
+ )}
+ </>
+ ) : (
+ <IssueSurface
+ scope={issueScope}
+ modes={["board", "list", "table", "swimlane", "gantt"]}
+ allowCreate={!archived}
+ renderHeader={({ controller }) => (
+ <>
+ <IssueViewHeader
+ controller={controller}
+ base={{ kind: "project", project }}
+ baseBadge={archived ? <ArchivedProjectTag /> : undefined}
+ hideCreate={archived}
+ afterTitle={projectTabs}
+ baseMenu={projectMenu}
+ trailing={sidebarToggle}
+ />
+ {archived && (
+ <div className={cn("shrink-0 pt-2", PAGE_GUTTER)}>
+ <ArchivedProjectNotice project={project} />
+ </div>
+ )}
+ </>
+ )}
+ />
+ )}
</div>
</ResizablePanel>
{!isMobile && <ResizableHandle />}
diff --git a/packages/views/projects/components/project-insights.test.tsx b/packages/views/projects/components/project-insights.test.tsx
new file mode 100644
index 0000000000..78a7cfb748
--- /dev/null
+++ b/packages/views/projects/components/project-insights.test.tsx
@@ -0,0 +1,34 @@
+import { describe, expect, it, vi } from "vitest";
+import { screen } from "@testing-library/react";
+import type { Project } from "@multica/core/types";
+import { renderWithI18n } from "../../test/i18n";
+import { ProjectInsights } from "./project-insights";
+
+vi.mock("./project-progress-section", () => ({
+ ProjectProgressSection: () => null,
+ ProjectBreakdown: () => <p>breakdown rows</p>,
+}));
+vi.mock("./project-activity", () => ({ ProjectActivityFeed: () => null }));
+
+const project = {
+ id: "project-1",
+ title: "Mobile 2.0",
+ issue_count: 3,
+ done_count: 3,
+ progress: { unit: "issues", scope: 0, completed: 0, started: 0, unstarted: 0, cancelled: 3, percent: 0 },
+} as Project;
+
+describe("ProjectInsights", () => {
+ it("leaves the breakdown out while nothing is in scope", () => {
+ renderWithI18n(<ProjectInsights project={project} onFilter={vi.fn()} onShowActivity={vi.fn()} />);
+ expect(screen.getByRole("button", { name: "Progress" })).toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Breakdown" })).not.toBeInTheDocument();
+ });
+
+ it("shows the breakdown once an issue is in scope", () => {
+ const inScope = { ...project, progress: { ...project.progress!, scope: 1, cancelled: 2 } };
+ renderWithI18n(<ProjectInsights project={inScope} onFilter={vi.fn()} onShowActivity={vi.fn()} />);
+ expect(screen.getByRole("button", { name: "Breakdown" })).toBeInTheDocument();
+ expect(screen.getByText("breakdown rows")).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/projects/components/project-insights.tsx b/packages/views/projects/components/project-insights.tsx
new file mode 100644
index 0000000000..378f317ccb
--- /dev/null
+++ b/packages/views/projects/components/project-insights.tsx
@@ -0,0 +1,55 @@
+"use client";
+
+import type { Project } from "@multica/core/types";
+import { ObjectPanelSection } from "../../layout/object-page";
+import { useT } from "../../i18n";
+import { ProjectActivityFeed } from "./project-activity";
+import { ProjectBreakdown, ProjectProgressSection, type BreakdownFilter } from "./project-progress-section";
+import { getProjectProgress } from "./project-issue-metrics";
+
+const ACTIVITY_DIGEST = 5;
+
+/**
+ * The panel sections under Properties, the same on every tab: how far along
+ * the project is, where the work sits, and what just changed.
+ */
+export function ProjectInsights({
+ project,
+ onFilter,
+ onShowActivity,
+}: {
+ project: Project;
+ onFilter: (filter: BreakdownFilter) => void;
+ onShowActivity: () => void;
+}) {
+ const { t } = useT("projects");
+
+ return (
+ <div className="space-y-5" data-testid="project-insights">
+ <ObjectPanelSection title={t(($) => $.detail.section_progress)}>
+ <ProjectProgressSection project={project} />
+ </ObjectPanelSection>
+
+ {getProjectProgress(project).scope > 0 && (
+ <ObjectPanelSection title={t(($) => $.detail.section_breakdown)}>
+ <ProjectBreakdown project={project} onFilter={onFilter} />
+ </ObjectPanelSection>
+ )}
+
+ <ObjectPanelSection
+ title={t(($) => $.detail.section_activity)}
+ action={
+ <button
+ type="button"
+ className="rounded-md px-1.5 py-0.5 text-caption text-muted-foreground transition-colors hover:bg-accent/70 hover:text-foreground"
+ onClick={onShowActivity}
+ >
+ {t(($) => $.detail.activity.view_all)}
+ </button>
+ }
+ >
+ <ProjectActivityFeed projectId={project.id} limit={ACTIVITY_DIGEST} dense />
+ </ObjectPanelSection>
+ </div>
+ );
+}
diff --git a/packages/views/projects/components/project-overview.tsx b/packages/views/projects/components/project-overview.tsx
new file mode 100644
index 0000000000..9fa7d5aecf
--- /dev/null
+++ b/packages/views/projects/components/project-overview.tsx
@@ -0,0 +1,182 @@
+"use client";
+
+import { useState, type ReactNode } from "react";
+import { Bot, ChevronDown } from "@multica/ui/icons";
+import { Button } from "@multica/ui/components/ui/button";
+import { Tabs, TabsList, TabsTrigger } from "@multica/ui/components/ui/tabs";
+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
+import { cn } from "@multica/ui/lib/utils";
+import { EmojiPicker } from "@multica/ui/components/common/emoji-picker";
+import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuTrigger,
+} from "@multica/ui/components/ui/dropdown-menu";
+import type { Project, UpdateProjectRequest } from "@multica/core/types";
+import type { ProjectTab } from "@multica/core/projects/tab-store";
+import { PageHeader } from "../../layout/page-header";
+import { OBJECT_PAGE_BODY, ObjectSection } from "../../layout/object-page";
+import { TitleEditor, ContentEditor } from "../../editor";
+import { useT } from "../../i18n";
+import { ProjectIcon } from "./project-icon";
+import { ProjectResourcesSection } from "./project-resources-section";
+
+const TAB_TRIGGER_CLASS = "h-full rounded-none px-2.5 group-data-horizontal/tabs:after:bottom-0";
+
+/** Overview / Issues / Activity switch, sized to sit in a page header and underline at its bottom edge. */
+export function ProjectTabs({
+ tab,
+ onTabChange,
+ issueCount,
+}: {
+ tab: ProjectTab;
+ onTabChange: (tab: ProjectTab) => void;
+ issueCount: number;
+}) {
+ const { t } = useT("projects");
+ return (
+ <Tabs
+ value={tab}
+ onValueChange={(value) => onTabChange(value as ProjectTab)}
+ className="shrink-0 self-stretch"
+ >
+ <TabsList variant="line" className="gap-0 p-0 group-data-horizontal/tabs:h-full">
+ <TabsTrigger value="overview" className={TAB_TRIGGER_CLASS}>
+ {t(($) => $.detail.tab_overview)}
+ </TabsTrigger>
+ <TabsTrigger value="issues" className={TAB_TRIGGER_CLASS}>
+ {t(($) => $.detail.tab_issues)}
+ <span className="tabular-nums text-muted-foreground">{issueCount}</span>
+ </TabsTrigger>
+ <TabsTrigger value="activity" className={TAB_TRIGGER_CLASS}>
+ {t(($) => $.detail.tab_activity)}
+ </TabsTrigger>
+ </TabsList>
+ </Tabs>
+ );
+}
+
+/** Header for the Overview and Activity tabs: the same project menu as the Issues tab, without view controls. */
+export function ProjectOverviewHeader({
+ project,
+ tabs,
+ menu,
+ badge,
+ trailing,
+}: {
+ project: Project;
+ tabs: ReactNode;
+ menu: ReactNode;
+ badge?: ReactNode;
+ trailing: ReactNode;
+}) {
+ return (
+ <PageHeader>
+ <div className="flex min-w-0 flex-1 items-center gap-1 self-stretch">
+ <DropdownMenu>
+ <h1 className="flex min-w-20">
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-7 min-w-0 max-w-64 shrink gap-2 px-2 text-body font-medium text-foreground"
+ />
+ }
+ >
+ <ProjectIcon project={project} size="sm" />
+ <span className="min-w-0 truncate">{project.title}</span>
+ <ChevronDown className="size-3 shrink-0 text-muted-foreground" />
+ </DropdownMenuTrigger>
+ </h1>
+ <DropdownMenuContent align="start" className="w-auto min-w-52">
+ {menu}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ {badge}
+ {tabs}
+ </div>
+ <div className="flex shrink-0 items-center gap-1">{trailing}</div>
+ </PageHeader>
+ );
+}
+
+/**
+ * The project as an object page body: its mark and name, then what agents
+ * receive as project context — the description and the resources.
+ */
+export function ProjectOverviewBody({
+ project,
+ onUpdate,
+}: {
+ project: Project;
+ onUpdate: (data: UpdateProjectRequest) => void;
+}) {
+ const { t } = useT("projects");
+ const [iconPickerOpen, setIconPickerOpen] = useState(false);
+ return (
+ <div className="min-h-0 flex-1 overflow-y-auto">
+ <div className={cn(OBJECT_PAGE_BODY, "space-y-8")}>
+ <div className="flex items-center gap-3">
+ <Popover open={iconPickerOpen} onOpenChange={setIconPickerOpen}>
+ <TooltipHint label={t(($) => $.detail.icon_tooltip)}>
+ <PopoverTrigger
+ render={
+ <button
+ type="button"
+ className="flex size-12 shrink-0 cursor-pointer items-center justify-center rounded-xl border bg-muted/50 text-2xl transition-colors hover:bg-accent"
+ aria-label={t(($) => $.detail.icon_tooltip)}
+ >
+ {project.icon || "📁"}
+ </button>
+ }
+ />
+ </TooltipHint>
+ <PopoverContent align="start" className="w-auto p-0">
+ <EmojiPicker
+ onSelect={(emoji) => {
+ onUpdate({ icon: emoji });
+ setIconPickerOpen(false);
+ }}
+ />
+ </PopoverContent>
+ </Popover>
+ <TitleEditor
+ key={`title-${project.id}`}
+ defaultValue={project.title}
+ placeholder={t(($) => $.detail.title_placeholder)}
+ className="min-w-0 flex-1 text-title font-semibold"
+ onBlur={(value) => {
+ const trimmed = value.trim();
+ if (trimmed && trimmed !== project.title) onUpdate({ title: trimmed });
+ }}
+ />
+ </div>
+
+ <ObjectSection
+ collapsible
+ title={t(($) => $.detail.section_description)}
+ action={
+ <TooltipHint label={t(($) => $.detail.description_hint)}>
+ <span className="inline-flex cursor-default items-center gap-1 px-2 text-caption text-muted-foreground">
+ <Bot className="size-3.5" aria-hidden="true" />
+ {t(($) => $.detail.agent_context_badge)}
+ </span>
+ </TooltipHint>
+ }
+ >
+ <ContentEditor
+ key={project.id}
+ value={project.description || ""}
+ placeholder={t(($) => $.detail.description_placeholder)}
+ onUpdate={(md) => onUpdate({ description: md || null })}
+ debounceMs={1500}
+ />
+ </ObjectSection>
+
+ <ProjectResourcesSection projectId={project.id} />
+ </div>
+ </div>
+ );
+}
diff --git a/packages/views/projects/components/project-progress-section.test.tsx b/packages/views/projects/components/project-progress-section.test.tsx
index fbebbdf9fd..c314102654 100644
--- a/packages/views/projects/components/project-progress-section.test.tsx
+++ b/packages/views/projects/components/project-progress-section.test.tsx
@@ -7,7 +7,7 @@ import type { ApiClient } from "@multica/core/api/client";
import { useModalStore } from "@multica/core/modals";
import type { Project, ProjectProgressDetail } from "@multica/core/types";
import { renderWithI18n } from "../../test/i18n";
-import { ProjectProgressSection } from "./project-progress-section";
+import { ProjectBreakdown, ProjectProgressSection } from "./project-progress-section";
import { getProjectProgress } from "./project-issue-metrics";
vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "workspace-1" }));
@@ -44,6 +44,10 @@ const detail: ProjectProgressDetail = {
{ assignee_type: "agent", assignee_id: "agent-1", scope: 5, completed: 3, started: 2 },
{ assignee_type: null, assignee_id: null, scope: 1, completed: 0, started: 0 },
],
+ by_label: [
+ { label_id: "label-1", scope: 4, completed: 1, started: 1 },
+ { label_id: null, scope: 7, completed: 4, started: 2 },
+ ],
history: [
{ date: "2026-10-12", scope: 6, started: 1, completed: 0 },
{ date: "2026-11-09", scope: 11, started: 3, completed: 5 },
@@ -51,18 +55,23 @@ const detail: ProjectProgressDetail = {
forecast: { completion_date: "2026-12-14", weekly_velocity: 1.25 },
};
-function renderSection(project: Project) {
+function renderWithQueries(ui: React.ReactElement) {
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
- return renderWithI18n(
- <QueryClientProvider client={queryClient}>
- <ProjectProgressSection project={project} />
- </QueryClientProvider>,
- );
+ return renderWithI18n(<QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>);
+}
+
+function renderSection(project: Project) {
+ return renderWithQueries(<ProjectProgressSection project={project} />);
}
beforeEach(() => {
getProjectProgressMock.mockReset();
- setApiInstance({ getProjectProgress: getProjectProgressMock } as unknown as ApiClient);
+ setApiInstance({
+ getProjectProgress: getProjectProgressMock,
+ listLabels: vi.fn().mockResolvedValue({
+ labels: [{ id: "label-1", workspace_id: "workspace-1", name: "Design", color: "#3b82f6" }],
+ }),
+ } as unknown as ApiClient);
});
describe("ProjectProgressSection", () => {
@@ -75,10 +84,6 @@ describe("ProjectProgressSection", () => {
expect(screen.getByText("1 cancelled issue isn't counted")).toBeInTheDocument();
expect(await screen.findByText(/done by Dec 14, 4 days before the due date/)).toBeInTheDocument();
- expect(screen.getByText("Lambda")).toBeInTheDocument();
- expect(screen.getByText("Agent")).toBeInTheDocument();
- expect(screen.getByText("Unassigned")).toBeInTheDocument();
- expect(screen.getByText("3/5")).toBeInTheDocument();
expect(getProjectProgressMock).toHaveBeenCalledWith("project-1");
});
@@ -93,6 +98,44 @@ describe("ProjectProgressSection", () => {
await userEvent.click(screen.getByRole("button", { name: "Add existing issue" }));
expect(open).toHaveBeenCalledWith("project-add-issue", { projectId: "project-1" });
});
+
+ it("offers no way to add issues to an archived empty project", () => {
+ getProjectProgressMock.mockReturnValue(new Promise(() => {}));
+ const empty = { ...detail.progress, scope: 0, completed: 0, started: 0, unstarted: 0, cancelled: 0, percent: 0 };
+ renderSection({ ...baseProject, issue_count: 0, done_count: 0, progress: empty, archived_at: "2026-11-01T00:00:00Z" });
+
+ expect(screen.getByText("0%")).toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "New issue" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Add existing issue" })).not.toBeInTheDocument();
+ });
+});
+
+describe("ProjectBreakdown", () => {
+ it("breaks progress down by assignee and filters to a row", async () => {
+ getProjectProgressMock.mockResolvedValue(detail);
+ const onFilter = vi.fn();
+ renderWithQueries(<ProjectBreakdown project={baseProject} onFilter={onFilter} />);
+
+ await userEvent.click(await screen.findByRole("button", { name: /Lambda/ }));
+ expect(onFilter).toHaveBeenCalledWith({ kind: "assignee", type: "agent", id: "agent-1" });
+ expect(screen.getByText("Agent")).toBeInTheDocument();
+ expect(screen.getByText("3/5")).toBeInTheDocument();
+ await userEvent.click(screen.getByRole("button", { name: /Unassigned/ }));
+ expect(onFilter).toHaveBeenLastCalledWith({ kind: "unassigned" });
+ });
+
+ it("switches to labels, where only a named label filters", async () => {
+ getProjectProgressMock.mockResolvedValue(detail);
+ const onFilter = vi.fn();
+ renderWithQueries(<ProjectBreakdown project={baseProject} onFilter={onFilter} />);
+
+ await userEvent.click(await screen.findByRole("tab", { name: "Label" }));
+ await userEvent.click(await screen.findByRole("button", { name: /Design/ }));
+ expect(onFilter).toHaveBeenCalledWith({ kind: "label", id: "label-1" });
+ expect(screen.getByText("No label")).toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: /No label/ })).not.toBeInTheDocument();
+ expect(screen.getByText("4/7")).toBeInTheDocument();
+ });
});
describe("getProjectProgress", () => {
diff --git a/packages/views/projects/components/project-progress-section.tsx b/packages/views/projects/components/project-progress-section.tsx
index a658e87bf2..676d5f95d8 100644
--- a/packages/views/projects/components/project-progress-section.tsx
+++ b/packages/views/projects/components/project-progress-section.tsx
@@ -1,20 +1,23 @@
"use client";
-import type { ReactNode } from "react";
+import { useState, type ReactNode } from "react";
import { useQuery } from "@tanstack/react-query";
import { Plus, User } from "@multica/ui/icons";
import { Button } from "@multica/ui/components/ui/button";
+import { Tabs, TabsList, TabsTrigger } from "@multica/ui/components/ui/tabs";
import { cn } from "@multica/ui/lib/utils";
import type {
Project,
ProjectProgress,
ProjectProgressAssignee,
ProjectProgressForecast,
+ ProjectProgressLabel,
ProjectProgressPoint,
} from "@multica/core/types";
import { useWorkspaceId } from "@multica/core/hooks";
import { useModalStore } from "@multica/core/modals";
import { projectProgressOptions } from "@multica/core/projects/queries";
+import { labelListOptions } from "@multica/core/labels";
import { useActorName } from "@multica/core/workspace/hooks";
import { ActorAvatar } from "../../common/actor-avatar";
import { useLocale, useT } from "../../i18n";
@@ -56,7 +59,6 @@ export function ProjectProgressSection({ project }: { project: Project }) {
{detail && (
<ForecastNote progress={progress} history={detail.history} forecast={detail.forecast} dueDate={project.due_date} />
)}
- {detail && detail.by_assignee.length > 0 && <AssigneeBreakdown rows={detail.by_assignee} />}
</div>
);
}
@@ -71,24 +73,28 @@ function ProjectProgressEmpty({ project, cancelled }: { project: Project; cancel
</div>
<div className="h-2 rounded-full bg-muted" />
{cancelled > 0 && <CancelledNote count={cancelled} />}
- <p className="text-caption text-muted-foreground">{t(($) => $.detail.progress_panel.empty_hint)}</p>
- <div className="flex flex-wrap gap-2">
- <Button
- size="sm"
- variant="outline"
- onClick={() => useModalStore.getState().open("create-issue", { project_id: project.id })}
- >
- <Plus aria-hidden="true" />
- {t(($) => $.detail.empty_issues_new_button)}
- </Button>
- <Button
- size="sm"
- variant="outline"
- onClick={() => useModalStore.getState().open("project-add-issue", { projectId: project.id })}
- >
- {t(($) => $.detail.empty_issues_add_existing)}
- </Button>
- </div>
+ {!project.archived_at && (
+ <>
+ <p className="text-caption text-muted-foreground">{t(($) => $.detail.progress_panel.empty_hint)}</p>
+ <div className="flex flex-wrap gap-2">
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => useModalStore.getState().open("create-issue", { project_id: project.id })}
+ >
+ <Plus aria-hidden="true" />
+ {t(($) => $.detail.empty_issues_new_button)}
+ </Button>
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => useModalStore.getState().open("project-add-issue", { projectId: project.id })}
+ >
+ {t(($) => $.detail.empty_issues_add_existing)}
+ </Button>
+ </div>
+ </>
+ )}
</div>
);
}
@@ -199,8 +205,8 @@ function ProgressTrend({
)}
{due && (
<line
- x1={x(due)} y1={0} x2={x(due)} y2={CHART_H}
- stroke="var(--destructive)" strokeWidth={1.5} vectorEffect="non-scaling-stroke"
+ x1={x(due)} y1={CHART_TOP} x2={x(due)} y2={CHART_H}
+ stroke="var(--destructive)" strokeOpacity={0.7} strokeDasharray="2 2" vectorEffect="non-scaling-stroke"
/>
)}
</svg>
@@ -257,57 +263,195 @@ function ForecastNote({
else if (slack < 0) text = t(($) => $.detail.progress_panel.forecast_behind, { date, count: -slack });
else text = t(($) => $.detail.progress_panel.forecast_on_due, { date });
}
+ const slips = !!dueDate && daysBetween(forecast.completion_date, dueDate) < 0;
return (
- <p className={cn("text-caption", dueDate && daysBetween(forecast.completion_date, dueDate) < 0 ? "text-destructive" : "text-muted-foreground")}>
- {text}
+ <p className="flex gap-1.5 text-caption text-muted-foreground">
+ {slips && <span className="mt-1.5 size-1.5 shrink-0 rounded-full bg-destructive" aria-hidden="true" />}
+ <span>{text}</span>
</p>
);
}
-function AssigneeBreakdown({ rows }: { rows: ProjectProgressAssignee[] }) {
+export type BreakdownFilter =
+ | { kind: "assignee"; type: "member" | "agent" | "squad"; id: string }
+ | { kind: "unassigned" }
+ | { kind: "label"; id: string };
+
+type BreakdownAxis = "assignee" | "label";
+
+/**
+ * Where the project's issues sit, by assignee or by label. Each row reads
+ * done/scope on the same terms as the progress bar; clicking one opens the
+ * Issues tab filtered to it.
+ */
+export function ProjectBreakdown({
+ project,
+ onFilter,
+}: {
+ project: Project;
+ onFilter?: (filter: BreakdownFilter) => void;
+}) {
+ const { t } = useT("projects");
+ const wsId = useWorkspaceId();
+ const [axis, setAxis] = useState<BreakdownAxis>("assignee");
+ const { data: detail } = useQuery(projectProgressOptions(wsId, project.id));
+ if (!detail || detail.progress.scope === 0) return null;
+ return (
+ <div className="space-y-2.5">
+ <Tabs value={axis} onValueChange={(value) => setAxis(value as BreakdownAxis)}>
+ <TabsList className="h-7 w-full">
+ <TabsTrigger value="assignee" className="text-caption">
+ {t(($) => $.detail.progress_panel.axis_assignee)}
+ </TabsTrigger>
+ <TabsTrigger value="label" className="text-caption">
+ {t(($) => $.detail.progress_panel.axis_label)}
+ </TabsTrigger>
+ </TabsList>
+ </Tabs>
+ {axis === "assignee" ? (
+ <AssigneeBreakdown rows={detail.by_assignee} onFilter={onFilter} />
+ ) : (
+ <LabelBreakdown rows={detail.by_label} onFilter={onFilter} />
+ )}
+ </div>
+ );
+}
+
+function BreakdownRow({
+ icon,
+ name,
+ tag,
+ completed,
+ scope,
+ onClick,
+}: {
+ icon: ReactNode;
+ name: string;
+ tag?: ReactNode;
+ completed: number;
+ scope: number;
+ onClick?: () => void;
+}) {
+ const content = (
+ <>
+ {icon}
+ <span className="min-w-0 flex-1 truncate text-left">
+ {name}
+ {tag}
+ </span>
+ <span className="h-1.5 w-16 shrink-0 overflow-hidden rounded-full bg-muted">
+ <span
+ className="block h-full rounded-full bg-info"
+ style={{ width: `${scope > 0 ? (completed / scope) * 100 : 0}%` }}
+ />
+ </span>
+ <span className="w-10 shrink-0 text-right tabular-nums text-muted-foreground">
+ {completed}/{scope}
+ </span>
+ </>
+ );
+ return (
+ <li>
+ {onClick ? (
+ <button
+ type="button"
+ onClick={onClick}
+ className="-mx-1.5 flex w-[calc(100%+0.75rem)] items-center gap-2 rounded-md px-1.5 py-0.5 text-caption transition-colors hover:bg-accent/60"
+ >
+ {content}
+ </button>
+ ) : (
+ <div className="flex items-center gap-2 py-0.5 text-caption">{content}</div>
+ )}
+ </li>
+ );
+}
+
+function AssigneeBreakdown({
+ rows,
+ onFilter,
+}: {
+ rows: ProjectProgressAssignee[];
+ onFilter?: (filter: BreakdownFilter) => void;
+}) {
const { t } = useT("projects");
const { getActorName } = useActorName();
return (
- <div className="space-y-2">
- <div className="text-caption font-medium text-muted-foreground">
- {t(($) => $.detail.progress_panel.by_assignee)}
- </div>
- <ul className="space-y-1.5">
- {rows.map((row) => {
- const assigned = row.assignee_type && row.assignee_id;
- const name = assigned
- ? getActorName(row.assignee_type!, row.assignee_id!)
- : t(($) => $.detail.progress_panel.unassigned);
- return (
- <li key={`${row.assignee_type ?? "none"}:${row.assignee_id ?? ""}`} className="flex items-center gap-2 text-caption">
- {assigned ? (
- <ActorAvatar actorType={row.assignee_type!} actorId={row.assignee_id!} size="sm" />
+ <ul className="space-y-1" aria-label={t(($) => $.detail.progress_panel.by_assignee)}>
+ {rows.map((row) => {
+ const type = row.assignee_type;
+ const id = row.assignee_id;
+ return (
+ <BreakdownRow
+ key={`${type ?? "none"}:${id ?? ""}`}
+ icon={
+ type && id ? (
+ <ActorAvatar actorType={type} actorId={id} size="sm" />
) : (
<span className="flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground">
<User className="size-3" aria-hidden="true" />
</span>
- )}
- <span className="min-w-0 flex-1 truncate">
- {name}
- {row.assignee_type === "agent" && (
- <span className="ml-1.5 rounded-sm border px-1 text-micro text-muted-foreground">
- {t(($) => $.detail.progress_panel.agent_tag)}
- </span>
- )}
- </span>
- <span className="h-1.5 w-16 shrink-0 overflow-hidden rounded-full bg-muted">
+ )
+ }
+ name={type && id ? getActorName(type, id) : t(($) => $.detail.progress_panel.unassigned)}
+ tag={
+ type === "agent" ? (
+ <span className="ml-1.5 rounded-sm border px-1 text-micro text-muted-foreground">
+ {t(($) => $.detail.progress_panel.agent_tag)}
+ </span>
+ ) : undefined
+ }
+ completed={row.completed}
+ scope={row.scope}
+ onClick={
+ onFilter
+ ? () => onFilter(type && id ? { kind: "assignee", type, id } : { kind: "unassigned" })
+ : undefined
+ }
+ />
+ );
+ })}
+ </ul>
+ );
+}
+
+function LabelBreakdown({
+ rows,
+ onFilter,
+}: {
+ rows: ProjectProgressLabel[];
+ onFilter?: (filter: BreakdownFilter) => void;
+}) {
+ const { t } = useT("projects");
+ const wsId = useWorkspaceId();
+ const { data: labels = [] } = useQuery(labelListOptions(wsId));
+ if (rows.length === 0) {
+ return <p className="text-caption text-muted-foreground">{t(($) => $.detail.progress_panel.no_labels)}</p>;
+ }
+ return (
+ <ul className="space-y-1" aria-label={t(($) => $.detail.progress_panel.by_label)}>
+ {rows.map((row) => {
+ const id = row.label_id;
+ const label = id ? labels.find((l) => l.id === id) : undefined;
+ return (
+ <BreakdownRow
+ key={id ?? "none"}
+ icon={
+ <span className="flex size-5 shrink-0 items-center justify-center" aria-hidden="true">
<span
- className="block h-full rounded-full bg-info"
- style={{ width: `${row.scope > 0 ? (row.completed / row.scope) * 100 : 0}%` }}
+ className={cn("size-2.5 rounded-full", !label && "border border-dashed border-muted-foreground")}
+ style={label ? { backgroundColor: label.color } : undefined}
/>
</span>
- <span className="w-10 shrink-0 text-right tabular-nums text-muted-foreground">
- {row.completed}/{row.scope}
- </span>
- </li>
- );
- })}
- </ul>
- </div>
+ }
+ name={id ? (label?.name ?? "…") : t(($) => $.detail.progress_panel.unlabeled)}
+ completed={row.completed}
+ scope={row.scope}
+ // There is no "has no label" issue filter to land on.
+ onClick={onFilter && id ? () => onFilter({ kind: "label", id }) : undefined}
+ />
+ );
+ })}
+ </ul>
);
}
diff --git a/packages/views/projects/components/project-properties.tsx b/packages/views/projects/components/project-properties.tsx
new file mode 100644
index 0000000000..79340560d0
--- /dev/null
+++ b/packages/views/projects/components/project-properties.tsx
@@ -0,0 +1,137 @@
+"use client";
+
+import { Check } from "@multica/ui/icons";
+import { cn } from "@multica/ui/lib/utils";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@multica/ui/components/ui/dropdown-menu";
+import type { Project, ProjectPriority, ProjectStatus, UpdateProjectRequest } from "@multica/core/types";
+import { PROJECT_PRIORITY_ORDER, PROJECT_STATUS_CONFIG, PROJECT_STATUS_ORDER } from "@multica/core/projects/config";
+import { useActorName } from "@multica/core/workspace/hooks";
+import { ActorAvatar } from "../../common/actor-avatar";
+import { PriorityIcon } from "../../issues/components/priority-icon";
+import { ProjectWorkflowControl } from "../../workflows/project-workflow-row";
+import { ObjectPanelSection, ObjectProperty } from "../../layout/object-page";
+import { useT } from "../../i18n";
+import { useFormatRelativeDate, useProjectPriorityLabels, useProjectStatusLabels } from "./labels";
+import { ProjectAccessControl } from "./project-access";
+import { ProjectDueDatePicker } from "./project-due-date-picker";
+import { ProjectLeadPicker } from "./project-lead-picker";
+import { ProjectStartDatePicker } from "./project-start-date-picker";
+
+const PROPERTY_TRIGGER =
+ "flex min-w-0 items-center gap-1.5 rounded-sm text-caption outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50";
+
+/** The project's editable properties, as the panel section every object page opens with. */
+export function ProjectPropertiesPanel({
+ project,
+ onUpdate,
+ onStatusChange,
+ onOpenWorkflow,
+}: {
+ project: Project;
+ onUpdate: (data: UpdateProjectRequest) => void;
+ onStatusChange: (status: ProjectStatus) => void;
+ onOpenWorkflow: () => void;
+}) {
+ const { t } = useT("projects");
+ const { t: tIssues } = useT("issues");
+ const { getActorName } = useActorName();
+ const statusLabels = useProjectStatusLabels();
+ const priorityLabels = useProjectPriorityLabels();
+ const formatRelativeDate = useFormatRelativeDate();
+
+ return (
+ <div data-testid="project-properties">
+ <ObjectPanelSection title={t(($) => $.detail.section_properties)}>
+ <ObjectProperty label={t(($) => $.table.status)}>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <button type="button" className={PROPERTY_TRIGGER}>
+ <span className={cn("size-2 shrink-0 rounded-full", PROJECT_STATUS_CONFIG[project.status].dotColor)} />
+ <span className="truncate">{statusLabels[project.status]}</span>
+ </button>
+ }
+ />
+ <DropdownMenuContent align="start" className="w-44">
+ {PROJECT_STATUS_ORDER.map((s) => (
+ <DropdownMenuItem key={s} onClick={() => onStatusChange(s as ProjectStatus)}>
+ <span className={cn("size-2 rounded-full", PROJECT_STATUS_CONFIG[s].dotColor)} />
+ <span>{statusLabels[s]}</span>
+ {s === project.status && <Check className="ml-auto h-3.5 w-3.5" />}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ObjectProperty>
+ <ObjectProperty label={t(($) => $.table.priority)}>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <button type="button" className={PROPERTY_TRIGGER}>
+ <PriorityIcon priority={project.priority} />
+ <span className="truncate">{priorityLabels[project.priority]}</span>
+ </button>
+ }
+ />
+ <DropdownMenuContent align="start" className="w-44">
+ {PROJECT_PRIORITY_ORDER.map((p) => (
+ <DropdownMenuItem key={p} onClick={() => onUpdate({ priority: p as ProjectPriority })}>
+ <PriorityIcon priority={p} />
+ <span>{priorityLabels[p]}</span>
+ {p === project.priority && <Check className="ml-auto h-3.5 w-3.5" />}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ObjectProperty>
+ <ObjectProperty label={t(($) => $.table.lead)}>
+ <ProjectLeadPicker
+ project={project}
+ handleUpdate={onUpdate}
+ renderTrigger={(leadName) => (
+ <button type="button" className={PROPERTY_TRIGGER}>
+ {project.lead_type && project.lead_id ? (
+ <>
+ <ActorAvatar actorType={project.lead_type} actorId={project.lead_id} size="sm" enableHoverCard showStatusDot />
+ <span className="truncate">{leadName}</span>
+ </>
+ ) : (
+ <span className="text-muted-foreground">{t(($) => $.lead.no_lead)}</span>
+ )}
+ </button>
+ )}
+ />
+ </ObjectProperty>
+ <ObjectProperty label={t(($) => $.access.label)}>
+ <ProjectAccessControl project={project} />
+ </ObjectProperty>
+ <ObjectProperty label={t(($) => $.detail.prop_start_date)}>
+ <ProjectStartDatePicker startDate={project.start_date} onUpdate={onUpdate} />
+ </ObjectProperty>
+ <ObjectProperty label={t(($) => $.detail.prop_due_date)}>
+ <ProjectDueDatePicker dueDate={project.due_date} onUpdate={onUpdate} />
+ </ObjectProperty>
+ <ObjectProperty label={tIssues(($) => $.workflows.project.label)}>
+ <ProjectWorkflowControl project={project} onOpen={onOpenWorkflow} />
+ </ObjectProperty>
+ {project.archived_at && (
+ <ObjectProperty label={t(($) => $.archive.prop_label)}>
+ <span className="tabular-nums">{formatRelativeDate(project.archived_at)}</span>
+ {project.archived_by_type && project.archived_by_id && (
+ <>
+ <span className="text-muted-foreground">·</span>
+ <ActorAvatar actorType={project.archived_by_type} actorId={project.archived_by_id} size="sm" enableHoverCard />
+ <span className="truncate">{getActorName(project.archived_by_type, project.archived_by_id)}</span>
+ </>
+ )}
+ </ObjectProperty>
+ )}
+ </ObjectPanelSection>
+ </div>
+ );
+}
diff --git a/packages/views/projects/components/project-resources-section.tsx b/packages/views/projects/components/project-resources-section.tsx
index 2c712fc3c2..0405f1a8cb 100644
--- a/packages/views/projects/components/project-resources-section.tsx
+++ b/packages/views/projects/components/project-resources-section.tsx
@@ -3,7 +3,6 @@
import { useMemo, useState } from "react";
import { useQuery } from "@tanstack/react-query";
import {
- ChevronRight,
FolderGit,
FolderOpen,
GitBranch,
@@ -70,8 +69,9 @@ import { localDirectoryLabel } from "./local-directory-label";
import { buildRuntimeMachines } from "../../runtimes/components/runtime-machines";
import { useT } from "../../i18n";
import { githubShortLabel } from "../../common/github-url";
+import { ObjectSection, ObjectSectionCard } from "../../layout/object-page";
-// Project Resources sidebar section.
+// Project Resources section of the project page.
//
// Grouped by what a resource applies to: repositories apply to every run on
// every machine, while a local folder only applies to runs on the one machine
@@ -133,7 +133,6 @@ const chipClassName =
export function ProjectResourcesSection({ projectId }: { projectId: string }) {
const { t } = useT("projects");
const wsId = useWorkspaceId();
- const [open, setOpen] = useState(true);
const { data: resources = [] } = useQuery(
projectResourcesOptions(wsId, projectId),
);
@@ -149,34 +148,30 @@ export function ProjectResourcesSection({ projectId }: { projectId: string }) {
const desktopMode = isDesktopShell();
return (
- <div>
- <button
- type="button"
- className={`flex w-full items-center gap-1 rounded-md px-2 py-1 text-caption font-medium transition-colors mb-2 hover:bg-accent/70 ${open ? "" : "text-muted-foreground hover:text-foreground"}`}
- onClick={() => setOpen(!open)}
- >
- {t(($) => $.resources.section_header)}
- <ChevronRight
- className={`!size-3 shrink-0 stroke-[2.5] text-muted-foreground transition-transform ${open ? "rotate-90" : ""}`}
- />
- </button>
- {open && (
- <div className="space-y-4 pl-2">
+ <ObjectSection collapsible title={t(($) => $.resources.section_header)}>
+ <ObjectSectionCard>
+ <div className="px-3 py-2.5">
<RepositoryGroup wsId={wsId} projectId={projectId} repos={repos} />
- {(desktopMode || folders.length > 0) && (
+ </div>
+ {(desktopMode || folders.length > 0) && (
+ <div className="px-3 py-2.5">
<LocalFolderGroup
wsId={wsId}
projectId={projectId}
folders={folders}
desktopMode={desktopMode}
/>
- )}
- {others.map((resource) => (
- <UnknownResourceRow key={resource.id} resource={resource} />
- ))}
- </div>
- )}
- </div>
+ </div>
+ )}
+ {others.length > 0 && (
+ <div className="space-y-1.5 px-3 py-2.5">
+ {others.map((resource) => (
+ <UnknownResourceRow key={resource.id} resource={resource} />
+ ))}
+ </div>
+ )}
+ </ObjectSectionCard>
+ </ObjectSection>
);
}
diff --git a/server/cmd/multica/cmd_project.go b/server/cmd/multica/cmd_project.go
index 6b07a162f4..320327ef8b 100644
--- a/server/cmd/multica/cmd_project.go
+++ b/server/cmd/multica/cmd_project.go
@@ -50,12 +50,41 @@ Completed counts issues in the done category; started issues are tracked but
do not add to the percentage. Each issue counts as one.
--history prints the weekly trend (scope, started, completed per week).
---by assignee breaks scope and completion down per assignee.
+--by assignee breaks scope and completion down per assignee; --by label does
+the same per label, where an issue with several labels counts under each.
JSON output always carries the full response.`,
Args: exactArgs(1),
RunE: runProjectProgress,
}
+var projectOverviewCmd = &cobra.Command{
+ Use: "overview <id>",
+ Short: "Show everything on a project's Overview in one read",
+ Long: `Show a project's Overview: the project itself (description included),
+its progress with weekly history, forecast and breakdowns by assignee and
+label, its attached resources, the agents running on its issues now and its
+most recent activity.
+
+The JSON shape is {"project": ..., "progress": ..., "resources": [...],
+"working_agents": [...], "activity": [...]}; new Overview sections are added
+as new top-level keys.`,
+ Args: exactArgs(1),
+ RunE: runProjectOverview,
+}
+
+var projectActivityCmd = &cobra.Command{
+ Use: "activity <id>",
+ Short: "List recent activity on a project's issues, newest first",
+ Long: `List recent activity on a project's issues, newest first: issues created,
+and changes to status, assignee, priority, dates and title. Description edits
+and run bookkeeping stay on each issue's own timeline.
+
+When more entries exist, the cursor for the next page goes to stderr; pass it
+back with --before. --output json prints {"entries": [...], "next_cursor": ...}.`,
+ Args: exactArgs(1),
+ RunE: runProjectActivity,
+}
+
var projectCreateCmd = &cobra.Command{
Use: "create",
Short: "Create a new project",
@@ -191,6 +220,8 @@ func init() {
projectCmd.AddCommand(projectListCmd)
projectCmd.AddCommand(projectGetCmd)
projectCmd.AddCommand(projectProgressCmd)
+ projectCmd.AddCommand(projectOverviewCmd)
+ projectCmd.AddCommand(projectActivityCmd)
projectCmd.AddCommand(projectCreateCmd)
projectCmd.AddCommand(projectUpdateCmd)
projectCmd.AddCommand(projectDeleteCmd)
@@ -218,8 +249,12 @@ func init() {
projectGetCmd.Flags().String("output", "json", "Output format: table or json")
projectProgressCmd.Flags().String("output", "table", "Output format: table or json")
+ projectOverviewCmd.Flags().String("output", "json", "Output format: table or json")
projectProgressCmd.Flags().Bool("history", false, "Print the weekly trend")
- projectProgressCmd.Flags().String("by", "", "Break progress down by: assignee")
+ projectProgressCmd.Flags().String("by", "", "Break progress down by: assignee or label")
+ projectActivityCmd.Flags().String("output", "table", "Output format: table or json")
+ projectActivityCmd.Flags().Int("limit", 30, "Entries per page (max 100)")
+ projectActivityCmd.Flags().String("before", "", "Cursor from a previous page, to read older entries")
// project create
projectCreateCmd.Flags().String("title", "", "Project title (required)")
@@ -1279,8 +1314,8 @@ func summarizeResourceRef(raw any) string {
func runProjectProgress(cmd *cobra.Command, args []string) error {
by, _ := cmd.Flags().GetString("by")
- if by != "" && by != "assignee" {
- return fmt.Errorf("invalid --by %q; valid values: assignee", by)
+ if by != "" && by != "assignee" && by != "label" {
+ return fmt.Errorf("invalid --by %q; valid values: assignee, label", by)
}
history, _ := cmd.Flags().GetBool("history")
if history && by != "" {
@@ -1314,6 +1349,9 @@ func runProjectProgress(cmd *cobra.Command, args []string) error {
case by == "assignee":
headers, rows := projectProgressAssigneeTable(resp, loadActorDisplayLookup(ctx, client))
cli.PrintTable(os.Stdout, headers, rows)
+ case by == "label":
+ headers, rows := projectProgressLabelTable(resp, loadLabelNames(ctx, client))
+ cli.PrintTable(os.Stdout, headers, rows)
default:
headers, rows := projectProgressSummaryTable(resp)
cli.PrintTable(os.Stdout, headers, rows)
@@ -1321,6 +1359,85 @@ func runProjectProgress(cmd *cobra.Command, args []string) error {
return nil
}
+func runProjectOverview(cmd *cobra.Command, args []string) error {
+ client, err := newAPIClient(cmd)
+ if err != nil {
+ return err
+ }
+ ctx, cancel := cli.APIContext(context.Background())
+ defer cancel()
+
+ projectRef, err := resolveProjectID(ctx, client, args[0])
+ if err != nil {
+ return fmt.Errorf("resolve project: %w", err)
+ }
+ base := "/api/projects/" + projectRef.ID
+ var project, progress, resources, activity map[string]any
+ var workingAgents []any
+ if err := client.GetJSON(ctx, base, &project); err != nil {
+ return fmt.Errorf("get project: %w", err)
+ }
+ if err := client.GetJSON(ctx, base+"/progress", &progress); err != nil {
+ return fmt.Errorf("get project progress: %w", err)
+ }
+ if err := client.GetJSON(ctx, base+"/resources", &resources); err != nil {
+ return fmt.Errorf("list project resources: %w", err)
+ }
+ if err := client.GetJSON(ctx, "/api/working-agents?type=issue&project="+url.QueryEscape(projectRef.ID), &workingAgents); err != nil {
+ return fmt.Errorf("list working agents: %w", err)
+ }
+ if err := client.GetJSON(ctx, base+"/activity?limit=10", &activity); err != nil {
+ return fmt.Errorf("list project activity: %w", err)
+ }
+ overview := map[string]any{
+ "project": project,
+ "progress": progress,
+ "resources": resources["resources"],
+ "working_agents": workingAgents,
+ "activity": activity["entries"],
+ }
+
+ output, _ := cmd.Flags().GetString("output")
+ if output != "table" {
+ return cli.PrintJSON(os.Stdout, overview)
+ }
+ headers, rows := projectOverviewTable(overview, loadActorDisplayLookup(ctx, client))
+ cli.PrintTable(os.Stdout, headers, rows)
+ return nil
+}
+
+// projectOverviewTable lays the overview out as FIELD / VALUE rows.
+func projectOverviewTable(overview map[string]any, actors actorDisplayLookup) ([]string, [][]string) {
+ project, _ := overview["project"].(map[string]any)
+ progress, _ := overview["progress"].(map[string]any)
+ resources, _ := overview["resources"].([]any)
+ workingAgents, _ := overview["working_agents"].([]any)
+ var working []string
+ for _, raw := range workingAgents {
+ if a, ok := raw.(map[string]any); ok {
+ working = append(working, fmt.Sprintf("%s (%d)", strVal(a, "name"), progressInt(a, "running_task_count")))
+ }
+ }
+ _, summary := projectProgressSummaryTable(progress)
+ forecast := ""
+ if len(summary) == 1 {
+ forecast = summary[0][len(summary[0])-1]
+ }
+ rows := [][]string{
+ {"TITLE", strVal(project, "title")},
+ {"STATUS", strVal(project, "status")},
+ {"LEAD", formatLead(project, actors)},
+ {"START", strVal(project, "start_date")},
+ {"DUE", strVal(project, "due_date")},
+ {"PROGRESS", formatProjectProgress(progress["progress"])},
+ {"FORECAST", forecast},
+ {"RESOURCES", fmt.Sprint(len(resources))},
+ {"WORKING", strings.Join(working, ", ")},
+ {"DESCRIPTION", strVal(project, "description")},
+ }
+ return []string{"FIELD", "VALUE"}, rows
+}
+
func progressInt(m map[string]any, key string) int64 {
n, _ := m[key].(float64)
return int64(n)
@@ -1392,6 +1509,131 @@ func projectProgressAssigneeTable(resp map[string]any, actors actorDisplayLookup
return []string{"ASSIGNEE", "COMPLETED", "STARTED"}, rows
}
+func projectProgressLabelTable(resp map[string]any, labels map[string]string) ([]string, [][]string) {
+ entries, _ := resp["by_label"].([]any)
+ rows := make([][]string, 0, len(entries))
+ for _, raw := range entries {
+ e, _ := raw.(map[string]any)
+ name := "no label"
+ if id := strVal(e, "label_id"); id != "" {
+ name = labels[id]
+ if name == "" {
+ name = id
+ }
+ }
+ scope, completed := progressInt(e, "scope"), progressInt(e, "completed")
+ percent := int64(0)
+ if scope > 0 {
+ percent = completed * 100 / scope
+ }
+ rows = append(rows, []string{
+ name,
+ fmt.Sprintf("%d/%d (%d%%)", completed, scope, percent),
+ fmt.Sprint(progressInt(e, "started")),
+ })
+ }
+ return []string{"LABEL", "COMPLETED", "STARTED"}, rows
+}
+
+// loadLabelNames maps issue label ids to names. A failed read leaves the map
+// empty, and rows fall back to the id.
+func loadLabelNames(ctx context.Context, client *cli.APIClient) map[string]string {
+ params := url.Values{"resource_type": {"issue"}}
+ if client.WorkspaceID != "" {
+ params.Set("workspace_id", client.WorkspaceID)
+ }
+ var result map[string]any
+ names := map[string]string{}
+ if err := client.GetJSON(ctx, "/api/labels?"+params.Encode(), &result); err != nil {
+ return names
+ }
+ labels, _ := result["labels"].([]any)
+ for _, raw := range labels {
+ if l, ok := raw.(map[string]any); ok {
+ names[strVal(l, "id")] = strVal(l, "name")
+ }
+ }
+ return names
+}
+
+func runProjectActivity(cmd *cobra.Command, args []string) error {
+ limit, _ := cmd.Flags().GetInt("limit")
+ if limit < 1 {
+ return fmt.Errorf("--limit must be at least 1")
+ }
+ client, err := newAPIClient(cmd)
+ if err != nil {
+ return err
+ }
+ ctx, cancel := cli.APIContext(context.Background())
+ defer cancel()
+
+ projectRef, err := resolveProjectID(ctx, client, args[0])
+ if err != nil {
+ return fmt.Errorf("resolve project: %w", err)
+ }
+ params := url.Values{"limit": {strconv.Itoa(limit)}}
+ if before, _ := cmd.Flags().GetString("before"); before != "" {
+ params.Set("before", before)
+ }
+ var resp map[string]any
+ if err := client.GetJSON(ctx, "/api/projects/"+projectRef.ID+"/activity?"+params.Encode(), &resp); err != nil {
+ return fmt.Errorf("list project activity: %w", err)
+ }
+
+ output, _ := cmd.Flags().GetString("output")
+ if output != "table" {
+ return cli.PrintJSON(os.Stdout, resp)
+ }
+ headers, rows := projectActivityTable(resp, loadActorDisplayLookup(ctx, client))
+ cli.PrintTable(os.Stdout, headers, rows)
+ if next := strVal(resp, "next_cursor"); next != "" {
+ fmt.Fprintf(os.Stderr, "More activity: --before %q\n", next)
+ }
+ return nil
+}
+
+func projectActivityTable(resp map[string]any, actors actorDisplayLookup) ([]string, [][]string) {
+ entries, _ := resp["entries"].([]any)
+ rows := make([][]string, 0, len(entries))
+ for _, raw := range entries {
+ e, _ := raw.(map[string]any)
+ actor := actors.actor(strVal(e, "actor_type"), strVal(e, "actor_id"))
+ if actor == "" {
+ actor = strVal(e, "actor_type")
+ }
+ rows = append(rows, []string{
+ strVal(e, "created_at"),
+ strVal(e, "issue_identifier"),
+ strVal(e, "issue_title"),
+ actor,
+ strVal(e, "action"),
+ projectActivityChange(e, actors),
+ })
+ }
+ return []string{"TIME", "ISSUE", "TITLE", "ACTOR", "ACTION", "CHANGE"}, rows
+}
+
+// projectActivityChange renders an activity's from → to, when it has one.
+func projectActivityChange(entry map[string]any, actors actorDisplayLookup) string {
+ details, _ := entry["details"].(map[string]any)
+ from, to := strVal(details, "from"), strVal(details, "to")
+ if strVal(entry, "action") == "assignee_changed" {
+ from = actors.actor(strVal(details, "from_type"), strVal(details, "from_id"))
+ to = actors.actor(strVal(details, "to_type"), strVal(details, "to_id"))
+ }
+ switch {
+ case from == "" && to == "":
+ return ""
+ case from == "":
+ return "→ " + to
+ case to == "":
+ return from + " →"
+ default:
+ return from + " → " + to
+ }
+}
+
func formatLead(project map[string]any, actors actorDisplayLookup) string {
lType := strVal(project, "lead_type")
lID := strVal(project, "lead_id")
diff --git a/server/cmd/multica/cmd_project_progress_test.go b/server/cmd/multica/cmd_project_progress_test.go
index 322707d128..54aff791cf 100644
--- a/server/cmd/multica/cmd_project_progress_test.go
+++ b/server/cmd/multica/cmd_project_progress_test.go
@@ -12,6 +12,11 @@ const sampleProjectProgress = `{
{"assignee_type": "agent", "assignee_id": "xyz", "scope": 6, "completed": 3, "started": 2},
{"assignee_type": null, "assignee_id": null, "scope": 2, "completed": 0, "started": 0}
],
+ "by_label": [
+ {"label_id": "l1", "scope": 4, "completed": 1, "started": 1},
+ {"label_id": "gone", "scope": 1, "completed": 0, "started": 0},
+ {"label_id": null, "scope": 3, "completed": 2, "started": 0}
+ ],
"history": [
{"date": "2026-10-12", "scope": 6, "started": 0, "completed": 0},
{"date": "2026-11-09", "scope": 11, "started": 3, "completed": 5}
@@ -65,3 +70,77 @@ func TestProjectProgressTables(t *testing.T) {
t.Errorf("by assignee = %v, want %v", byAssignee, wantAssignee)
}
}
+
+func TestProjectProgressLabelTable(t *testing.T) {
+ resp := decodeSampleProgress(t)
+ _, rows := projectProgressLabelTable(resp, map[string]string{"l1": "ios"})
+ want := [][]string{{"ios", "1/4 (25%)", "1"}, {"gone", "0/1 (0%)", "0"}, {"no label", "2/3 (66%)", "0"}}
+ if !reflect.DeepEqual(rows, want) {
+ t.Errorf("by label = %v, want %v", rows, want)
+ }
+}
+
+func TestProjectActivityTable(t *testing.T) {
+ var resp map[string]any
+ if err := json.Unmarshal([]byte(`{"entries": [
+ {"created_at": "2026-11-15T08:00:00Z", "issue_identifier": "DEV-12", "issue_title": "Feedback form",
+ "actor_type": "member", "actor_id": "m1", "action": "status_changed", "details": {"from": "todo", "to": "in_progress"}},
+ {"created_at": "2026-11-14T08:00:00Z", "issue_identifier": "DEV-9", "issue_title": "Subtasks",
+ "actor_type": "agent", "actor_id": "xyz", "action": "assignee_changed", "details": {"to_type": "agent", "to_id": "xyz"}},
+ {"created_at": "2026-11-13T08:00:00Z", "issue_identifier": "DEV-8", "issue_title": "Offline",
+ "actor_type": "system", "actor_id": "", "action": "created", "details": {}}
+ ], "next_cursor": null}`), &resp); err != nil {
+ t.Fatal(err)
+ }
+ actors := actorDisplayLookup{state: &actorDisplayLookupState{
+ members: map[string]string{"m1": "Lin"},
+ agents: map[string]string{"xyz": "CodeBot"},
+ membersLoaded: true,
+ agentsLoaded: true,
+ squadsLoaded: true,
+ }}
+ _, rows := projectActivityTable(resp, actors)
+ want := [][]string{
+ {"2026-11-15T08:00:00Z", "DEV-12", "Feedback form", "member:Lin", "status_changed", "todo → in_progress"},
+ {"2026-11-14T08:00:00Z", "DEV-9", "Subtasks", "agent:CodeBot", "assignee_changed", "→ agent:CodeBot"},
+ {"2026-11-13T08:00:00Z", "DEV-8", "Offline", "system", "created", ""},
+ }
+ if !reflect.DeepEqual(rows, want) {
+ t.Errorf("activity = %v, want %v", rows, want)
+ }
+}
+
+func TestProjectOverviewTable(t *testing.T) {
+ overview := map[string]any{
+ "project": map[string]any{
+ "title": "Mobile 2.0", "status": "in_progress", "due_date": "2026-12-18",
+ "description": "Rebuild the mobile app.", "lead_type": "agent", "lead_id": "xyz",
+ },
+ "progress": decodeSampleProgress(t),
+ "resources": []any{map[string]any{"id": "r1"}},
+ "working_agents": []any{
+ map[string]any{"name": "CodeBot", "running_task_count": float64(2)},
+ },
+ }
+ actors := actorDisplayLookup{state: &actorDisplayLookupState{
+ agents: map[string]string{"xyz": "CodeBot"},
+ membersLoaded: true,
+ agentsLoaded: true,
+ squadsLoaded: true,
+ }}
+ _, rows := projectOverviewTable(overview, actors)
+ got := map[string]string{}
+ for _, row := range rows {
+ got[row[0]] = row[1]
+ }
+ want := map[string]string{
+ "TITLE": "Mobile 2.0", "LEAD": "agent:CodeBot", "DUE": "2026-12-18",
+ "PROGRESS": "5/11 (45%)", "FORECAST": "2026-12-13 (1.25/week)", "RESOURCES": "1",
+ "WORKING": "CodeBot (2)", "DESCRIPTION": "Rebuild the mobile app.",
+ }
+ for k, v := range want {
+ if got[k] != v {
+ t.Errorf("%s = %q, want %q", k, got[k], v)
+ }
+ }
+}
diff --git a/server/cmd/server/router.go b/server/cmd/server/router.go
index 00e268e1aa..7fc621deeb 100644
--- a/server/cmd/server/router.go
+++ b/server/cmd/server/router.go
@@ -2445,6 +2445,7 @@ func NewRouterWithOptions(pool *pgxpool.Pool, hub *realtime.Hub, bus *events.Bus
r.Route("/{id}", func(r chi.Router) {
r.Get("/", h.GetProject)
r.Get("/progress", h.GetProjectProgress)
+ r.Get("/activity", h.ListProjectActivity)
r.Put("/", h.UpdateProject)
r.Delete("/", h.DeleteProject)
r.With(handler.RequireHumanActor).Post("/join", h.JoinPrivateProject)
diff --git a/server/internal/handler/agent.go b/server/internal/handler/agent.go
index 29b2e1e711..f02f350415 100644
--- a/server/internal/handler/agent.go
+++ b/server/internal/handler/agent.go
@@ -3201,7 +3201,8 @@ type WorkspaceWorkingAgent struct {
// the workspace, independent of issue filters or Table pagination. The
// optional type query selects issue, autopilot, or chat work; omitting it keeps
// the all-sources projection. scope=mine narrows issue work to the authenticated
-// member's selected My Issues relation. Access filtering mirrors the other
+// member's selected My Issues relation; parent and project narrow it to one
+// issue's children or one project's issues. Access filtering mirrors the other
// workspace-wide agent aggregations so a private/non-allow-listed agent is
// never exposed by its name, avatar, count, or even presence.
func (h *Handler) ListWorkspaceWorkingAgents(w http.ResponseWriter, r *http.Request) {
@@ -3279,6 +3280,35 @@ func (h *Handler) ListWorkspaceWorkingAgents(w http.ResponseWriter, r *http.Requ
}
}
+ // Narrows the projection to one project's issues, for the project page.
+ // Like parent, absent means workspace-wide.
+ var projectID pgtype.UUID
+ if raw := strings.TrimSpace(r.URL.Query().Get("project")); raw != "" {
+ if workType != "issue" {
+ writeError(w, http.StatusBadRequest, "project requires type=issue")
+ return
+ }
+ if scope != "" || parentIssueID.Valid {
+ writeError(w, http.StatusBadRequest, "project cannot be combined with scope or parent")
+ return
+ }
+ var ok bool
+ projectID, ok = parseUUIDOrBadRequest(w, raw, "project")
+ if !ok {
+ return
+ }
+ // A private project the caller cannot see (MUL-8472) is answered like
+ // one with nobody working, so its agents and run count stay hidden.
+ hidden, ok := h.requestHiddenProjects(w, r, workspaceID)
+ if !ok {
+ return
+ }
+ if !hidden.CanSeeProject(projectID) {
+ writeJSON(w, http.StatusOK, []WorkspaceWorkingAgent{})
+ return
+ }
+ }
+
rows, err := h.Queries.ListWorkspaceWorkingAgents(
r.Context(),
db.ListWorkspaceWorkingAgentsParams{
@@ -3287,6 +3317,7 @@ func (h *Handler) ListWorkspaceWorkingAgents(w http.ResponseWriter, r *http.Requ
MineRelation: mineRelation,
MemberID: memberID,
ParentIssueID: parentIssueID,
+ ProjectID: projectID,
},
)
if err != nil {
diff --git a/server/internal/handler/agent_test.go b/server/internal/handler/agent_test.go
index 2de3e2238a..3d3f00ac6b 100644
--- a/server/internal/handler/agent_test.go
+++ b/server/internal/handler/agent_test.go
@@ -560,6 +560,9 @@ func TestListWorkspaceWorkingAgentsRejectsInvalidFilters(t *testing.T) {
"/api/working-agents?type=issue&parent=not-a-uuid",
"/api/working-agents?type=chat&parent=00000000-0000-0000-0000-000000000000",
"/api/working-agents?type=issue&scope=mine&parent=00000000-0000-0000-0000-000000000000",
+ "/api/working-agents?type=issue&project=not-a-uuid",
+ "/api/working-agents?type=chat&project=00000000-0000-0000-0000-000000000000",
+ "/api/working-agents?type=issue&parent=00000000-0000-0000-0000-000000000000&project=00000000-0000-0000-0000-000000000000",
} {
t.Run(path, func(t *testing.T) {
w := httptest.NewRecorder()
@@ -697,6 +700,36 @@ func TestListWorkspaceWorkingAgentsParentScope(t *testing.T) {
}
})
+ t.Run("project narrows to the project's issues", func(t *testing.T) {
+ var projectID string
+ if err := testPool.QueryRow(ctx, `
+ INSERT INTO project (workspace_id, title) VALUES ($1, 'working-agents-project')
+ RETURNING id
+ `, testWorkspaceID).Scan(&projectID); err != nil {
+ t.Fatalf("insert project: %v", err)
+ }
+ t.Cleanup(func() {
+ testPool.Exec(ctx, `UPDATE issue SET project_id = NULL WHERE project_id = $1`, projectID)
+ testPool.Exec(ctx, `DELETE FROM project WHERE id = $1`, projectID)
+ })
+ if _, err := testPool.Exec(ctx, `UPDATE issue SET project_id = $1 WHERE id = $2`, projectID, firstChildID); err != nil {
+ t.Fatalf("move issue into project: %v", err)
+ }
+
+ byID := read(t, "?type=issue&project="+projectID)
+
+ child, ok := byID[childAgentID]
+ if !ok {
+ t.Fatalf("agent running on the project's issue was not returned")
+ }
+ if child.RunningTaskCount != 1 || len(child.IssueIDs) != 1 || child.IssueIDs[0] != firstChildID {
+ t.Errorf("got %d running on %v, want 1 on [%s]", child.RunningTaskCount, child.IssueIDs, firstChildID)
+ }
+ if _, ok := byID[siblingAgentID]; ok {
+ t.Errorf("agent running outside the project must not be returned")
+ }
+ })
+
t.Run("omitting parent keeps the workspace projection", func(t *testing.T) {
byID := read(t, "?type=issue")
diff --git a/server/internal/handler/private_project_test.go b/server/internal/handler/private_project_test.go
index 480fd3561b..ea122c12fa 100644
--- a/server/internal/handler/private_project_test.go
+++ b/server/internal/handler/private_project_test.go
@@ -1046,3 +1046,26 @@ func TestPrivateProjectPullRequestSummariesSkipHiddenIssues(t *testing.T) {
}
}
}
+
+func TestPrivateProjectWorkingAgentsHiddenFromOutsiders(t *testing.T) {
+ f := newPrivateProjectFixture(t)
+ agentID := createHandlerTestAgent(t, f.marker+" working agent", []byte(`{}`))
+ dbfx.Task(t, agentID, testutil.Cols{"issue_id": f.secretIssue, "runtime_id": testRuntimeID, "status": "running", "started_at": time.Now()})
+ for _, userID := range []string{f.outsider, f.outsideAdmin, f.insider} {
+ req := asUser(newRequest(http.MethodGet, "/api/working-agents?type=issue&project="+f.projectID, nil), userID)
+ var agents []WorkspaceWorkingAgent
+ testutil.Call(t, testHandler.ListWorkspaceWorkingAgents, req).Want(http.StatusOK).JSON(&agents)
+ found := false
+ for _, a := range agents {
+ if a.ID == agentID {
+ found = a.RunningTaskCount == 1
+ }
+ }
+ if userID == f.insider && !found {
+ t.Fatalf("project member lost the agent working in the project: %+v", agents)
+ }
+ if userID != f.insider && len(agents) != 0 {
+ t.Fatalf("private project's working agents exposed to %s: %+v", userID, agents)
+ }
+ }
+}
diff --git a/server/internal/handler/project_activity.go b/server/internal/handler/project_activity.go
new file mode 100644
index 0000000000..234ed1aafb
--- /dev/null
+++ b/server/internal/handler/project_activity.go
@@ -0,0 +1,134 @@
+package handler
+
+import (
+ "encoding/json"
+ "net/http"
+ "strconv"
+ "strings"
+
+ "github.com/go-chi/chi/v5"
+ db "github.com/multica-ai/multica/server/pkg/db/generated"
+)
+
+const (
+ projectActivityDefaultLimit = 30
+ projectActivityMaxLimit = 100
+)
+
+// projectActivityActions are the issue activities a project feed shows: the
+// changes a person following the project acts on. Description autosaves, run
+// bookkeeping and squad evaluations stay on the issue's own timeline.
+var projectActivityActions = []string{
+ "created",
+ "status_changed",
+ "assignee_changed",
+ "priority_changed",
+ "start_date_changed",
+ "due_date_changed",
+ "title_changed",
+ "duplicate_marked",
+}
+
+// ProjectActivityEntry is one activity on an issue in the project, with the
+// issue it happened on.
+type ProjectActivityEntry struct {
+ ID string `json:"id"`
+ IssueID string `json:"issue_id"`
+ IssueIdentifier string `json:"issue_identifier"`
+ IssueTitle string `json:"issue_title"`
+ IssueStatus string `json:"issue_status"`
+ ActorType string `json:"actor_type"`
+ ActorID string `json:"actor_id"`
+ Action string `json:"action"`
+ Details json.RawMessage `json:"details"`
+ CreatedAt string `json:"created_at"`
+}
+
+type ProjectActivityResponse struct {
+ Entries []ProjectActivityEntry `json:"entries"`
+ // NextCursor reads the next older page through ?before=; null on the
+ // last page.
+ NextCursor *string `json:"next_cursor"`
+}
+
+// ListProjectActivity returns the newest activity across a project's issues,
+// newest first. (MUL-8879)
+func (h *Handler) ListProjectActivity(w http.ResponseWriter, r *http.Request) {
+ ctx := r.Context()
+ workspaceID := h.resolveWorkspaceID(r)
+ idUUID, ok := parseUUIDOrBadRequest(w, chi.URLParam(r, "id"), "project id")
+ if !ok {
+ return
+ }
+ wsUUID, ok := parseUUIDOrBadRequest(w, workspaceID, "workspace id")
+ if !ok {
+ return
+ }
+ project, err := h.Queries.GetProjectInWorkspace(ctx, db.GetProjectInWorkspaceParams{
+ ID: idUUID, WorkspaceID: wsUUID,
+ })
+ if err != nil {
+ writeError(w, http.StatusNotFound, "project not found")
+ return
+ }
+ if !h.requireProjectVisible(w, r, workspaceID, project.ID, http.StatusNotFound, "project not found") {
+ return
+ }
+
+ limit := projectActivityDefaultLimit
+ if raw := strings.TrimSpace(r.URL.Query().Get("limit")); raw != "" {
+ n, err := strconv.Atoi(raw)
+ if err != nil || n < 1 {
+ writeError(w, http.StatusBadRequest, "limit must be a positive integer")
+ return
+ }
+ limit = min(n, projectActivityMaxLimit)
+ }
+ params := db.ListProjectActivityParams{
+ WorkspaceID: wsUUID,
+ ProjectID: project.ID,
+ Actions: projectActivityActions,
+ RowLimit: int32(limit + 1),
+ }
+ if before := strings.TrimSpace(r.URL.Query().Get("before")); before != "" {
+ params.BeforeAt, params.BeforeID = parseTranscriptCursor(before)
+ if !params.BeforeAt.Valid || !params.BeforeID.Valid {
+ writeError(w, http.StatusBadRequest, "invalid before cursor")
+ return
+ }
+ }
+
+ rows, err := h.Queries.ListProjectActivity(ctx, params)
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to load project activity")
+ return
+ }
+
+ resp := ProjectActivityResponse{Entries: make([]ProjectActivityEntry, 0, min(len(rows), limit))}
+ if len(rows) > limit {
+ last := rows[limit-1]
+ cursor := transcriptCursor(last.CreatedAt.Time, last.ID)
+ resp.NextCursor = &cursor
+ rows = rows[:limit]
+ }
+ prefix := h.getIssuePrefix(ctx, wsUUID)
+ for _, row := range rows {
+ details := json.RawMessage(row.Details)
+ if len(details) == 0 {
+ details = json.RawMessage("{}")
+ }
+ resp.Entries = append(resp.Entries, ProjectActivityEntry{
+ ID: uuidToString(row.ID),
+ IssueID: uuidToString(row.IssueID),
+ IssueIdentifier: prefix + "-" + strconv.Itoa(int(row.IssueNumber)),
+ IssueTitle: row.IssueTitle,
+ IssueStatus: row.IssueStatus,
+ ActorType: row.ActorType.String,
+ ActorID: uuidToString(row.ActorID),
+ Action: row.Action,
+ Details: details,
+ CreatedAt: timestampToString(row.CreatedAt),
+ })
+ }
+ writeJSON(w, http.StatusOK, resp)
+}
diff --git a/server/internal/handler/project_activity_test.go b/server/internal/handler/project_activity_test.go
new file mode 100644
index 0000000000..aa39b7d7b9
--- /dev/null
+++ b/server/internal/handler/project_activity_test.go
@@ -0,0 +1,109 @@
+package handler
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "net/url"
+ "strconv"
+ "strings"
+ "testing"
+)
+
+func TestListProjectActivityEndpoint(t *testing.T) {
+ if testHandler == nil {
+ t.Skip("database not available")
+ }
+ ctx := context.Background()
+
+ w := httptest.NewRecorder()
+ testHandler.CreateProject(w, newRequest("POST", "/api/projects?workspace_id="+testWorkspaceID, map[string]any{"title": "Activity endpoint"}))
+ if w.Code != http.StatusCreated {
+ t.Fatalf("CreateProject: %d %s", w.Code, w.Body.String())
+ }
+ var project ProjectResponse
+ if err := json.NewDecoder(w.Body).Decode(&project); err != nil {
+ t.Fatalf("decode project: %v", err)
+ }
+ t.Cleanup(func() {
+ testPool.Exec(ctx, `DELETE FROM issue WHERE project_id = $1`, project.ID)
+ testPool.Exec(ctx, `DELETE FROM project WHERE id = $1`, project.ID)
+ })
+
+ var issueID string
+ var number int
+ if err := testPool.QueryRow(ctx, `
+ WITH n AS (
+ UPDATE workspace
+ SET issue_counter = GREATEST(issue_counter, (SELECT COALESCE(MAX(number), 0) FROM issue WHERE workspace_id = $1)) + 1
+ WHERE id = $1 RETURNING issue_counter
+ )
+ INSERT INTO issue (workspace_id, creator_type, creator_id, title, status, priority, project_id, number, position)
+ SELECT $1, 'member', $2, 'activity issue', 'in_progress', 'none', $3, issue_counter, 0 FROM n
+ RETURNING id, number
+ `, testWorkspaceID, testUserID, project.ID).Scan(&issueID, &number); err != nil {
+ t.Fatalf("insert issue: %v", err)
+ }
+
+ // Oldest first; the description autosave must not reach the feed.
+ for i, action := range []string{"created", "description_updated", "status_changed", "priority_changed"} {
+ if _, err := testPool.Exec(ctx, `
+ INSERT INTO activity_log (workspace_id, issue_id, actor_type, actor_id, action, details, created_at)
+ VALUES ($1, $2, 'member', $3, $4, '{"from":"todo","to":"in_progress"}'::jsonb, now() - make_interval(mins => $5))
+ `, testWorkspaceID, issueID, testUserID, action, 10-i); err != nil {
+ t.Fatalf("insert %s activity: %v", action, err)
+ }
+ }
+
+ read := func(t *testing.T, query string) (int, ProjectActivityResponse) {
+ t.Helper()
+ w := httptest.NewRecorder()
+ req := withURLParam(newRequest("GET", "/api/projects/"+project.ID+"/activity"+query, nil), "id", project.ID)
+ testHandler.ListProjectActivity(w, req)
+ var resp ProjectActivityResponse
+ if w.Code == http.StatusOK {
+ if err := json.NewDecoder(w.Body).Decode(&resp); err != nil {
+ t.Fatalf("decode activity: %v", err)
+ }
+ }
+ return w.Code, resp
+ }
+
+ code, first := read(t, "?limit=2")
+ if code != http.StatusOK {
+ t.Fatalf("first page: %d", code)
+ }
+ if len(first.Entries) != 2 || first.Entries[0].Action != "priority_changed" || first.Entries[1].Action != "status_changed" {
+ t.Fatalf("first page = %+v, want priority then status, newest first", first.Entries)
+ }
+ if e := first.Entries[0]; e.IssueID != issueID || e.IssueTitle != "activity issue" || e.IssueStatus != "in_progress" ||
+ !strings.HasSuffix(e.IssueIdentifier, "-"+strconv.Itoa(number)) || e.ActorType != "member" || e.ActorID != testUserID {
+ t.Errorf("entry = %+v, want the issue and its actor", e)
+ }
+ if first.NextCursor == nil {
+ t.Fatal("next_cursor = nil, want a cursor for the remaining entry")
+ }
+
+ code, second := read(t, "?limit=2&before="+url.QueryEscape(*first.NextCursor))
+ if code != http.StatusOK {
+ t.Fatalf("second page: %d", code)
+ }
+ if len(second.Entries) != 1 || second.Entries[0].Action != "created" || second.NextCursor != nil {
+ t.Fatalf("second page = %+v (cursor %v), want only created and no cursor", second.Entries, second.NextCursor)
+ }
+
+ if code, _ := read(t, "?before=garbage"); code != http.StatusBadRequest {
+ t.Errorf("malformed cursor: %d, want 400", code)
+ }
+ if code, _ := read(t, "?limit=0"); code != http.StatusBadRequest {
+ t.Errorf("zero limit: %d, want 400", code)
+ }
+
+ w = httptest.NewRecorder()
+ missing := "00000000-0000-0000-0000-000000000000"
+ testHandler.ListProjectActivity(w, withURLParam(newRequest("GET", "/api/projects/"+missing+"/activity", nil), "id", missing))
+ if w.Code != http.StatusNotFound {
+ t.Errorf("missing project: %d, want 404", w.Code)
+ }
+}
diff --git a/server/internal/handler/project_progress.go b/server/internal/handler/project_progress.go
index eec2b64d0a..7715168516 100644
--- a/server/internal/handler/project_progress.go
+++ b/server/internal/handler/project_progress.go
@@ -34,6 +34,16 @@ type ProjectProgressAssignee struct {
Started int64 `json:"started"`
}
+// ProjectProgressLabel counts the issues carrying one label. An issue with
+// several labels counts under each, so rows can add up to more than the scope.
+type ProjectProgressLabel struct {
+ // LabelID is null for the issues with no label.
+ LabelID *string `json:"label_id"`
+ Scope int64 `json:"scope"`
+ Completed int64 `json:"completed"`
+ Started int64 `json:"started"`
+}
+
// ProjectProgressPoint is the project's progress at the end of Date (UTC).
type ProjectProgressPoint struct {
Date string `json:"date"`
@@ -52,6 +62,7 @@ type ProjectProgressForecast struct {
type ProjectProgressResponse struct {
Progress ProjectProgress `json:"progress"`
ByAssignee []ProjectProgressAssignee `json:"by_assignee"`
+ ByLabel []ProjectProgressLabel `json:"by_label"`
// History has one point a week from the project's start (at most a year
// back) and a final point for today. Scope counts the issues in the
// project now, from when each was created: moves between projects are
@@ -71,6 +82,7 @@ type progressIssue struct {
status string
assigneeType string
assigneeID string
+ labelIDs []string
createdAt time.Time
// changes are the issue's status changes after the history window
// opens, oldest first.
@@ -234,8 +246,65 @@ func summarizeProjectProgress(issues []progressIssue, categoryOf func(string) st
return newProjectProgress(total, terminal, completed, started), rows
}
+// summarizeProjectProgressByLabel breaks the scope down by label, largest
+// first, with the unlabelled issues last.
+func summarizeProjectProgressByLabel(issues []progressIssue, categoryOf func(string) string) []ProjectProgressLabel {
+ byLabel := map[string]*ProjectProgressLabel{}
+ var order []string
+ add := func(labelID string, category string) {
+ row, ok := byLabel[labelID]
+ if !ok {
+ row = &ProjectProgressLabel{}
+ if labelID != "" {
+ id := labelID
+ row.LabelID = &id
+ }
+ byLabel[labelID] = row
+ order = append(order, labelID)
+ }
+ row.Scope++
+ switch category {
+ case issuestatus.CategoryDone:
+ row.Completed++
+ case issuestatus.CategoryStarted:
+ row.Started++
+ }
+ }
+ for _, issue := range issues {
+ category := categoryOf(issue.status)
+ if category == issuestatus.CategoryClosed {
+ continue
+ }
+ if len(issue.labelIDs) == 0 {
+ add("", category)
+ continue
+ }
+ for _, id := range issue.labelIDs {
+ add(id, category)
+ }
+ }
+ rows := make([]ProjectProgressLabel, 0, len(order))
+ for _, id := range order {
+ rows = append(rows, *byLabel[id])
+ }
+ sort.SliceStable(rows, func(a, b int) bool {
+ na, nb := rows[a].LabelID == nil, rows[b].LabelID == nil
+ if na != nb {
+ return nb
+ }
+ if rows[a].Scope != rows[b].Scope {
+ return rows[a].Scope > rows[b].Scope
+ }
+ if na {
+ return false
+ }
+ return *rows[a].LabelID < *rows[b].LabelID
+ })
+ return rows
+}
+
// GetProjectProgress returns a project's progress with its breakdown by
-// assignee, weekly history and forecast completion date. (MUL-8879)
+// assignee and label, weekly history and forecast completion date. (MUL-8879)
func (h *Handler) GetProjectProgress(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
workspaceID := h.resolveWorkspaceID(r)
@@ -288,6 +357,9 @@ func (h *Handler) GetProjectProgress(w http.ResponseWriter, r *http.Request) {
} else {
issues[i].assigneeType = ""
}
+ for _, labelID := range row.LabelIds {
+ issues[i].labelIDs = append(issues[i].labelIDs, uuidToString(labelID))
+ }
ids[i] = row.ID
index[uuidToString(row.ID)] = i
}
@@ -323,6 +395,7 @@ func (h *Handler) GetProjectProgress(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, ProjectProgressResponse{
Progress: progress,
ByAssignee: byAssignee,
+ ByLabel: summarizeProjectProgressByLabel(issues, categoryOf),
History: history,
Forecast: forecastProjectCompletion(history, now),
})
diff --git a/server/internal/handler/project_progress_test.go b/server/internal/handler/project_progress_test.go
index 2fddc774d4..09d64f4dee 100644
--- a/server/internal/handler/project_progress_test.go
+++ b/server/internal/handler/project_progress_test.go
@@ -133,6 +133,28 @@ func TestSummarizeProjectProgressGroupsByAssignee(t *testing.T) {
}
}
+func TestSummarizeProjectProgressByLabel(t *testing.T) {
+ issues := []progressIssue{
+ {status: "done", labelIDs: []string{"bug", "ios"}},
+ {status: "in_progress", labelIDs: []string{"ios"}},
+ {status: "todo"},
+ {status: "cancelled", labelIDs: []string{"bug"}},
+ }
+ rows := summarizeProjectProgressByLabel(issues, builtInCategory)
+ if len(rows) != 3 {
+ t.Fatalf("rows = %+v, want ios, bug, unlabelled", rows)
+ }
+ if rows[0].LabelID == nil || *rows[0].LabelID != "ios" || rows[0].Scope != 2 || rows[0].Completed != 1 || rows[0].Started != 1 {
+ t.Errorf("first row = %+v, want ios 1/2 with 1 started", rows[0])
+ }
+ if rows[1].LabelID == nil || *rows[1].LabelID != "bug" || rows[1].Scope != 1 || rows[1].Completed != 1 {
+ t.Errorf("second row = %+v, want bug 1/1 without the cancelled issue", rows[1])
+ }
+ if rows[2].LabelID != nil || rows[2].Scope != 1 {
+ t.Errorf("last row = %+v, want the unlabelled issue", rows[2])
+ }
+}
+
func TestGetProjectProgressEndpoint(t *testing.T) {
ctx := context.Background()
w := httptest.NewRecorder()
@@ -181,6 +203,18 @@ func TestGetProjectProgressEndpoint(t *testing.T) {
t.Fatalf("insert activity: %v", err)
}
+ var labelID string
+ if err := testPool.QueryRow(ctx, `
+ INSERT INTO issue_label (workspace_id, name, color) VALUES ($1, 'progress-label', '#000000')
+ RETURNING id
+ `, testWorkspaceID).Scan(&labelID); err != nil {
+ t.Fatalf("insert label: %v", err)
+ }
+ t.Cleanup(func() { testPool.Exec(ctx, `DELETE FROM issue_label WHERE id = $1`, labelID) })
+ if _, err := testPool.Exec(ctx, `INSERT INTO issue_to_label (issue_id, label_id) VALUES ($1, $2)`, doneID, labelID); err != nil {
+ t.Fatalf("label issue: %v", err)
+ }
+
w = httptest.NewRecorder()
req = withURLParam(newRequest("GET", "/api/projects/"+project.ID+"/progress", nil), "id", project.ID)
testHandler.GetProjectProgress(w, req)
@@ -197,6 +231,10 @@ func TestGetProjectProgressEndpoint(t *testing.T) {
if len(resp.ByAssignee) != 1 || resp.ByAssignee[0].Scope != 3 || resp.ByAssignee[0].Completed != 1 {
t.Errorf("by_assignee = %+v, want one member row 1/3", resp.ByAssignee)
}
+ if len(resp.ByLabel) != 2 || resp.ByLabel[0].LabelID == nil || *resp.ByLabel[0].LabelID != labelID ||
+ resp.ByLabel[0].Completed != 1 || resp.ByLabel[1].LabelID != nil || resp.ByLabel[1].Scope != 2 {
+ t.Errorf("by_label = %+v, want the label 1/1 then 2 unlabelled", resp.ByLabel)
+ }
if len(resp.History) != 1 {
t.Fatalf("history = %+v, want today only for a new project", resp.History)
}
diff --git a/server/internal/service/builtin_skills/multica-platform/references/projects.md b/server/internal/service/builtin_skills/multica-platform/references/projects.md
index 02568e4228..eb9838d907 100644
--- a/server/internal/service/builtin_skills/multica-platform/references/projects.md
+++ b/server/internal/service/builtin_skills/multica-platform/references/projects.md
@@ -29,8 +29,9 @@ multica project resource list <project-id> --output json
Project progress counts issues: `scope` leaves out cancelled issues, `completed`
is the done category, and `started` issues are tracked separately without adding
to `percent`. Read it from `progress` on the project, or from
-`multica project progress` for the weekly history, forecast and per-assignee
-breakdown.
+`multica project progress` for the weekly history, forecast and the
+per-assignee or per-label breakdown. `multica project activity` lists what
+changed on the project's issues, newest first.
Project resources are mutated through project resource commands/endpoints. Issue
comments do not create durable project resources.
@@ -54,7 +55,10 @@ Common resource types:
```bash
multica project list --output json
multica project get <project-id> --output json
-multica project progress <project-id> --output json # scope/completed/started, weekly history, forecast, by assignee
+multica project overview <project-id> # project + progress + resources + working agents + recent activity
+multica project progress <project-id> --output json # scope/completed/started, weekly history, forecast, by assignee and label
+multica project progress <project-id> --by label # per-label breakdown table
+multica project activity <project-id> --output json # issue changes in the project, newest first; page with --before <next_cursor>
multica project create --title "<title>" --repo <github-url> --output json
multica project create --title "<title>" --start-date 2026-03-01 --due-date 2026-03-31 --output json
multica project update <project-id> --title "<title>" --output json
diff --git a/server/pkg/db/generated/agent.sql.go b/server/pkg/db/generated/agent.sql.go
index 30004e0502..e9218806bd 100644
--- a/server/pkg/db/generated/agent.sql.go
+++ b/server/pkg/db/generated/agent.sql.go
@@ -6843,6 +6843,16 @@ WHERE a.workspace_id = $1
AND child.parent_issue_id = $5::uuid
)
)
+ AND (
+ $6::uuid IS NULL
+ OR EXISTS (
+ SELECT 1
+ FROM issue pi
+ WHERE pi.id = atq.issue_id
+ AND pi.workspace_id = a.workspace_id
+ AND pi.project_id = $6::uuid
+ )
+ )
GROUP BY a.id, a.name, a.avatar_url, a.created_at
ORDER BY a.created_at ASC
`
@@ -6853,6 +6863,7 @@ type ListWorkspaceWorkingAgentsParams struct {
MineRelation string `json:"mine_relation"`
MemberID pgtype.UUID `json:"member_id"`
ParentIssueID pgtype.UUID `json:"parent_issue_id"`
+ ProjectID pgtype.UUID `json:"project_id"`
}
type ListWorkspaceWorkingAgentsRow struct {
@@ -6875,6 +6886,8 @@ type ListWorkspaceWorkingAgentsRow struct {
// (NULL = workspace); when set it narrows issue work to the direct children
// of that issue, so an issue detail's sub-issue header reads the same
// projection as the Issues list header instead of deriving its own count.
+// project_id is optional (NULL = workspace); when set it narrows issue work to
+// that project's issues, for the project page's working-agents section.
func (q *Queries) ListWorkspaceWorkingAgents(ctx context.Context, arg ListWorkspaceWorkingAgentsParams) ([]ListWorkspaceWorkingAgentsRow, error) {
rows, err := q.db.Query(ctx, listWorkspaceWorkingAgents,
arg.WorkspaceID,
@@ -6882,6 +6895,7 @@ func (q *Queries) ListWorkspaceWorkingAgents(ctx context.Context, arg ListWorksp
arg.MineRelation,
arg.MemberID,
arg.ParentIssueID,
+ arg.ProjectID,
)
if err != nil {
return nil, err
diff --git a/server/pkg/db/generated/project.sql.go b/server/pkg/db/generated/project.sql.go
index c3e5596324..50293bdeea 100644
--- a/server/pkg/db/generated/project.sql.go
+++ b/server/pkg/db/generated/project.sql.go
@@ -307,8 +307,92 @@ func (q *Queries) ListIssueStatusChangesSince(ctx context.Context, arg ListIssue
return items, nil
}
+const listProjectActivity = `-- name: ListProjectActivity :many
+SELECT a.id, a.issue_id, a.actor_type, a.actor_id, a.action, a.details, a.created_at,
+ i.number AS issue_number, i.title AS issue_title, i.status AS issue_status
+FROM activity_log a
+JOIN issue i ON i.id = a.issue_id
+WHERE i.workspace_id = $1::uuid
+ AND i.project_id = $2::uuid
+ AND a.action = ANY($3::text[])
+ AND (
+ $4::timestamptz IS NULL
+ OR (a.created_at, a.id) < ($4::timestamptz, $5::uuid)
+ )
+ORDER BY a.created_at DESC, a.id DESC
+LIMIT $6
+`
+
+type ListProjectActivityParams struct {
+ WorkspaceID pgtype.UUID `json:"workspace_id"`
+ ProjectID pgtype.UUID `json:"project_id"`
+ Actions []string `json:"actions"`
+ BeforeAt pgtype.Timestamptz `json:"before_at"`
+ BeforeID pgtype.UUID `json:"before_id"`
+ RowLimit int32 `json:"row_limit"`
+}
+
+type ListProjectActivityRow struct {
+ ID pgtype.UUID `json:"id"`
+ IssueID pgtype.UUID `json:"issue_id"`
+ ActorType pgtype.Text `json:"actor_type"`
+ ActorID pgtype.UUID `json:"actor_id"`
+ Action string `json:"action"`
+ Details []byte `json:"details"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
+ IssueNumber int32 `json:"issue_number"`
+ IssueTitle string `json:"issue_title"`
+ IssueStatus string `json:"issue_status"`
+}
+
+// The newest activity on a project's issues, newest first, keyset-paged on
+// (created_at, id). Only the given actions are read, so autosaves and run
+// bookkeeping stay out of the project feed. A zero cursor reads from the top.
+func (q *Queries) ListProjectActivity(ctx context.Context, arg ListProjectActivityParams) ([]ListProjectActivityRow, error) {
+ rows, err := q.db.Query(ctx, listProjectActivity,
+ arg.WorkspaceID,
+ arg.ProjectID,
+ arg.Actions,
+ arg.BeforeAt,
+ arg.BeforeID,
+ arg.RowLimit,
+ )
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ items := []ListProjectActivityRow{}
+ for rows.Next() {
+ var i ListProjectActivityRow
+ if err := rows.Scan(
+ &i.ID,
+ &i.IssueID,
+ &i.ActorType,
+ &i.ActorID,
+ &i.Action,
+ &i.Details,
+ &i.CreatedAt,
+ &i.IssueNumber,
+ &i.IssueTitle,
+ &i.IssueStatus,
+ ); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
const listProjectProgressIssues = `-- name: ListProjectProgressIssues :many
-SELECT id, status, assignee_type, assignee_id, created_at
+SELECT id, status, assignee_type, assignee_id, created_at,
+ ARRAY(
+ SELECT il.label_id FROM issue_to_label il
+ WHERE il.issue_id = issue.id
+ ORDER BY il.label_id
+ )::uuid[] AS label_ids
FROM issue
WHERE workspace_id = $1::uuid
AND project_id = $2::uuid
@@ -325,6 +409,7 @@ type ListProjectProgressIssuesRow struct {
AssigneeType pgtype.Text `json:"assignee_type"`
AssigneeID pgtype.UUID `json:"assignee_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
+ LabelIds []pgtype.UUID `json:"label_ids"`
}
func (q *Queries) ListProjectProgressIssues(ctx context.Context, arg ListProjectProgressIssuesParams) ([]ListProjectProgressIssuesRow, error) {
@@ -342,6 +427,7 @@ func (q *Queries) ListProjectProgressIssues(ctx context.Context, arg ListProject
&i.AssigneeType,
&i.AssigneeID,
&i.CreatedAt,
+ &i.LabelIds,
); err != nil {
return nil, err
}
diff --git a/server/pkg/db/queries/agent.sql b/server/pkg/db/queries/agent.sql
index 8543864fdd..d68f13f926 100644
--- a/server/pkg/db/queries/agent.sql
+++ b/server/pkg/db/queries/agent.sql
@@ -2643,6 +2643,8 @@ WHERE a.workspace_id = $1;
-- (NULL = workspace); when set it narrows issue work to the direct children
-- of that issue, so an issue detail's sub-issue header reads the same
-- projection as the Issues list header instead of deriving its own count.
+-- project_id is optional (NULL = workspace); when set it narrows issue work to
+-- that project's issues, for the project page's working-agents section.
SELECT
a.id,
a.name,
@@ -2732,6 +2734,16 @@ WHERE a.workspace_id = $1
AND child.parent_issue_id = @parent_issue_id::uuid
)
)
+ AND (
+ sqlc.narg('project_id')::uuid IS NULL
+ OR EXISTS (
+ SELECT 1
+ FROM issue pi
+ WHERE pi.id = atq.issue_id
+ AND pi.workspace_id = a.workspace_id
+ AND pi.project_id = sqlc.narg('project_id')::uuid
+ )
+ )
GROUP BY a.id, a.name, a.avatar_url, a.created_at
ORDER BY a.created_at ASC;
diff --git a/server/pkg/db/queries/project.sql b/server/pkg/db/queries/project.sql
index 95bda5b217..34dd16456f 100644
--- a/server/pkg/db/queries/project.sql
+++ b/server/pkg/db/queries/project.sql
@@ -92,7 +92,12 @@ WHERE workspace_id = sqlc.arg('workspace_id')::uuid
GROUP BY project_id;
-- name: ListProjectProgressIssues :many
-SELECT id, status, assignee_type, assignee_id, created_at
+SELECT id, status, assignee_type, assignee_id, created_at,
+ ARRAY(
+ SELECT il.label_id FROM issue_to_label il
+ WHERE il.issue_id = issue.id
+ ORDER BY il.label_id
+ )::uuid[] AS label_ids
FROM issue
WHERE workspace_id = sqlc.arg('workspace_id')::uuid
AND project_id = sqlc.arg('project_id')::uuid;
@@ -105,3 +110,21 @@ WHERE workspace_id = sqlc.arg('workspace_id')::uuid
AND action = 'status_changed'
AND created_at >= sqlc.arg('since')::timestamptz
ORDER BY created_at, id;
+
+-- name: ListProjectActivity :many
+-- The newest activity on a project's issues, newest first, keyset-paged on
+-- (created_at, id). Only the given actions are read, so autosaves and run
+-- bookkeeping stay out of the project feed. A zero cursor reads from the top.
+SELECT a.id, a.issue_id, a.actor_type, a.actor_id, a.action, a.details, a.created_at,
+ i.number AS issue_number, i.title AS issue_title, i.status AS issue_status
+FROM activity_log a
+JOIN issue i ON i.id = a.issue_id
+WHERE i.workspace_id = sqlc.arg('workspace_id')::uuid
+ AND i.project_id = sqlc.arg('project_id')::uuid
+ AND a.action = ANY(sqlc.arg('actions')::text[])
+ AND (
+ sqlc.narg('before_at')::timestamptz IS NULL
+ OR (a.created_at, a.id) < (sqlc.narg('before_at')::timestamptz, sqlc.narg('before_id')::uuid)
+ )
+ORDER BY a.created_at DESC, a.id DESC
+LIMIT sqlc.arg('row_limit');