Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: improve issue comment

Gus98dda92e296a
diff --git a/src/web/src/app/(app)/w/[slug]/issues/page.tsx b/src/web/src/app/(app)/w/[slug]/issues/page.tsx
index 8324536c6..88ef26170 100644
--- a/src/web/src/app/(app)/w/[slug]/issues/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/issues/page.tsx
@@ -139,6 +139,41 @@ function DroppableColumn({ id, children, className }: { id: string; children: Re
);
}
+function CollapsedCompletedStrip({ activeDragId, completedCount, onExpand }: { activeDragId: string | null; completedCount: number; onExpand: () => void }) {
+ const { isOver, setNodeRef } = useDroppable({ id: "completed" });
+
+ return (
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <div
+ ref={setNodeRef}
+ role="button"
+ tabIndex={0}
+ aria-label="Show completed column"
+ onClick={() => { if (!activeDragId) onExpand(); }}
+ onKeyDown={(e) => { if ((e.key === "Enter" || e.key === " ") && !activeDragId) { e.preventDefault(); onExpand(); } }}
+ className={cn(
+ "flex h-full items-center justify-center rounded-lg border transition-colors",
+ isOver
+ ? "ring-2 ring-primary/40 bg-primary/5 border-primary/30"
+ : "border-dashed border-border/60 bg-muted/20 cursor-pointer hover:bg-muted/40"
+ )}
+ />
+ }
+ >
+ <div className="flex flex-col items-center justify-center gap-3 h-full py-3">
+ <Eye className="size-3.5 text-muted-foreground/60 shrink-0" />
+ <span className="text-xs font-medium text-muted-foreground" style={{ writingMode: "vertical-rl" }}>
+ Completed ({completedCount})
+ </span>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>{activeDragId ? "Drop to complete" : "Show completed"}</TooltipContent>
+ </Tooltip>
+ );
+}
+
function DraggableIssueCard({
issue,
selected,
@@ -177,8 +212,6 @@ export default function IssuesPage() {
const [issues, setIssues] = useState<Issue[]>([]);
const [loading, setLoading] = useState(true);
const [creating, setCreating] = useState(false);
- const [saving, setSaving] = useState(false);
- const [deleting, setDeleting] = useState(false);
const [sheetOpen, setSheetOpen] = useState(false);
const [selectedId, setSelectedId] = useState<string | null>(null);
const [detail, setDetail] = useState<{ issue: Issue & { trace_id?: string | null }; messages: Message[]; comments: IssueComment[]; artifacts: Artifact[] } | null>(null);
@@ -316,20 +349,14 @@ export default function IssuesPage() {
}, [workspaceId]); // eslint-disable-line react-hooks/exhaustive-deps
const handleUpdate = useCallback(async (issueId: string, patch: { title?: string; description?: string }) => {
- setSaving(true);
try {
const updated = await updateIssue(workspaceId, issueId, patch);
setIssues((prev) => prev.map((i) => i.id === issueId ? { ...i, ...patch, updated_at: updated.updated_at } : i));
- if (detail?.issue.id === issueId) {
- setDetail((prev) => prev ? { ...prev, issue: { ...prev.issue, ...patch, updated_at: updated.updated_at } } : prev);
- }
- toast.success("Issue updated");
+ setDetail((prev) => prev && prev.issue.id === issueId ? { ...prev, issue: { ...prev.issue, ...patch, updated_at: updated.updated_at } } : prev);
} catch (err) {
toast.error(err instanceof Error ? err.message : "Failed to update issue");
- } finally {
- setSaving(false);
}
- }, [workspaceId, detail]); // eslint-disable-line react-hooks/exhaustive-deps
+ }, [workspaceId]);
const handleStatusChange = useCallback(async (issueId: string, newStatus: string) => {
const issue = issues.find((i) => i.id === issueId);
@@ -357,21 +384,6 @@ export default function IssuesPage() {
}
}, [workspaceId, issues, detail]); // eslint-disable-line react-hooks/exhaustive-deps
- const handleDeleteFromSheet = useCallback(async (issueId: string) => {
- setDeleting(true);
- try {
- await deleteIssue(workspaceId, issueId);
- setIssues((prev) => prev.filter((i) => i.id !== issueId));
- setSheetOpen(false);
- setSelectedId(null);
- setDetail(null);
- toast.success("Issue deleted");
- } catch (err) {
- toast.error(err instanceof Error ? err.message : "Failed to delete issue");
- } finally {
- setDeleting(false);
- }
- }, [workspaceId]);
const handleDeleteIssue = useCallback(async (issueId: string) => {
try {
@@ -521,31 +533,11 @@ export default function IssuesPage() {
);
})}
{!showCompleted && (
- <Tooltip>
- <TooltipTrigger
- render={
- <div
- role="button"
- tabIndex={0}
- aria-label="Show completed column"
- onClick={() => { if (!activeDragId) setShowCompleted(true); }}
- onKeyDown={(e) => { if ((e.key === "Enter" || e.key === " ") && !activeDragId) { e.preventDefault(); setShowCompleted(true); } }}
- className={cn(
- "flex h-full items-center justify-center rounded-lg border border-dashed border-border/60 bg-muted/20 transition-colors",
- activeDragId ? "pointer-events-none opacity-40" : "cursor-pointer hover:bg-muted/40"
- )}
- />
- }
- >
- <div className="flex flex-col items-center justify-center gap-3 h-full py-3">
- <Eye className="size-3.5 text-muted-foreground/60 shrink-0" />
- <span className="text-xs font-medium text-muted-foreground" style={{ writingMode: "vertical-rl" }}>
- Completed ({issues.filter(i => (COLUMNS[3].statuses as readonly string[]).includes(i.status)).length})
- </span>
- </div>
- </TooltipTrigger>
- <TooltipContent>Show completed</TooltipContent>
- </Tooltip>
+ <CollapsedCompletedStrip
+ activeDragId={activeDragId}
+ completedCount={issues.filter(i => (COLUMNS[3].statuses as readonly string[]).includes(i.status)).length}
+ onExpand={() => setShowCompleted(true)}
+ />
)}
</div>
<DragOverlay style={{ zIndex: 9999 }}>
@@ -636,8 +628,6 @@ export default function IssuesPage() {
activeTask={activeTask}
taskLatestText={taskLatestText}
submitting={creating}
- saving={saving}
- deleting={deleting}
defaultAgentId={recentAgentId}
slug={slug}
workspaceId={workspaceId}
@@ -648,7 +638,6 @@ export default function IssuesPage() {
onCreate={handleCreate}
onUpdate={handleUpdate}
onStatusChange={handleStatusChange}
- onDelete={handleDeleteFromSheet}
onCommented={() => selectedId && openIssue(selectedId)}
/>
</div>
diff --git a/src/web/src/components/issues/issue-sheet.tsx b/src/web/src/components/issues/issue-sheet.tsx
index cb344fc4a..9749ec5cb 100644
--- a/src/web/src/components/issues/issue-sheet.tsx
+++ b/src/web/src/components/issues/issue-sheet.tsx
@@ -11,16 +11,15 @@ import {
import { Button } from "@/components/ui/button";
import { MarkdownEditor } from "@/components/ui/markdown-editor";
import { Skeleton } from "@/components/ui/skeleton";
-import { Textarea } from "@/components/ui/textarea";
import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover";
import {
+ ArrowUp,
Check,
CircleDot,
File as FileIcon,
GitBranch,
Loader2,
MessageSquare,
- Trash2,
User,
} from "lucide-react";
import Link from "next/link";
@@ -174,8 +173,6 @@ export interface IssueSheetProps {
activeTask?: TaskApi | null;
taskLatestText?: string;
submitting?: boolean;
- saving?: boolean;
- deleting?: boolean;
defaultAgentId?: string;
slug: string;
workspaceId: string;
@@ -184,9 +181,8 @@ export interface IssueSheetProps {
draft?: { title: string; description: string; agentId: string };
onDraftChange?: (draft: { title: string; description: string; agentId: string }) => void;
onCreate?: (values: { agent_id?: string; title: string; description: string }) => Promise<void>;
- onUpdate?: (issueId: string, patch: { title?: string; description?: string }) => Promise<void>;
+ onUpdate?: (issueId: string, patch: { title?: string; description?: string }) => void;
onStatusChange?: (issueId: string, status: string) => Promise<void>;
- onDelete?: (issueId: string) => void;
onCommented?: () => void;
}
@@ -200,8 +196,6 @@ export function IssueSheet({
activeTask,
taskLatestText,
submitting,
- saving,
- deleting,
defaultAgentId,
slug,
workspaceId,
@@ -212,7 +206,6 @@ export function IssueSheet({
onCreate,
onUpdate,
onStatusChange,
- onDelete,
onCommented,
}: IssueSheetProps) {
const mode = issue ? "detail" : "create";
@@ -258,10 +251,27 @@ export function IssueSheet({
}
}, [detail?.messages?.length, detail?.comments?.length]);
- // Dirty tracking (detail mode)
- const dirty = mode === "detail" && issue
- ? title !== issue.title || description !== (issue.description ?? "")
- : false;
+ // Auto-save (detail mode): debounce title/description changes
+ const autoSaveTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const onUpdateRef = useRef(onUpdate);
+ useEffect(() => { onUpdateRef.current = onUpdate; }, [onUpdate]);
+ useEffect(() => {
+ if (mode !== "detail" || !issue || !open) return;
+ const titleChanged = title !== issue.title;
+ const descChanged = description !== (issue.description ?? "");
+ if (!titleChanged && !descChanged) return;
+ if (!title.trim()) return;
+
+ if (autoSaveTimer.current) clearTimeout(autoSaveTimer.current);
+ autoSaveTimer.current = setTimeout(() => {
+ const patch: { title?: string; description?: string } = {};
+ if (titleChanged) patch.title = title.trim();
+ if (descChanged) patch.description = description.trim();
+ onUpdateRef.current?.(issue.id, patch);
+ }, 500);
+
+ return () => { if (autoSaveTimer.current) clearTimeout(autoSaveTimer.current); };
+ }, [title, description, mode, issue, open]); // eslint-disable-line react-hooks/exhaustive-deps
// --- Title auto-resize ---
const resizeTitle = useCallback((el?: HTMLTextAreaElement | null) => {
@@ -299,13 +309,6 @@ export function IssueSheet({
await onCreate?.({ agent_id: agentId || undefined, title: title.trim(), description: description.trim() });
};
- const handleSave = async () => {
- if (!issue || !dirty || saving) return;
- const patch: { title?: string; description?: string } = {};
- if (title !== issue.title) patch.title = title.trim();
- if (description !== (issue.description ?? "")) patch.description = description.trim();
- await onUpdate?.(issue.id, patch);
- };
const handleStatusChange = (newStatus: string) => {
if (!issue || newStatus === issue.status) return;
@@ -331,17 +334,16 @@ export function IssueSheet({
}
};
- // Shift+Enter capture handler (skip when inside comment textarea)
+ // Shift+Enter capture handler (create mode only — detail auto-saves)
const commentRef = useRef<HTMLTextAreaElement>(null);
const onKeyDownCapture = useCallback((e: React.KeyboardEvent) => {
- if (e.key === "Enter" && e.shiftKey) {
+ if (e.key === "Enter" && e.shiftKey && mode === "create") {
if (commentRef.current && commentRef.current.contains(e.target as Node)) return;
e.preventDefault();
e.stopPropagation();
- if (mode === "create") handleCreate();
- else handleSave();
+ handleCreate();
}
- }, [mode, title, description, agentId, issue, dirty, submitting, saving]); // eslint-disable-line react-hooks/exhaustive-deps
+ }, [mode, title, description, agentId, submitting]); // eslint-disable-line react-hooks/exhaustive-deps
// Enter on title → focus description
const onTitleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
@@ -355,12 +357,234 @@ export function IssueSheet({
const selectedAgent = agents.find((a) => a.id === agentId) ?? null;
const detailAgent = issue?.agent_id ? agents.find((a) => a.id === issue.agent_id) ?? null : null;
+ // Mobile tab state (only used below lg breakpoint)
+ const [mobileTab, setMobileTab] = useState<"issue" | "activity">("issue");
+
+ // Reset tab when switching issues or modes
+ useEffect(() => {
+ setMobileTab("issue");
+ }, [issue?.id, mode]);
+
+ const timelineContent = (
+ <>
+ {detailLoading ? (
+ <div className="space-y-3">
+ <Skeleton className="h-12" />
+ <Skeleton className="h-8" />
+ <Skeleton className="h-12" />
+ </div>
+ ) : (() => {
+ const events = (detail?.messages ?? [])
+ .filter((m) => m.role === "event")
+ .map((m) => ({ kind: "event" as const, id: m.id, created_at: m.created_at, data: m }));
+ const comments = (detail?.comments ?? [])
+ .map((c) => ({ kind: "comment" as const, id: c.id, created_at: c.created_at, data: c }));
+ const timeline = [...events, ...comments].sort(
+ (a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
+ );
+
+ if (timeline.length === 0 && !isTaskActive) {
+ return <div className="text-xs text-muted-foreground">No activity yet.</div>;
+ }
+
+ return (
+ <div className="relative pl-4">
+ <div className="absolute left-[4.5px] top-2 bottom-2 w-px bg-border" />
+ <div className="space-y-3">
+ {timeline.map((item) => (
+ <div key={item.id} className="relative">
+ <div className="absolute -left-4 top-2.5 size-2.5 rounded-full border-2 border-background bg-muted-foreground/40" />
+ {item.kind === "event"
+ ? <MessageRow message={item.data} />
+ : <CommentRow comment={item.data} agents={agents} />}
+ </div>
+ ))}
+ {isTaskActive && (
+ <div className="relative">
+ <div className="absolute -left-4 top-2.5 size-2.5 rounded-full border-2 border-background bg-emerald-500 animate-pulse" />
+ <div className="rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2">
+ <div className="flex items-center gap-2 text-xs text-emerald-600 dark:text-emerald-400">Working</div>
+ {taskLatestText && <p className="mt-1 text-[11px] text-muted-foreground line-clamp-2">{taskLatestText}</p>}
+ </div>
+ </div>
+ )}
+ </div>
+ </div>
+ );
+ })()}
+ </>
+ );
+
+ const commentInput = mode === "detail" && issue && !isTaskActive && !isTerminalIssueStatus(issue.status) ? (
+ <div className="flex flex-col rounded-xl border bg-background/60 transition-colors duration-200 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50">
+ <textarea
+ ref={commentRef}
+ placeholder="Leave a comment..."
+ value={commentContent}
+ onChange={(e) => setCommentContent(e.target.value)}
+ className="w-full resize-none bg-transparent px-3.5 py-2.5 text-sm leading-relaxed outline-none placeholder:text-muted-foreground field-sizing-content min-h-[60px] max-h-32 thin-scrollbar overflow-y-auto"
+ onKeyDown={(e) => { if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) handleCommentSubmit(); }}
+ />
+ <div className="flex items-center justify-between px-2.5 pb-2 pt-0.5">
+ <kbd className="text-[11px] text-muted-foreground/50 font-sans select-none">⌘↵</kbd>
+ <Button
+ size="icon-sm"
+ onClick={handleCommentSubmit}
+ disabled={!commentContent.trim() || commentSubmitting}
+ className={cn("rounded-lg transition-opacity duration-200", !commentContent.trim() && !commentSubmitting && "opacity-40")}
+ >
+ {commentSubmitting ? <Loader2 className="size-3.5 animate-spin" /> : <ArrowUp className="size-3.5" />}
+ </Button>
+ </div>
+ </div>
+ ) : null;
+
+ const issueFormContent = (
+ <>
+ {/* Title */}
+ <div className="shrink-0 px-2 sm:px-3 pt-5 pb-1">
+ <textarea
+ ref={(el) => {
+ titleRef.current = el;
+ resizeTitle(el);
+ }}
+ value={title}
+ onChange={(e) => {
+ setTitle(e.target.value);
+ resizeTitle(e.target);
+ }}
+ onKeyDown={onTitleKeyDown}
+ placeholder={mode === "create" ? "New issue" : "Untitled"}
+ autoFocus={mode === "create"}
+ rows={1}
+ className="w-full resize-none overflow-hidden rounded-none border-0 bg-transparent px-0 py-1 font-news text-2xl md:text-3xl font-medium leading-[1.2] tracking-tight shadow-none outline-none focus-visible:border-0 focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground/40 placeholder:font-normal"
+ />
+ </div>
+
+ {/* Properties */}
+ <div className="shrink-0 space-y-1.5 px-2 sm:px-3 py-2">
+ {/* Agent row */}
+ <PropertyRow icon={<User className="size-3.5" />}>
+ {mode === "create" ? (
+ <Popover open={assigneeOpen} onOpenChange={setAssigneeOpen}>
+ <PopoverTrigger
+ render={
+ <button
+ type="button"
+ disabled={submitting}
+ className={cn(GHOST_CONTROL, "flex items-center gap-1.5 rounded-md")}
+ />
+ }
+ >
+ {selectedAgent ? (
+ <span className="truncate">{selectedAgent.name}</span>
+ ) : (
+ <span className="text-muted-foreground/70">Unassigned</span>
+ )}
+ </PopoverTrigger>
+ <PopoverContent align="start" className="max-h-64 w-72 overflow-y-auto thin-scrollbar p-1">
+ <button
+ type="button"
+ onClick={() => { setAgentId(""); setAssigneeOpen(false); }}
+ className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors hover:bg-accent hover:text-accent-foreground"
+ >
+ <span className="text-muted-foreground">None (unassigned)</span>
+ {!agentId ? <Check className="size-3.5 shrink-0" /> : null}
+ </button>
+ {agents.map((agent) => (
+ <button
+ key={agent.id}
+ type="button"
+ onClick={() => { setAgentId(agent.id); setAssigneeOpen(false); }}
+ className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors hover:bg-accent hover:text-accent-foreground"
+ >
+ <AgentIdentity agent={agent} size={18} />
+ {agentId === agent.id ? <Check className="size-3.5 shrink-0" /> : null}
+ </button>
+ ))}
+ </PopoverContent>
+ </Popover>
+ ) : (
+ <span className="text-xs truncate">
+ {detailAgent ? detailAgent.name : <span className="text-muted-foreground/70">Unassigned</span>}
+ </span>
+ )}
+ </PropertyRow>
+
+ {/* Status row (detail mode only) */}
+ {mode === "detail" && issue && (
+ <PropertyRow icon={<CircleDot className="size-3.5" />}>
+ <select
+ value={issue.status}
+ onChange={(e) => handleStatusChange(e.target.value)}
+ className={GHOST_SELECT}
+ >
+ {SELECTOR_STATUSES.map((s) => (
+ <option key={s} value={s}>{statusLabel(s)}</option>
+ ))}
+ </select>
+ </PropertyRow>
+ )}
+
+ {/* Chat link row */}
+ {mode === "detail" && issue?.agent_id && issue?.conversation_id && (
+ <PropertyRow icon={<MessageSquare className="size-3.5" />}>
+ <Link
+ href={`/w/${slug}/agents/${issue.agent_id}?conv=${issue.conversation_id}${issue.latest_task_id ? `&task=${issue.latest_task_id}` : ""}`}
+ className={cn(GHOST_CONTROL, "inline-flex items-center rounded-md")}
+ >
+ Chat
+ </Link>
+ </PropertyRow>
+ )}
+
+ {/* Thread link row */}
+ {mode === "detail" && detail?.traceId && (
+ <PropertyRow icon={<GitBranch className="size-3.5" />}>
+ <Link
+ href={`/w/${slug}/threads/${detail.traceId}`}
+ className={cn(GHOST_CONTROL, "inline-flex items-center rounded-md")}
+ >
+ Thread
+ </Link>
+ </PropertyRow>
+ )}
+ </div>
+
+ {/* Description */}
+ <div
+ className={cn(
+ "px-2 sm:px-3 py-2 flex-1 min-h-0 overflow-y-auto thin-scrollbar"
+ )}
+ ref={descriptionRef}
+ >
+ <MarkdownEditor
+ key={issue?.id ?? "new"}
+ value={description}
+ onChange={setDescription}
+ placeholder="Describe the issue..."
+ minHeight={mode === "create" ? "10rem" : "4rem"}
+ variant="seamless"
+ contentType="markdown"
+ agents={agents}
+ />
+ </div>
+
+ {/* Attachments (detail mode) */}
+ {mode === "detail" && detail?.artifacts && detail.artifacts.length > 0 && (
+ <div className="shrink-0 px-2 sm:px-3 py-2">
+ <AttachmentList artifacts={detail.artifacts} workspaceId={workspaceId} />
+ </div>
+ )}
+ </>
+ );
+
return (
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent
side="right"
showCloseButton={false}
- className="data-[side=right]:sm:inset-y-2 data-[side=right]:sm:right-2 data-[side=right]:sm:h-auto data-[side=right]:sm:rounded-xl data-[side=right]:sm:border"
+ className="data-[side=right]:sm:inset-y-2 data-[side=right]:sm:right-2 data-[side=right]:sm:h-auto data-[side=right]:sm:rounded-xl data-[side=right]:sm:border overflow-visible"
style={{ width: `min(${width}px, 100vw)`, maxWidth: "none" }}
>
{/* Resize drag handle */}
@@ -372,282 +596,103 @@ export function IssueSheet({
className="hidden sm:block absolute -left-px top-0 bottom-0 w-1.5 cursor-col-resize z-10 hover:bg-primary/20 active:bg-primary/30 transition-colors rounded-l-xl"
/>
+ {/* Timeline floating panel — desktop only, detail mode only */}
+ {mode === "detail" && (
+ <div className="hidden lg:flex absolute right-full top-0 bottom-0 mr-2 w-[360px] flex-col rounded-xl border bg-background shadow-lg overflow-hidden">
+ <div className="shrink-0 flex items-center border-b px-4 py-2.5">
+ <span className="text-xs font-medium text-muted-foreground">Activity</span>
+ </div>
+ <div ref={timelineRef} className="flex-1 min-h-0 overflow-y-auto thin-scrollbar px-4 py-4 space-y-3">
+ {timelineContent}
+ </div>
+ {commentInput && (
+ <div className="shrink-0 border-t px-4 py-3">
+ {commentInput}
+ </div>
+ )}
+ </div>
+ )}
+
{/* Hidden accessible title */}
<SheetTitle className="sr-only">
{mode === "create" ? "New Issue" : (issue?.title ?? "Issue")}
</SheetTitle>
<div className="flex flex-1 min-h-0 flex-col" onKeyDownCapture={onKeyDownCapture}>
- <SheetBody className="flex flex-col gap-0 p-0 overflow-hidden">
- {/* Title */}
- <div className="shrink-0 px-2 sm:px-3 pt-5 pb-1">
- <textarea
- ref={(el) => {
- titleRef.current = el;
- resizeTitle(el);
- }}
- value={title}
- onChange={(e) => {
- setTitle(e.target.value);
- resizeTitle(e.target);
- }}
- onKeyDown={onTitleKeyDown}
- placeholder={mode === "create" ? "New issue" : "Untitled"}
- autoFocus={mode === "create"}
- rows={1}
- className="w-full resize-none overflow-hidden rounded-none border-0 bg-transparent px-0 py-1 font-news text-2xl md:text-3xl font-medium leading-[1.2] tracking-tight shadow-none outline-none focus-visible:border-0 focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground/40 placeholder:font-normal"
- />
- </div>
-
- {/* Properties */}
- <div className="shrink-0 space-y-1.5 px-2 sm:px-3 py-2">
- {/* Agent row */}
- <PropertyRow icon={<User className="size-3.5" />}>
- {mode === "create" ? (
- <Popover open={assigneeOpen} onOpenChange={setAssigneeOpen}>
- <PopoverTrigger
- render={
- <button
- type="button"
- disabled={submitting}
- className={cn(GHOST_CONTROL, "flex items-center gap-1.5 rounded-md")}
- />
- }
- >
- {selectedAgent ? (
- <span className="truncate">{selectedAgent.name}</span>
- ) : (
- <span className="text-muted-foreground/70">Unassigned</span>
- )}
- </PopoverTrigger>
- <PopoverContent align="start" className="max-h-64 w-72 overflow-y-auto thin-scrollbar p-1">
- <button
- type="button"
- onClick={() => { setAgentId(""); setAssigneeOpen(false); }}
- className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors hover:bg-accent hover:text-accent-foreground"
- >
- <span className="text-muted-foreground">None (unassigned)</span>
- {!agentId ? <Check className="size-3.5 shrink-0" /> : null}
- </button>
- {agents.map((agent) => (
- <button
- key={agent.id}
- type="button"
- onClick={() => { setAgentId(agent.id); setAssigneeOpen(false); }}
- className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors hover:bg-accent hover:text-accent-foreground"
- >
- <AgentIdentity agent={agent} size={18} />
- {agentId === agent.id ? <Check className="size-3.5 shrink-0" /> : null}
- </button>
- ))}
- </PopoverContent>
- </Popover>
- ) : (
- <span className="text-xs truncate">
- {detailAgent ? detailAgent.name : <span className="text-muted-foreground/70">Unassigned</span>}
- </span>
+ {/* Mobile tab switcher (detail mode only, below lg) */}
+ {mode === "detail" && (
+ <div className="shrink-0 flex items-center gap-1 border-b px-2 py-1.5 lg:hidden">
+ <button
+ type="button"
+ onClick={() => setMobileTab("issue")}
+ className={cn(
+ "rounded-md px-2.5 py-1 text-xs font-medium transition-colors",
+ mobileTab === "issue" ? "bg-accent text-foreground" : "text-muted-foreground hover:text-foreground"
)}
- </PropertyRow>
-
- {/* Status row (detail mode only) */}
- {mode === "detail" && issue && (
- <PropertyRow icon={<CircleDot className="size-3.5" />}>
- <select
- value={issue.status}
- onChange={(e) => handleStatusChange(e.target.value)}
- className={GHOST_SELECT}
- >
- {SELECTOR_STATUSES.map((s) => (
- <option key={s} value={s}>{statusLabel(s)}</option>
- ))}
- </select>
- </PropertyRow>
- )}
-
- {/* Chat link row */}
- {mode === "detail" && issue?.agent_id && issue?.conversation_id && (
- <PropertyRow icon={<MessageSquare className="size-3.5" />}>
- <Link
- href={`/w/${slug}/agents/${issue.agent_id}?conv=${issue.conversation_id}${issue.latest_task_id ? `&task=${issue.latest_task_id}` : ""}`}
- className={cn(GHOST_CONTROL, "inline-flex items-center rounded-md")}
- >
- Chat
- </Link>
- </PropertyRow>
- )}
-
- {/* Thread link row */}
- {mode === "detail" && detail?.traceId && (
- <PropertyRow icon={<GitBranch className="size-3.5" />}>
- <Link
- href={`/w/${slug}/threads/${detail.traceId}`}
- className={cn(GHOST_CONTROL, "inline-flex items-center rounded-md")}
- >
- Thread
- </Link>
- </PropertyRow>
- )}
+ >
+ Issue
+ </button>
+ <button
+ type="button"
+ onClick={() => setMobileTab("activity")}
+ className={cn(
+ "rounded-md px-2.5 py-1 text-xs font-medium transition-colors",
+ mobileTab === "activity" ? "bg-accent text-foreground" : "text-muted-foreground hover:text-foreground"
+ )}
+ >
+ Activity
+ </button>
</div>
+ )}
- {/* Description */}
- <div
- className={cn(
- "px-2 sm:px-3 py-2",
- mode === "create" ? "shrink-0" : "shrink-0 max-h-48 overflow-y-auto thin-scrollbar"
- )}
- ref={descriptionRef}
- >
- <MarkdownEditor
- key={issue?.id ?? "new"}
- value={description}
- onChange={setDescription}
- placeholder="Describe the issue..."
- minHeight={mode === "create" ? "10rem" : "4rem"}
- variant="seamless"
- contentType="markdown"
- agents={agents}
- />
+ <SheetBody className="flex flex-col gap-0 p-0 overflow-hidden">
+ {/* Issue form: always visible on desktop, tab-controlled on mobile */}
+ <div className={cn(
+ "flex flex-col flex-1 min-h-0",
+ mode === "detail" && mobileTab === "activity" && "hidden lg:flex"
+ )}>
+ {issueFormContent}
</div>
- {/* Attachments (detail mode) */}
- {mode === "detail" && detail?.artifacts && detail.artifacts.length > 0 && (
- <div className="shrink-0 px-2 sm:px-3 py-2">
- <AttachmentList artifacts={detail.artifacts} workspaceId={workspaceId} />
- </div>
- )}
-
- {/* Timeline (detail mode only) */}
- {mode === "detail" && (
- <div
- ref={timelineRef}
- className="flex-1 min-h-0 overflow-y-auto thin-scrollbar border rounded-lg mx-2 sm:mx-3 mb-3 px-4 py-4 space-y-3"
- >
- {detailLoading ? (
- <div className="space-y-3">
- <Skeleton className="h-12" />
- <Skeleton className="h-8" />
- <Skeleton className="h-12" />
- </div>
- ) : (() => {
- const events = (detail?.messages ?? [])
- .filter((m) => m.role === "event")
- .map((m) => ({ kind: "event" as const, id: m.id, created_at: m.created_at, data: m }));
- const comments = (detail?.comments ?? [])
- .map((c) => ({ kind: "comment" as const, id: c.id, created_at: c.created_at, data: c }));
- const timeline = [...events, ...comments].sort(
- (a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
- );
-
- if (timeline.length === 0 && !isTaskActive) {
- return <div className="text-xs text-muted-foreground">No activity yet.</div>;
- }
-
- return (
- <div className="relative pl-4">
- <div className="absolute left-[5px] top-2 bottom-2 w-px bg-border" />
- <div className="space-y-3">
- {timeline.map((item) => (
- <div key={item.id} className="relative">
- <div className="absolute -left-4 top-2.5 size-2.5 rounded-full border-2 border-background bg-muted-foreground/40" />
- {item.kind === "event"
- ? <MessageRow message={item.data} />
- : <CommentRow comment={item.data} agents={agents} />}
- </div>
- ))}
- {isTaskActive && (
- <div className="relative">
- <div className="absolute -left-4 top-2.5 size-2.5 rounded-full border-2 border-background bg-emerald-500 animate-pulse" />
- <div className="rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2">
- <div className="flex items-center gap-2 text-xs text-emerald-600 dark:text-emerald-400">Working</div>
- {taskLatestText && <p className="mt-1 text-[11px] text-muted-foreground line-clamp-2">{taskLatestText}</p>}
- </div>
- </div>
- )}
- </div>
- </div>
- );
- })()}
- </div>
- )}
-
- {/* Comment input (detail mode, non-terminal, no active task) */}
- {mode === "detail" && issue && !isTaskActive && !isTerminalIssueStatus(issue.status) && (
- <div className="shrink-0 px-2 sm:px-3 pb-3 space-y-2">
- <Textarea
- ref={commentRef}
- placeholder="Leave a comment..."
- value={commentContent}
- onChange={(e) => setCommentContent(e.target.value)}
- className="min-h-[60px] text-sm"
- onKeyDown={(e) => { if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) handleCommentSubmit(); }}
- />
- <div className="flex justify-end">
- <Button size="sm" onClick={handleCommentSubmit} disabled={!commentContent.trim() || commentSubmitting}>
- {commentSubmitting ? "Sending..." : "Comment"}
- </Button>
+ {/* Mobile timeline view */}
+ {mode === "detail" && mobileTab === "activity" && (
+ <div className="flex flex-col flex-1 min-h-0 lg:hidden">
+ <div className="flex-1 min-h-0 overflow-y-auto thin-scrollbar px-3 py-4 space-y-3">
+ {timelineContent}
</div>
+ {commentInput && (
+ <div className="shrink-0 border-t px-3 py-3">
+ {commentInput}
+ </div>
+ )}
</div>
)}
</SheetBody>
- {/* Footer */}
- <SheetFooter className={cn(mode === "detail" && "sm:justify-between")}>
- {mode === "create" ? (
- <>
- <Button
- variant="outline"
- size="sm"
- onClick={() => onOpenChange(false)}
- disabled={submitting}
- >
- Cancel
- </Button>
- <Button
- size="sm"
- onClick={handleCreate}
- disabled={!title.trim() || submitting}
- >
- {submitting && <Loader2 className="mr-1.5 size-3.5 animate-spin" />}
- <kbd className="mr-1 hidden sm:inline-flex items-center gap-0.5 font-sans font-medium leading-none opacity-60">
- <span>&#x21E7;</span><span>+</span><span>&#x23CE;</span>
- </kbd>
- Create
- </Button>
- </>
- ) : (
- <>
- <Button
- variant="destructive"
- size="sm"
- onClick={() => issue && onDelete?.(issue.id)}
- disabled={deleting || saving}
- >
- <Trash2 className="mr-1.5 size-3.5" />
- Delete
- </Button>
- <div className="flex gap-2">
- <Button
- variant="outline"
- size="sm"
- onClick={() => onOpenChange(false)}
- >
- Cancel
- </Button>
- <Button
- size="sm"
- onClick={handleSave}
- disabled={!dirty || !title.trim() || saving}
- >
- {saving && <Loader2 className="mr-1.5 size-3.5 animate-spin" />}
- <kbd className="mr-1 hidden sm:inline-flex items-center gap-0.5 font-sans font-medium leading-none opacity-60">
- <span>&#x21E7;</span><span>+</span><span>&#x23CE;</span>
- </kbd>
- Save
- </Button>
- </div>
- </>
- )}
- </SheetFooter>
+ {/* Footer — create mode only */}
+ {mode === "create" && (
+ <SheetFooter>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => onOpenChange(false)}
+ disabled={submitting}
+ >
+ Cancel
+ </Button>
+ <Button
+ size="sm"
+ onClick={handleCreate}
+ disabled={!title.trim() || submitting}
+ >
+ {submitting && <Loader2 className="mr-1.5 size-3.5 animate-spin" />}
+ <kbd className="mr-1 hidden sm:inline-flex items-center gap-0.5 font-sans font-medium leading-none opacity-60">
+ <span>&#x21E7;</span><span>+</span><span>&#x23CE;</span>
+ </kbd>
+ Create
+ </Button>
+ </SheetFooter>
+ )}
</div>
</SheetContent>
</Sheet>