import { create } from "@bufbuild/protobuf"; import { FieldMaskSchema, timestampDate } from "@bufbuild/protobuf/wkt"; import { CheckIcon, MessageCircleIcon, TrashIcon, XIcon } from "lucide-react"; import toast from "react-hot-toast"; import UserAvatar from "@/components/UserAvatar"; import { userServiceClient } from "@/connect"; import useNavigateTo from "@/hooks/useNavigateTo"; import { cn } from "@/lib/utils"; import { UserNotification, UserNotification_Status } from "@/types/proto/api/v1/user_service_pb"; import { useTranslate } from "@/utils/i18n"; interface Props { notification: UserNotification; } function MemoCommentMessage({ notification }: Props) { const t = useTranslate(); const navigateTo = useNavigateTo(); const commentPayload = notification.payload?.case === "memoComment" ? notification.payload.value : undefined; const sender = notification.senderUser; const handleArchiveMessage = async (silence = false) => { await userServiceClient.updateUserNotification({ notification: { name: notification.name, status: UserNotification_Status.ARCHIVED, }, updateMask: create(FieldMaskSchema, { paths: ["status"] }), }); if (!silence) { toast.success(t("message.archived-successfully")); } }; const handleDeleteMessage = async () => { await userServiceClient.deleteUserNotification({ name: notification.name, }); toast.success(t("message.deleted-successfully")); }; if (!commentPayload) { return (
Original: {commentPayload.relatedMemoSnippet || Empty memo}
Comment
{commentPayload.memoSnippet || Empty comment}