import { MessageCircleIcon } from "lucide-react"; import { useState } from "react"; import MemoEditor from "@/components/MemoEditor"; import MemoView from "@/components/MemoView"; import { Button } from "@/components/ui/button"; import { extractMemoIdFromName } from "@/helpers/resource-names"; import useCurrentUser from "@/hooks/useCurrentUser"; import type { Memo } from "@/types/proto/api/v1/memo_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { memo: Memo; comments: Memo[]; parentPage?: string; } const MemoCommentSection = ({ memo, comments, parentPage }: Props) => { const t = useTranslate(); const currentUser = useCurrentUser(); const [showEditor, setShowEditor] = useState(false); const showCreateButton = currentUser && !showEditor; const handleCommentCreated = async (_memoCommentName: string) => { setShowEditor(false); }; return (

{t("memo.comment.self")}

{comments.length === 0 ? ( showCreateButton && (
) ) : (
{t("memo.comment.self")} ({comments.length})
{showCreateButton && ( )}
)} {showEditor && (
setShowEditor(false)} />
)} {comments.map((comment) => (
))}
); }; export default MemoCommentSection;