diff --git a/frontend/src/components/comment_input.tsx b/frontend/src/components/comment_input.tsx index b9cdfe6..26b7f41 100644 --- a/frontend/src/components/comment_input.tsx +++ b/frontend/src/components/comment_input.tsx @@ -173,7 +173,7 @@ export function CommentInput({ )} - + {t("Use markdown format")} diff --git a/frontend/src/components/comment_tile.tsx b/frontend/src/components/comment_tile.tsx index d99f45e..a3066f5 100644 --- a/frontend/src/components/comment_tile.tsx +++ b/frontend/src/components/comment_tile.tsx @@ -1,22 +1,15 @@ -import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router"; import { MdOutlineComment, - MdOutlineDelete, - MdOutlineEdit, } from "react-icons/md"; -import { TextArea } from "./input"; import { Comment } from "../network/models"; import { network } from "../network/network"; import Badge from "./badge"; -import { app } from "../app"; -import showToast from "./toast"; import Markdown from "react-markdown"; export function CommentTile({ comment, - onUpdated, elevation, }: { comment: Comment; @@ -79,196 +72,11 @@ export function CommentTile({ {comment.reply_count} )} - {app.user?.id === comment.user.id && ( - <> - - - - )} ); } -function EditCommentDialog({ - comment, - onUpdated, -}: { - comment: Comment; - onUpdated?: () => void; -}) { - const [isLoading, setLoading] = useState(false); - const [content, setContent] = useState(comment.content); - const { t } = useTranslation(); - - const handleUpdate = async () => { - if (isLoading) { - return; - } - setLoading(true); - const res = await network.updateComment(comment.id, content); - const dialog = document.getElementById( - `edit_comment_dialog_${comment.id}`, - ) as HTMLDialogElement; - dialog.close(); - if (res.success) { - showToast({ - message: t("Comment updated successfully"), - type: "success", - }); - if (onUpdated) { - onUpdated(); - } - } else { - showToast({ - message: res.message, - type: "error", - parent: document.getElementById(`dialog_box`), - }); - } - setLoading(false); - }; - - return ( - <> - - { - e.preventDefault(); - e.stopPropagation(); - }} - > -
-

{t("Edit Comment")}

-