import { TimeSince } from '@automattic/components'; import { SubscriptionManager } from '@automattic/data-stores'; import { useTranslate } from 'i18n-calypso'; import { memo, useMemo } from 'react'; import { SiteIcon } from 'calypso/blocks/site-icon'; import { useRecordCommentNotificationsToggle } from 'calypso/landing/subscriptions/tracks'; import { CommentSettings } from '../settings'; import type { PostSubscription } from '@automattic/data-stores/src/reader/types'; type CommentRowProps = PostSubscription & { forwardedRef: React.Ref< HTMLDivElement >; style: React.CSSProperties; }; const CommentRow = ( { id, post_id, post_title, post_excerpt, post_url, blog_id, site_title, site_icon, site_url, date_subscribed, forwardedRef, style, is_wpforteams_site, is_paid_subscription, notification = { send_comments: false }, }: CommentRowProps ) => { const translate = useTranslate(); const hostname = useMemo( () => new URL( site_url ).hostname, [ site_url ] ); const { mutate: notifyMeOfNewComments, isPending: notifyingMeOfNewComments } = SubscriptionManager.usePostNotifyMeOfNewCommentsMutation(); const { mutate: unsubscribe, isPending: unsubscribing } = SubscriptionManager.usePostUnsubscribeMutation(); const recordCommentNotificationsToggle = useRecordCommentNotificationsToggle(); const handleNotifyMeOfNewCommentsChange = ( value: boolean ) => { notifyMeOfNewComments( { subscriptionId: id, sendComments: value, } ); recordCommentNotificationsToggle( value, { blog_id, post_id } ); }; return (