Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
merge: resolve conflicts with main (file upload support)
Naiyuan Qing8fae493f0180
diff --cc apps/web/components/common/rich-text-editor.tsxindex dd1c148a7e,8780a86c9a..3ad1425259--- a/apps/web/components/common/rich-text-editor.tsx+++ b/apps/web/components/common/rich-text-editor.tsx@@@ -12,9 -12,12 +12,12 @@@ import Placeholder from "@tiptap/extensimport Link from "@tiptap/extension-link";import Typography from "@tiptap/extension-typography";import Mention from "@tiptap/extension-mention";+ import Image from "@tiptap/extension-image";import { Markdown } from "@tiptap/markdown";-import { Extension } from "@tiptap/core";+import { Extension, mergeAttributes } from "@tiptap/core";+ import { Plugin, PluginKey } from "@tiptap/pm/state";import { cn } from "@/lib/utils";+ import type { UploadResult } from "@/shared/hooks/use-file-upload";import { createMentionSuggestion } from "./mention-suggestion";import "./rich-text-editor.css";@@@ -36,8 -40,23 +40,9 @@@ interface RichTextEditorRefgetMarkdown: () => string;clearContent: () => void;focus: () => void;+ insertFile: (filename: string, url: string, isImage: boolean) => void;}-// ----------------------------------------------------------------------------// Submit shortcut extension (Mod+Enter)-// -----------------------------------------------------------------------------// ----------------------------------------------------------------------------// Mention extension configured for markdown serialization-// Stores as: [@Label](mention://type/id)-// -----------------------------------------------------------------------------// ----------------------------------------------------------------------------// Link extension — always serialize as [text](url), never <url> autolinks;-// support Cmd+Click / Ctrl+Click to open in new tab.-// ----------------------------------------------------------------------------const LinkExtension = Link.configure({openOnClick: true,autolink: true,@@@ -144,7 -236,13 +221,8 @@@ const RichTextEditor = forwardRef<RichTconst debounceRef = useRef<ReturnType<typeof setTimeout>>(undefined);const onUpdateRef = useRef(onUpdate);const onSubmitRef = useRef(onSubmit);+ const onUploadFileRef = useRef(onUploadFile);- // Helper to get markdown from @tiptap/markdown extension- // eslint-disable-next-line @typescript-eslint/no-explicit-any- const getEditorMarkdown = (ed: any): string =>- ed?.getMarkdown?.() ?? "";-// Keep refs in sync without recreating editoronUpdateRef.current = onUpdate;onSubmitRef.current = onSubmit;diff --cc apps/web/features/issues/components/comment-card.tsxindex 2e2b7b511b,85be9106ea..57091474fb--- a/apps/web/features/issues/components/comment-card.tsx+++ b/apps/web/features/issues/components/comment-card.tsx@@@ -1,7 -1,7 +1,7 @@@"use client";-import { useState } from "react";+import { useRef, useState } from "react";- import { Copy, MoreHorizontal, Pencil, Trash2 } from "lucide-react";+ import { ChevronRight, Copy, MoreHorizontal, Pencil, Trash2 } from "lucide-react";import { toast } from "sonner";import { Card } from "@/components/ui/card";import { Button } from "@/components/ui/button";@@@ -13,11 -13,13 +13,13 @@@ importDropdownMenuSeparator,} from "@/components/ui/dropdown-menu";import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";+ import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "@/components/ui/collapsible";import { ActorAvatar } from "@/components/common/actor-avatar";import { ReactionBar } from "@/components/common/reaction-bar";-import { Markdown } from "@/components/markdown";+ import { cn } from "@/lib/utils";import { useActorName } from "@/features/workspace";import { timeAgo } from "@/shared/utils";+import { RichTextEditor, type RichTextEditorRef } from "@/components/common/rich-text-editor";import { ReplyInput } from "./reply-input";import type { TimelineEntry } from "@/shared/types";@@@ -190,6 -193,36 +194,36 @@@ function CommentCard(onDelete,onToggleReaction,}: CommentCardProps) {+ const { getActorName } = useActorName();+ const [open, setOpen] = useState(true);+ const [editing, setEditing] = useState(false);- const [editContent, setEditContent] = useState("");++ const editEditorRef = useRef<RichTextEditorRef>(null);++ const isOwn = entry.actor_type === "member" && entry.actor_id === currentUserId;+ const isTemp = entry.id.startsWith("temp-");++ const startEdit = () => {- setEditContent(entry.content ?? "");+ setEditing(true);+ };++ const cancelEdit = () => {+ setEditing(false);- setEditContent("");+ };++ const saveEdit = async () => {- const trimmed = editContent.trim();++ const trimmed = editEditorRef.current++ ?.getMarkdown()++ ?.replace(/(\n\s*)+$/, "")++ .trim();+ if (!trimmed) return;+ try {+ await onEdit(entry.id, trimmed);+ setEditing(false);- setEditContent("");+ } catch {+ toast.error("Failed to update comment");+ }+ };+// Collect all nested replies recursively into a flat listconst allNestedReplies: TimelineEntry[] = [];const collectReplies = (parentId: string) => {@@@ -201,42 -234,149 +235,150 @@@};collectReplies(entry.id);+ const replyCount = allNestedReplies.length;+ const contentPreview = (entry.content ?? "").replace(/\n/g, " ").slice(0, 80);+ const reactions = entry.reactions ?? [];+return (- <Card className={`!py-0 !gap-0 overflow-hidden${entry.id.startsWith("temp-") ? " opacity-60" : ""}`}>- {/* Parent comment */}- <div className="px-4">- <CommentRow- entry={entry}- currentUserId={currentUserId}- onEdit={onEdit}- onDelete={onDelete}- onToggleReaction={onToggleReaction}- />- </div>+ <Card className={`!py-0 !gap-0 overflow-hidden${isTemp ? " opacity-60" : ""}`}>+ <Collapsible open={open} onOpenChange={setOpen}>+ {/* Header — always visible, acts as toggle */}+ <div className="px-4 py-3">+ <div className="flex items-center gap-2.5">+ <CollapsibleTrigger className="shrink-0 text-muted-foreground hover:text-foreground transition-colors">+ <ChevronRight className={cn("h-3.5 w-3.5 transition-transform", open && "rotate-90")} />+ </CollapsibleTrigger>+ <ActorAvatar actorType={entry.actor_type} actorId={entry.actor_id} size={24} />+ <span className="text-sm font-medium">+ {getActorName(entry.actor_type, entry.actor_id)}+ </span>+ <Tooltip>+ <TooltipTrigger+ render={+ <span className="text-xs text-muted-foreground cursor-default">+ {timeAgo(entry.created_at)}+ </span>+ }+ />+ <TooltipContent side="top">+ {new Date(entry.created_at).toLocaleString()}+ </TooltipContent>+ </Tooltip>- {/* Replies — flat, separated by border */}- {allNestedReplies.map((reply) => (- <div key={reply.id} className="border-t border-border/50 px-4">- <CommentRow- entry={reply}- currentUserId={currentUserId}- onEdit={onEdit}- onDelete={onDelete}- onToggleReaction={onToggleReaction}- />+ {!open && contentPreview && (+ <span className="text-xs text-muted-foreground truncate">+ {contentPreview}{(entry.content ?? "").length > 80 ? "..." : ""}+ </span>+ )}+ {!open && replyCount > 0 && (+ <span className="text-xs text-muted-foreground shrink-0 ml-auto">+ {replyCount} {replyCount === 1 ? "reply" : "replies"}+ </span>+ )}++ {open && !isTemp && (+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <Button variant="ghost" size="icon-xs" className="ml-auto text-muted-foreground">+ <MoreHorizontal className="h-4 w-4" />+ </Button>+ }+ />+ <DropdownMenuContent align="end">+ <DropdownMenuItem onClick={() => {+ navigator.clipboard.writeText(entry.content ?? "");+ toast.success("Copied");+ }}>+ <Copy className="h-3.5 w-3.5" />+ Copy+ </DropdownMenuItem>+ {isOwn && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem onClick={startEdit}>+ <Pencil className="h-3.5 w-3.5" />+ Edit+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem onClick={() => onDelete(entry.id)} variant="destructive">+ <Trash2 className="h-3.5 w-3.5" />+ Delete+ </DropdownMenuItem>+ </>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ )}+ </div></div>- ))}-- {/* Reply input — always visible at bottom */}- <div className="border-t border-border/50 px-4 py-2.5">- <ReplyInput- placeholder="Leave a reply..."- size="sm"- avatarType="member"- avatarId={currentUserId ?? ""}- onSubmit={(content) => onReply(entry.id, content)}- />- </div>++ {/* Collapsible body */}+ <CollapsibleContent>+ {/* Parent comment body */}+ <div className="px-4 pb-3">+ {editing ? (- <form- onSubmit={(e) => { e.preventDefault(); saveEdit(); }}++ <div+ className="pl-10"++ onKeyDown={(e) => { if (e.key === "Escape") cancelEdit(); }}+ >- <input- autoFocus- value={editContent}- onChange={(e) => setEditContent(e.target.value)}- aria-label="Edit comment"- className="w-full text-sm bg-transparent border-b border-border outline-none py-1"- onKeyDown={(e) => { if (e.key === "Escape") cancelEdit(); }}- />++ <div className="max-h-48 overflow-y-auto rounded-md border border-border px-3 py-2">++ <RichTextEditor++ ref={editEditorRef}++ defaultValue={entry.content ?? ""}++ placeholder="Edit comment..."++ onSubmit={saveEdit}++ debounceMs={100}++ />++ </div>+ <div className="flex gap-2 mt-1.5">- <Button size="sm" type="submit">Save</Button>- <Button size="sm" variant="ghost" type="button" onClick={cancelEdit}>Cancel</Button>++ <Button size="sm" onClick={saveEdit}>Save</Button>++ <Button size="sm" variant="ghost" onClick={cancelEdit}>Cancel</Button>+ </div>- </form>++ </div>+ ) : (+ <>+ <div className="pl-10 text-sm leading-relaxed text-foreground/85">- <Markdown mode="minimal">{entry.content ?? ""}</Markdown>++ <RichTextEditor defaultValue={entry.content ?? ""} editable={false} />+ </div>+ {!isTemp && (+ <ReactionBar+ reactions={reactions}+ currentUserId={currentUserId}+ onToggle={(emoji) => onToggleReaction(entry.id, emoji)}+ className="mt-1.5 pl-10"+ />+ )}+ </>+ )}+ </div>++ {/* Replies */}+ {allNestedReplies.map((reply) => (+ <div key={reply.id} className="border-t border-border/50 px-4">+ <CommentRow+ entry={reply}+ currentUserId={currentUserId}+ onEdit={onEdit}+ onDelete={onDelete}+ onToggleReaction={onToggleReaction}+ />+ </div>+ ))}++ {/* Reply input */}+ <div className="border-t border-border/50 px-4 py-2.5">+ <ReplyInput+ issueId={issueId}+ placeholder="Leave a reply..."+ size="sm"+ avatarType="member"+ avatarId={currentUserId ?? ""}+ onSubmit={(content) => onReply(entry.id, content)}+ />+ </div>+ </CollapsibleContent>+ </Collapsible></Card>);}diff --cc apps/web/features/issues/components/comment-input.tsxindex 6aaa204125,e889565fee..388f2c77a9--- a/apps/web/features/issues/components/comment-input.tsx+++ b/apps/web/features/issues/components/comment-input.tsx@@@ -1,11 -1,13 +1,13 @@@"use client";import { useRef, useState } from "react";- import { ArrowUp, Loader2 } from "lucide-react";-import { ArrowUp, Paperclip } from "lucide-react";++import { ArrowUp, Loader2, Paperclip } from "lucide-react";import { Button } from "@/components/ui/button";import { RichTextEditor, type RichTextEditorRef } from "@/components/common/rich-text-editor";+ import { useFileUpload } from "@/shared/hooks/use-file-upload";interface CommentInputProps {+ issueId: string;onSubmit: (content: string) => Promise<void>;}diff --cc apps/web/features/issues/components/reply-input.tsxindex d58c844370,0d61955fbb..4f7f8f314a--- a/apps/web/features/issues/components/reply-input.tsx+++ b/apps/web/features/issues/components/reply-input.tsx@@@ -1,7 -1,7 +1,7 @@@"use client";import { useRef, useState } from "react";- import { ArrowUp, Loader2 } from "lucide-react";-import { ArrowUp, Paperclip } from "lucide-react";++import { ArrowUp, Loader2, Paperclip } from "lucide-react";import { Button } from "@/components/ui/button";import { RichTextEditor, type RichTextEditorRef } from "@/components/common/rich-text-editor";import { ActorAvatar } from "@/components/common/actor-avatar";diff --cc apps/web/package.jsonindex 1237d3dc71,21538d8b3d..f48cffa176--- a/apps/web/package.json+++ b/apps/web/package.json@@@ -18,6 -18,7 +18,7 @@@"@dnd-kit/utilities": "^3.2.2","@emoji-mart/data": "^1.2.1","@floating-ui/dom": "^1.7.6",- "@tiptap/extension-image": "^3.21.0",++ "@tiptap/extension-image": "^3.20.5","@tiptap/extension-link": "^3.20.5","@tiptap/extension-mention": "^3.20.5","@tiptap/extension-placeholder": "^3.20.5",diff --cc pnpm-lock.yamlindex f2bc365fa1,c6c6a510df..2565644c15--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@@ -75,6 -75,9 +75,9 @@@ importers'@floating-ui/dom':specifier: ^1.7.6version: 1.7.6+ '@tiptap/extension-image':- specifier: ^3.21.0- version: 3.21.0(@tiptap/[email protected](@tiptap/[email protected]))++ specifier: ^3.20.5++ version: 3.20.5(@tiptap/[email protected](@tiptap/[email protected]))'@tiptap/extension-link':specifier: ^3.20.5@@@ -1368,6 -1371,11 +1371,11 @@@ packages'@tiptap/core': ^3.20.5'@tiptap/pm': ^3.20.5- '@tiptap/[email protected]':- resolution: {integrity: sha512-W9786a2K4LSZJMPeRLmoDulJeXOsM0ueRV2MHjTol7ikPRauROB7GUbAz9DyPAJHA2AGUfpswnGAYPO3tz5CLg==}++ '@tiptap/[email protected]':++ resolution: {integrity: sha512-qxKupWKhX75Xc9GJ9Uel+KIFL9x6tb8W3RvQM1UolyJX/H7wyBO7sXp9XmKRkHZsDXRgLVbnkYBe+X83o16AIA==}+ peerDependencies:- '@tiptap/core': ^3.21.0++ '@tiptap/core': ^3.20.5+'@tiptap/[email protected]':resolution: {integrity: sha512-7bZCgdJVTvhR5vSmNgFQbGvgRoC6m26KcUpHqWiKA95kLL5Wk4YlMCIqdiDpvJ1eakeFEvDcGZvFLg5+1NiQ+w==}peerDependencies:@@@ -4949,6 -4957,10 +4957,10 @@@ snapshots'@tiptap/core': 3.20.5(@tiptap/[email protected])'@tiptap/pm': 3.20.5+ dependencies:+ '@tiptap/core': 3.20.5(@tiptap/[email protected])+dependencies:'@tiptap/core': 3.20.5(@tiptap/[email protected])