Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(#383): add rich text editor for comments (#435)

Tim Friedrich9787e0b075f6
diff --git a/apps/web/src/components/task/task-activities.tsx b/apps/web/src/components/task/task-activities.tsx
index 4f524b28e..a162c66a8 100644
--- a/apps/web/src/components/task/task-activities.tsx
+++ b/apps/web/src/components/task/task-activities.tsx
@@ -1,4 +1,5 @@
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
+import { MarkdownRenderer } from "@/components/common/markdown-renderer";
import useDeleteComment from "@/hooks/mutations/comment/use-delete-comment";
import useGetActivitiesByTaskId from "@/hooks/queries/activity/use-get-activities-by-task-id";
import { cn } from "@/lib/cn";
@@ -76,9 +77,9 @@ function TaskActivities() {
onSubmit={() => setEditingCommentId(null)}
/>
) : (
- <span className="text-zinc-600 dark:text-zinc-100">
- {activity.content}
- </span>
+ <div className="text-zinc-600 dark:text-zinc-100">
+ <MarkdownRenderer content={activity.content || ""} />
+ </div>
))}
</div>
{activity.type === "comment" && editingCommentId === null && (
diff --git a/apps/web/src/components/task/task-comment.tsx b/apps/web/src/components/task/task-comment.tsx
index 3cb0a1b0f..641bba49f 100644
--- a/apps/web/src/components/task/task-comment.tsx
+++ b/apps/web/src/components/task/task-comment.tsx
@@ -1,4 +1,5 @@
import useAuth from "@/components/providers/auth-provider/hooks/use-auth";
+import { Editor } from "@/components/common/editor";
import { Button } from "@/components/ui/button";
import { Form, FormControl, FormField, FormItem } from "@/components/ui/form";
import useCreateComment from "@/hooks/mutations/comment/use-create-comment";
@@ -100,12 +101,13 @@ function TaskComment({
<FormItem>
<div className="flex flex-col gap-4">
<FormControl>
- <textarea
- placeholder="Add a comment..."
- {...field}
- value={field.value}
- className="w-full rounded-xl border border-zinc-200/50 dark:border-zinc-800/50 bg-white dark:bg-zinc-900 shadow-sm px-4 py-3 text-sm text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-500 dark:placeholder:text-zinc-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:focus:ring-indigo-400 min-h-[100px]"
- />
+ <div className="bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200/50 dark:border-zinc-800/50 shadow-sm overflow-hidden min-h-[100px]">
+ <Editor
+ value={field.value || ""}
+ onChange={field.onChange}
+ placeholder="Add a comment..."
+ />
+ </div>
</FormControl>
</div>
</FormItem>