mirror of
https://github.com/plebbit/seedit.git
synced 2026-02-23 02:35:13 -05:00
feat(reply): implement instant edits
This commit is contained in:
@@ -105,9 +105,9 @@ const Post = ({ post = {}, index }: PostProps) => {
|
||||
const isInPostView = isPostView(location.pathname, params);
|
||||
const isInPendingView = isPendingView(location.pathname, params);
|
||||
const isInSubplebbitView = isSubplebbitView(location.pathname, params);
|
||||
const isInPostView = isInPostView || isInPendingView;
|
||||
const isInPostPage = isInPostView || isInPendingView;
|
||||
|
||||
const [isExpanded, setIsExpanded] = useState(isInPostView);
|
||||
const [isExpanded, setIsExpanded] = useState(isInPostPage);
|
||||
const toggleExpanded = () => setIsExpanded(!isExpanded);
|
||||
|
||||
const [upvoted, upvote] = useUpvote(post);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { Comment, useAccountComment, useAuthorAddress, useBlock, useComment, useSubplebbit } from '@plebbit/plebbit-react-hooks';
|
||||
import { Comment, useAccountComment, useAuthorAddress, useBlock, useComment, useEditedComment, useSubplebbit } from '@plebbit/plebbit-react-hooks';
|
||||
import { flattenCommentsPages } from '@plebbit/plebbit-react-hooks/dist/lib/utils';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -187,6 +187,11 @@ interface ReplyProps {
|
||||
}
|
||||
|
||||
const Reply = ({ depth = 0, isSingle, isNotification = false, reply = {} }: ReplyProps) => {
|
||||
// handle pending mod or author edit
|
||||
const { editedComment: editedPost } = useEditedComment({ comment: reply });
|
||||
if (editedPost) {
|
||||
reply = editedPost;
|
||||
}
|
||||
const {
|
||||
author,
|
||||
cid,
|
||||
|
||||
Reference in New Issue
Block a user