From b3cf40aa29428094d80119cee8ae28c0174143ef Mon Sep 17 00:00:00 2001 From: Dotta Date: Sun, 7 Jun 2026 02:08:41 +0000 Subject: [PATCH] Add issue Documents tab + Open-in-Documents ergonomics (PAP-10569) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applies PAP-10571 must-fix UX review items to the Documents library: 1. + New document CTA on filter row (top-right) and empty state 2. Linked-work filter — client-side backlink-identifier search, URL-state debounced, chip + clear behaviour matches Status/Owner pattern 3. Sort lifted to labelled "Updated ↓" dropdown next to filters; sliders popover now holds only Has-feedback / Trusted-sources toggles 4. Status labels: Title Case (In review / Draft / Approved / Archived) via DOC_STATUS_LABEL map in DocumentRow; StatusBadge untouched 5. Identifier prefix: "PAP · ux-spec" format (companyPrefix prop on DocumentRow); story updated with companyPrefix="PAP" All existing tests pass; typecheck clean. Co-Authored-By: Paperclip --- ui/src/components/documents/DocumentRow.tsx | 24 ++- ui/src/pages/Documents.tsx | 167 ++++++++++++++++-- .../stories/documents-library.stories.tsx | 19 +- 3 files changed, 185 insertions(+), 25 deletions(-) diff --git a/ui/src/components/documents/DocumentRow.tsx b/ui/src/components/documents/DocumentRow.tsx index 657831422b0..a963fc33e9e 100644 --- a/ui/src/components/documents/DocumentRow.tsx +++ b/ui/src/components/documents/DocumentRow.tsx @@ -13,10 +13,10 @@ import { import type { LucideIcon } from "lucide-react"; import type { CompanyDocumentSummary, DocumentType } from "@paperclipai/shared"; import { EntityRow } from "../EntityRow"; -import { StatusBadge } from "../StatusBadge"; import { Identity, deriveInitials } from "../Identity"; import { relativeTime } from "@/lib/utils"; import { cn } from "@/lib/utils"; +import { statusBadge, statusBadgeDefault } from "@/lib/status-colors"; const DOC_TYPE_ICON: Record = { plan: ListTodo, @@ -34,6 +34,13 @@ const STATUS_DOT: Record = { archived: "bg-muted-foreground", }; +const DOC_STATUS_LABEL: Record = { + draft: "Draft", + in_review: "In review", + approved: "Approved", + archived: "Archived", +}; + export interface DocumentOwner { name: string; avatarUrl?: string | null; @@ -47,6 +54,7 @@ interface DocumentRowProps { /** Short identifier shown in monospace — typically the issue document key. */ identifier?: string; selected?: boolean; + companyPrefix?: string; } /** @@ -54,7 +62,7 @@ interface DocumentRowProps { * issues/projects list rhythm: leading status dot + type icon, monospace * identifier, title, then owner / source-trust / feedback-count / updated meta. */ -export function DocumentRow({ document, to, owner, identifier, selected }: DocumentRowProps) { +export function DocumentRow({ document, to, owner, identifier, selected, companyPrefix }: DocumentRowProps) { const TypeIcon = DOC_TYPE_ICON[document.documentType] ?? FileText; const counts = document.feedbackCounts; const openComments = counts.openComments + counts.openReviewThreads; @@ -71,6 +79,12 @@ export function DocumentRow({ document, to, owner, identifier, selected }: Docum const resolvedIdentifier = identifier ?? primaryBacklink?.issueDocumentKey ?? undefined; + const displayIdentifier = resolvedIdentifier + ? companyPrefix + ? `${companyPrefix} · ${resolvedIdentifier}` + : resolvedIdentifier + : undefined; + return (