mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 06:50:43 +01:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The Tasks page lists tasks and provides a Filters panel for status,
assignee, project, and other fields
> - The panel has no time filter, so users cannot limit the list to
tasks updated in a recent time window or date range
> - Users need a quick way to find recent work (such as the last 3 days)
or inspect a custom date range across both desktop and mobile views
> - This pull request supersedes #21822 on current `master` and adds an
"Updated" section to all Tasks filter panels (Any time, Last 24 hours,
Last 3 days, Last 7 days, Last 30 days, and Custom range), keeps the
filter in the URL, aligns "Last updated" display and sort with the
filter timestamp, and adds an optional `updatedBefore` server list bound
> - The benefit is that users can filter tasks by update time window and
share filtered links cleanly across all Tasks views
## Linked Issues or Issue Description
Refs #21822 (rebased onto current `master` with merge conflicts and
post-pruning test updates resolved).
**What existing behavior does this improve?**
The Tasks list filters (`CoordinatorTasks`, Classic `IssuesList`, and
`LegacyIssuesList`) and the company issue list API (`GET
/api/companies/:companyId/issues`). The Filters panel had status,
responsible, project, creator, and label filters, but no time filter.
**Subsystem affected**
UI (Tasks list filters, sorting, and URL sync) and Server (`GET
/api/companies/:companyId/issues`).
**Current behavior**
Users cannot limit the Tasks list to tasks updated within a recent time
window or custom date range. They must scan rows manually to find recent
activity.
**Proposed behavior**
Add an "Updated" section to the Tasks filter panels with options: Any
time (default), Last 24 hours, Last 3 days, Last 7 days, Last 30 days,
and Custom range (start and end local calendar day). Filter on the same
timestamp shown on each row (`lastActivityAt ?? lastExternalCommentAt ??
updatedAt`), count it as 1 active filter, reset it on Clear, persist it
in the page URL (`updated`, `updatedFrom`, `updatedTo`), and send an
optional `updatedBefore` upper bound to the server for custom ranges.
**Reason and benefit**
Users can narrow large task lists to recent work or a specific date
window in one click, including on phones, and share filtered URLs that
open with the same filter applied.
**Breaking changes**
None. The filter defaults to Any time, and `updatedBefore` is an
optional query parameter.
## What Changed
- `server/src/routes/issues.ts`, `server/src/services/issues.ts`,
`docs/api/issues.md`: add the optional `updatedBefore` query parameter
(`issues.updatedAt < updatedBefore`) with `400` validation matching
`updatedSince`, apply both `updatedSince` and `updatedBefore` in
`blockedInboxIssueConditions` so `attention=blocked` enforces the same
bounds, and document both parameters.
- `ui/src/api/issues.ts`: add optional `updatedBefore` to
`IssueListFilters` and `issueListSearchParams`.
- `ui/src/lib/issue-filters.ts`,
`ui/src/hooks/useIssueUpdatedFilterNow.ts`: add `updatedWithin`,
`updatedFrom`, and `updatedTo` to `IssueFilterState`, plus
`issueUpdatedWithinOptions`, `issueUpdatedWithinPatch`,
`issueUpdatedTime`, `issueUpdatedTimeRange`,
`nextIssueUpdatedFilterExpiryMs`, `issueUpdatedServerBefore`,
`readIssueUpdatedParams`, and `writeIssueUpdatedParams`. Reject
impossible calendar dates (such as `2026-02-31`), swap reversed custom
ranges, count Updated as 1 active filter, filter in `applyIssueFilters`
on the row time, and schedule a single deadline timer when a relative
window (`24h`/`3d`/`7d`/`30d`) is active so tasks age out automatically
across task and inbox lists.
- `ui/src/components/IssueUpdatedRangeInputs.tsx`,
`ui/src/components/IssueFilterPanel.tsx`,
`ui/src/components/IssueFiltersPopover.tsx`: add the "Updated" section
and native date inputs (`text-base md:text-xs` to prevent mobile Safari
focus zoom) across refreshed, streamlined, and legacy filter panels.
- `ui/src/components/IssueColumns.tsx`,
`ui/src/components/TaskList.tsx`, `ui/src/lib/issue-sort.ts`,
`DESIGN.md`: align `TaskList` "Last updated" display and sort with
`issueUpdatedTime`, compute each task's sort key once before sorting
(`O(N)` context reads), and update `DESIGN.md` to document the shared
timestamp rule.
- `ui/src/components/IssuesList.tsx`,
`ui/src/components/LegacyIssuesList.tsx`, `ui/src/pages/Issues.tsx`,
`ui/src/pages/CoordinatorTasks.tsx`: sync `updated`, `updatedFrom`, and
`updatedTo` with the page URL, queue multiple URL filter writes in the
same event so Clear resets filters together, pass `updatedBefore` for
custom ranges while preserving `archiveQueryScope` as the final
`issuesQuery.queryKey` segment for `placeholderData`, and forward
`updatedBefore` to `CoordinatorTasks` and `Issues` `searchFilters`.
- `server/src/__tests__/issue-list-updatedsince-filter-routes.test.ts`,
`ui/src/lib/issue-filters.test.ts`, `ui/src/lib/issue-sort.test.ts`,
`ui/src/lib/inbox.test.ts`,
`ui/src/components/IssueFiltersPopover.updated.test.tsx`: add
embedded-Postgres route tests for `updatedBefore` (strict bound,
combined range, `400` validation), unit tests for time windows/custom
ranges/local time zone/invalid dates/URL params/sort key caching, and
component tests across `legacy`, `streamlined`, and `refreshed` panels.
## Verification
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/issue-list-updatedsince-filter-routes.test.ts`: **1 file,
6/6 tests pass** (embedded Postgres, including `attention=blocked` with
`updatedBefore` and `updatedSince`).
- `pnpm --filter @paperclipai/server typecheck`: **pass** (0 errors
across all server layers).
- `pnpm --filter @paperclipai/ui exec vitest run
src/lib/issue-filters.test.ts src/lib/issue-sort.test.ts
src/lib/inbox.test.ts
src/components/IssueFiltersPopover.updated.test.tsx
src/pages/Issues.test.tsx`: **5 files, 94/94 tests pass** (including
fake-timer relative window expiration and a 500-task bounded
timestamp-read render-cost test).
- `pnpm --filter @paperclipai/ui typecheck`: **pass** (0 errors,
Storybook catalog clean).
- `node scripts/check-token-gates.mjs`: **pass** (all 4 token gates
clean).
- `node scripts/check-test-budget.mjs --files
server/src/__tests__/issue-list-updatedsince-filter-routes.test.ts
ui/src/lib/issue-filters.test.ts ui/src/lib/issue-sort.test.ts
ui/src/lib/inbox.test.ts
ui/src/components/IssueFiltersPopover.updated.test.tsx`: **pass** (110
nightly suites validated, 5 test files checked).
- `pnpm verify --base 2d06567795
--explain`: exited `2` because `DESIGN.md` is a global CI input; focused
server and UI verification ran locally and full PR CI supplies repo-wide
coverage.
## Risks
- Low risk. The Updated filter is off by default (`Any time`), and
`updatedBefore` is optional.
- `IssueFiltersPopover` is shared by Inbox and agent work panels; those
views use `applyIssueFilters`, so the Updated section works consistently
there as well.
- The refreshed `TaskList` "Last updated" column now displays and sorts
by latest activity (`lastActivityAt ?? lastExternalCommentAt ??
updatedAt`), matching the Classic row and the Updated filter.
- Relative windows filter loaded pages in the browser (like other Tasks
filters); because the server sorts by update time descending, recent
tasks load first.
> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.
## Model Used
- Google Gemini (`gemini-3-pro` / Antigravity agentic coding environment
with tool use, shell execution, and embedded Postgres testing), building
on original work from #21822 authored with Anthropic Claude Opus 5.5
(`claude-opus-5-5`).
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: lucktastic <13757243+lucktastic@users.noreply.github.com>
Co-authored-by: Paperclip <noreply@paperclip.ing>
438 lines
16 KiB
TypeScript
438 lines
16 KiB
TypeScript
import { AgentIdentity } from "@/components/AgentIdentity";
|
|
import { useMemo, useState } from "react";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import { AlertTriangle, CheckCircle2 } from "lucide-react";
|
|
import type { Issue } from "@paperclipai/shared";
|
|
import { describeError } from "../api/errors";
|
|
import { issuesApi } from "../api/issues";
|
|
import { queryKeys } from "../lib/queryKeys";
|
|
import { cn } from "../lib/utils";
|
|
import { applyIssueFilters, type IssueFilterState, type IssueFilterWorkspaceContext } from "../lib/issue-filters";
|
|
import { useIssueUpdatedFilterNow } from "../hooks/useIssueUpdatedFilterNow";
|
|
import { resolveInboxIssueBlockerAttention } from "../lib/inbox-live-descendants";
|
|
import {
|
|
blockedRowMatchesSearch,
|
|
buildBlockedInboxRows,
|
|
formatStoppedAge,
|
|
groupBlockedInboxRows,
|
|
sortBlockedInboxRows,
|
|
type BlockedInboxGroupBy,
|
|
type BlockedInboxIssueRow,
|
|
type BlockedInboxSort,
|
|
} from "../lib/blockedInbox";
|
|
import { BlockedReasonChip } from "./BlockedReasonChip";
|
|
import { useQueryView } from "./QueryView";
|
|
import { IssueGroupHeader } from "./IssueGroupHeader";
|
|
import { IssueRow, type IssueRowPresentation } from "./IssueRow";
|
|
import { Identity } from "./Identity";
|
|
import { StatusIcon } from "./StatusIcon";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Card } from "@/components/ui/card";
|
|
import { taskStatusIconProps } from "@/lib/task-status-presentation";
|
|
|
|
const EMPTY_BLOCKED_ISSUES: Issue[] = [];
|
|
|
|
interface BlockedInboxViewProps {
|
|
companyId: string;
|
|
searchQuery: string;
|
|
agentNameById: ReadonlyMap<string, string>;
|
|
agents?: import("./AgentAvatar").AvatarAgent[];
|
|
userLabelById?: ReadonlyMap<string, string>;
|
|
issueLinkState: unknown;
|
|
groupBy: BlockedInboxGroupBy;
|
|
sortBy: BlockedInboxSort;
|
|
issueFilters: IssueFilterState;
|
|
currentUserId: string | null;
|
|
liveIssueIds: ReadonlySet<string>;
|
|
subtreeLiveCounts: ReadonlyMap<string, number>;
|
|
workspaceFilterContext: IssueFilterWorkspaceContext;
|
|
showStatusColumn: boolean;
|
|
showIdentifierColumn: boolean;
|
|
showUpdatedColumn: boolean;
|
|
presentation?: IssueRowPresentation;
|
|
}
|
|
|
|
const BLOCKED_LIST_LIMIT = 200;
|
|
|
|
export function BlockedInboxView({
|
|
companyId,
|
|
searchQuery,
|
|
agentNameById,
|
|
agents,
|
|
userLabelById,
|
|
issueLinkState,
|
|
groupBy,
|
|
sortBy,
|
|
issueFilters,
|
|
currentUserId,
|
|
liveIssueIds,
|
|
subtreeLiveCounts,
|
|
workspaceFilterContext,
|
|
showStatusColumn,
|
|
showIdentifierColumn,
|
|
showUpdatedColumn,
|
|
presentation = "legacy",
|
|
}: BlockedInboxViewProps) {
|
|
const [collapsedVariants, setCollapsedVariants] = useState<Set<string>>(() => new Set());
|
|
|
|
const blockedQuery = useQuery({
|
|
queryKey: [...queryKeys.issues.listBlockedAttention(companyId), "live-descendant-summary", issueFilters.showAgentCreatedTasks],
|
|
queryFn: () =>
|
|
issuesApi.list(companyId, {
|
|
attention: "blocked",
|
|
includeRoutineExecutions: true,
|
|
includeAgentCreatedTasks: issueFilters.showAgentCreatedTasks,
|
|
includeParticipatedTasks: true,
|
|
includeBlockedInboxAttention: true,
|
|
includeBlockedBy: true,
|
|
includeLiveDescendantSummary: true,
|
|
limit: BLOCKED_LIST_LIMIT,
|
|
}),
|
|
});
|
|
const {
|
|
data: issues,
|
|
isLoading,
|
|
} = blockedQuery;
|
|
const blockedIssues = issues ?? EMPTY_BLOCKED_ISSUES;
|
|
const blockedView = useQueryView(blockedQuery);
|
|
|
|
const allRows = useMemo(() => buildBlockedInboxRows(blockedIssues), [blockedIssues]);
|
|
const filteredRows = useMemo(
|
|
() => allRows.filter((row) => blockedRowMatchesSearch(row, searchQuery)),
|
|
[allRows, searchQuery],
|
|
);
|
|
const updatedFilterNow = useIssueUpdatedFilterNow(blockedIssues, issueFilters.updatedWithin);
|
|
const issueFilteredRows = useMemo(() => {
|
|
const visibleIssueIds = new Set(
|
|
applyIssueFilters(
|
|
filteredRows.map((row) => row.issue),
|
|
issueFilters,
|
|
currentUserId,
|
|
false,
|
|
liveIssueIds,
|
|
workspaceFilterContext,
|
|
updatedFilterNow,
|
|
).map((issue) => issue.id),
|
|
);
|
|
return filteredRows.filter((row) => visibleIssueIds.has(row.issue.id));
|
|
}, [currentUserId, filteredRows, issueFilters, liveIssueIds, workspaceFilterContext, updatedFilterNow]);
|
|
const sortedRows = useMemo(() => sortBlockedInboxRows(issueFilteredRows, sortBy), [issueFilteredRows, sortBy]);
|
|
const groups = useMemo(
|
|
() => groupBlockedInboxRows(issueFilteredRows, sortBy),
|
|
[issueFilteredRows, sortBy],
|
|
);
|
|
|
|
const toggleVariant = (variant: string) => {
|
|
setCollapsedVariants((prev) => {
|
|
const next = new Set(prev);
|
|
if (next.has(variant)) next.delete(variant);
|
|
else next.add(variant);
|
|
return next;
|
|
});
|
|
};
|
|
|
|
// A loaded list stays on screen through a failed refetch; an outage before
|
|
// the first load shows the skeleton, and only a real failure shows copy.
|
|
if (isLoading || blockedView.kind === "reconnecting") {
|
|
return (
|
|
<div data-testid="blocked-inbox-loading" className="space-y-3" aria-busy="true">
|
|
{Array.from({ length: 3 }).map((_, groupIdx) => (
|
|
<div key={groupIdx} className="space-y-1">
|
|
<div className="h-4 w-40 animate-pulse rounded bg-muted/70" />
|
|
{Array.from({ length: 2 }).map((__, rowIdx) => (
|
|
<div
|
|
key={rowIdx}
|
|
className={cn(
|
|
"flex items-center gap-3 px-3 py-2.5 sm:px-4",
|
|
presentation === "legacy" && "border-b border-border/60",
|
|
)}
|
|
>
|
|
<div className="h-3.5 w-3.5 animate-pulse rounded-full bg-muted" />
|
|
<div className="h-4 w-16 animate-pulse rounded bg-muted/70" />
|
|
<div className="h-4 w-32 animate-pulse rounded-md bg-muted/70" />
|
|
<div className="h-4 flex-1 animate-pulse rounded bg-muted/60" />
|
|
<div className="hidden h-3 w-24 animate-pulse rounded bg-muted/60 sm:block" />
|
|
</div>
|
|
))}
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (blockedView.kind === "error") {
|
|
return (
|
|
<div
|
|
data-testid="blocked-inbox-error"
|
|
role="alert"
|
|
className="flex flex-col gap-2 rounded-md border border-amber-300/70 bg-amber-50/90 p-4 text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200"
|
|
>
|
|
<div className="flex items-start gap-2">
|
|
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0" aria-hidden="true" />
|
|
<div className="flex-1 space-y-1">
|
|
<p className="text-sm font-medium">Couldn't load the Blocked tab.</p>
|
|
<p className="text-xs opacity-80">
|
|
Other Inbox tabs still work. {describeError(blockedView.error, { action: "load the Blocked tab" }).body}
|
|
</p>
|
|
</div>
|
|
<Button
|
|
type="button"
|
|
variant="outline"
|
|
size="sm"
|
|
className="h-7 shrink-0 border-amber-400/70 bg-white/40 text-amber-900 hover:bg-white/70 dark:bg-amber-500/20 dark:text-amber-100"
|
|
onClick={blockedView.retry}
|
|
disabled={blockedView.isFetching}
|
|
>
|
|
{blockedView.isFetching ? "Trying…" : "Try again"}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (allRows.length === 0) {
|
|
return (
|
|
<Card
|
|
data-testid="blocked-inbox-empty"
|
|
className="items-center gap-3 border-border/70 bg-card/40 px-6 py-10 text-center"
|
|
>
|
|
<span className="inline-flex h-10 w-10 items-center justify-center rounded-full bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300">
|
|
<CheckCircle2 className="h-5 w-5" aria-hidden="true" />
|
|
</span>
|
|
<div className="space-y-1">
|
|
<p className="text-sm font-medium text-foreground">No work is stopped.</p>
|
|
<p className="text-xs text-muted-foreground">
|
|
Tasks that need a decision, recovery, or external action will appear here.
|
|
</p>
|
|
</div>
|
|
</Card>
|
|
);
|
|
}
|
|
|
|
if (groups.length === 0) {
|
|
return (
|
|
<div className="space-y-3">
|
|
<Card
|
|
data-testid="blocked-inbox-no-search-results"
|
|
className="block border-border/70 bg-card/40 px-4 py-6 text-center text-sm text-muted-foreground"
|
|
>
|
|
No stopped items match your search.
|
|
</Card>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div data-testid="blocked-inbox" className="space-y-3">
|
|
<div className="overflow-hidden rounded-xl">
|
|
{groupBy === "none" ? (
|
|
sortedRows.map((row) => (
|
|
<BlockedInboxRow
|
|
key={row.issue.id}
|
|
row={row}
|
|
issueLinkState={issueLinkState}
|
|
agentNameById={agentNameById} agents={agents}
|
|
userLabelById={userLabelById}
|
|
liveIssueIds={liveIssueIds}
|
|
subtreeLiveCounts={subtreeLiveCounts}
|
|
showStatusColumn={showStatusColumn}
|
|
showIdentifierColumn={showIdentifierColumn}
|
|
showUpdatedColumn={showUpdatedColumn}
|
|
presentation={presentation}
|
|
/>
|
|
))
|
|
) : (
|
|
groups.map((group) => {
|
|
const isCollapsed = collapsedVariants.has(group.variant);
|
|
return (
|
|
<div key={group.variant} data-testid={`blocked-inbox-group-${group.variant}`}>
|
|
<div className={presentation === "task" ? "rounded-lg px-3 sm:pl-0 sm:pr-4" : "px-3 sm:px-4"}>
|
|
<IssueGroupHeader
|
|
label={`${group.label} · ${group.rows.length}`}
|
|
collapsible
|
|
collapsed={isCollapsed}
|
|
onToggle={() => toggleVariant(group.variant)}
|
|
/>
|
|
</div>
|
|
{!isCollapsed && (
|
|
<div>
|
|
{group.rows.map((row) => (
|
|
<BlockedInboxRow
|
|
key={row.issue.id}
|
|
row={row}
|
|
issueLinkState={issueLinkState}
|
|
agentNameById={agentNameById} agents={agents}
|
|
userLabelById={userLabelById}
|
|
liveIssueIds={liveIssueIds}
|
|
subtreeLiveCounts={subtreeLiveCounts}
|
|
showStatusColumn={showStatusColumn}
|
|
showIdentifierColumn={showIdentifierColumn}
|
|
showUpdatedColumn={showUpdatedColumn}
|
|
presentation={presentation}
|
|
/>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
})
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
interface BlockedInboxRowProps {
|
|
row: BlockedInboxIssueRow;
|
|
issueLinkState: unknown;
|
|
agentNameById: ReadonlyMap<string, string>;
|
|
agents?: import("./AgentAvatar").AvatarAgent[];
|
|
userLabelById?: ReadonlyMap<string, string>;
|
|
liveIssueIds: ReadonlySet<string>;
|
|
subtreeLiveCounts: ReadonlyMap<string, number>;
|
|
showStatusColumn: boolean;
|
|
showIdentifierColumn: boolean;
|
|
showUpdatedColumn: boolean;
|
|
presentation: IssueRowPresentation;
|
|
}
|
|
|
|
function resolveOwnerName(
|
|
row: BlockedInboxIssueRow,
|
|
agentNameById: ReadonlyMap<string, string>,
|
|
userLabelById?: ReadonlyMap<string, string>,
|
|
): { label: string | null; isAgent: boolean } {
|
|
const owner = row.attention.owner;
|
|
if (owner.label) return { label: owner.label, isAgent: owner.type === "agent" };
|
|
if (owner.agentId) {
|
|
return { label: agentNameById.get(owner.agentId) ?? null, isAgent: true };
|
|
}
|
|
if (owner.userId) {
|
|
return { label: userLabelById?.get(owner.userId) ?? null, isAgent: false };
|
|
}
|
|
return { label: null, isAgent: false };
|
|
}
|
|
|
|
function BlockedInboxRow({
|
|
row,
|
|
issueLinkState,
|
|
agentNameById,
|
|
agents,
|
|
userLabelById,
|
|
liveIssueIds,
|
|
subtreeLiveCounts,
|
|
showStatusColumn,
|
|
showIdentifierColumn,
|
|
showUpdatedColumn,
|
|
presentation,
|
|
}: BlockedInboxRowProps) {
|
|
const { label: ownerName, isAgent } = resolveOwnerName(row, agentNameById, userLabelById);
|
|
const stoppedAge = formatStoppedAge(row.attention.stoppedSinceAt);
|
|
const blockerAttention = resolveInboxIssueBlockerAttention(row.issue, {
|
|
isLive: liveIssueIds.has(row.issue.id),
|
|
loadedSubtreeLiveCount: subtreeLiveCounts.get(row.issue.id) ?? 0,
|
|
});
|
|
|
|
const desktopTrailing = (
|
|
<span className="flex shrink-0 items-center gap-3 text-xs">
|
|
<span
|
|
className="hidden w-(--sz-10_5rem) shrink-0 justify-start sm:inline-flex"
|
|
data-testid="blocked-row-reason-column"
|
|
>
|
|
<BlockedReasonChip
|
|
reason={row.attention.reason}
|
|
severity={row.attention.severity}
|
|
className="max-w-full"
|
|
/>
|
|
</span>
|
|
{ownerName ? (
|
|
<span className="hidden w-(--sz-150px) min-w-0 items-center text-muted-foreground sm:inline-flex">
|
|
{isAgent ? <AgentIdentity agent={agents?.find((agent) => agent.id === row.attention.owner.agentId) ?? { id: row.attention.owner.agentId ?? undefined, name: ownerName }} size="xs" className="max-w-full" /> : <Identity name={ownerName} size="xs" className="max-w-full" />}
|
|
</span>
|
|
) : (
|
|
<span className="hidden w-(--sz-150px) shrink-0 sm:inline-flex" aria-hidden="true" />
|
|
)}
|
|
{presentation === "legacy" && showUpdatedColumn ? (
|
|
<span className="hidden w-(--sz-5_75rem) text-right text-muted-foreground sm:inline" data-testid="blocked-row-age">
|
|
{stoppedAge}
|
|
</span>
|
|
) : null}
|
|
</span>
|
|
);
|
|
|
|
const mobileMeta = (
|
|
<span className="flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground">
|
|
{presentation === "legacy" && <span data-testid="blocked-row-age-mobile">{stoppedAge}</span>}
|
|
{ownerName ? (
|
|
<>
|
|
{presentation === "legacy" && <span aria-hidden="true">·</span>}
|
|
<span
|
|
className={cn(isAgent ? "font-medium text-foreground/90" : null)}
|
|
data-testid="blocked-row-owner-mobile"
|
|
>
|
|
{ownerName}
|
|
</span>
|
|
</>
|
|
) : null}
|
|
</span>
|
|
);
|
|
|
|
return (
|
|
<IssueRow
|
|
issue={row.issue}
|
|
issueLinkState={issueLinkState}
|
|
presentation={presentation}
|
|
showDivider={presentation === "legacy"}
|
|
statusSlot={presentation === "task"
|
|
? showStatusColumn
|
|
? <StatusIcon {...taskStatusIconProps(row.issue)} blockerAttention={blockerAttention} />
|
|
: <span className="inline-flex size-4" aria-hidden="true" />
|
|
: undefined}
|
|
showIdentifier={presentation === "task" ? showIdentifierColumn : undefined}
|
|
desktopMetaLeading={presentation === "legacy" ? (
|
|
<BlockedRowDesktopMeta
|
|
row={row}
|
|
blockerAttention={blockerAttention}
|
|
showStatusColumn={showStatusColumn}
|
|
showIdentifierColumn={showIdentifierColumn}
|
|
/>
|
|
) : undefined}
|
|
mobileLeading={
|
|
<span className="flex shrink-0 items-center gap-1.5 pt-px">
|
|
<StatusIcon {...taskStatusIconProps(row.issue)} blockerAttention={blockerAttention} />
|
|
</span>
|
|
}
|
|
titleSuffix={
|
|
<BlockedReasonChip
|
|
reason={row.attention.reason}
|
|
severity={row.attention.severity}
|
|
className="ml-2 max-w-(--sz-12rem) align-middle sm:hidden"
|
|
/>
|
|
}
|
|
mobileMeta={mobileMeta}
|
|
mobileTitleMeta={presentation === "task" ? <span data-testid="blocked-row-age-mobile">{stoppedAge}</span> : undefined}
|
|
desktopTrailing={desktopTrailing}
|
|
trailingMeta={presentation === "task" && showUpdatedColumn ? stoppedAge : null}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function BlockedRowDesktopMeta({
|
|
row,
|
|
blockerAttention,
|
|
showStatusColumn,
|
|
showIdentifierColumn,
|
|
}: {
|
|
row: BlockedInboxIssueRow;
|
|
blockerAttention: Issue["blockerAttention"] | null;
|
|
showStatusColumn: boolean;
|
|
showIdentifierColumn: boolean;
|
|
}) {
|
|
const identifier = row.issue.identifier ?? row.issue.id.slice(0, 8);
|
|
return (
|
|
<span className="hidden shrink-0 items-center gap-2 sm:inline-flex">
|
|
{showStatusColumn ? <StatusIcon {...taskStatusIconProps(row.issue)} blockerAttention={blockerAttention} /> : null}
|
|
{showIdentifierColumn ? <span className="font-mono text-xs text-muted-foreground">{identifier}</span> : null}
|
|
</span>
|
|
);
|
|
}
|