Skip to content

Commit

Permalink
resolve eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rishishah-multidots committed Sep 13, 2024
1 parent 7aa5508 commit e55109f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion packages/editor/src/components/collab-sidebar/add-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import { sanitizeCommentString } from './utils';
* @param {Function} props.setShowCommentBoard - The function to delete the comment.
* @return {JSX.Element} The rendered comment input UI.
*/
export function AddComment( { onSubmit, showCommentBoard, setShowCommentBoard } ) {
export function AddComment( {
onSubmit,
showCommentBoard,
setShowCommentBoard,
} ) {
// State to manage the comment thread.
const [ inputComment, setInputComment ] = useState( '' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { comment as commentIcon } from '@wordpress/icons';
import { __unstableCommentIconFill as CommentIconFill } from '@wordpress/block-editor';

const AddCommentButton = ( { onClick } ) => {

return (
<CommentIconFill>
<MenuItem
Expand Down
20 changes: 9 additions & 11 deletions packages/editor/src/components/collab-sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function CollabSidebar() {

// eslint-disable-next-line @wordpress/data-no-store-string-literals
const { openGeneralSidebar } = useDispatch( 'core/edit-post' );
const [ blockCommentID, setBlockCommentID] = useState( null );
const [ blockCommentID, setBlockCommentID ] = useState( null );
const [ showCommentBoard, setShowCommentBoard ] = useState( false );

const [ threads, setThreads ] = useState( () => [] );
Expand All @@ -67,14 +67,16 @@ export default function CollabSidebar() {

const clientId = useSelect( ( select ) => {
const { getSelectedBlockClientId } = select( blockEditorStore );
setBlockCommentID( select( blockEditorStore ).getBlock( getSelectedBlockClientId() )?.attributes.blockCommentId );
setBlockCommentID(
select( blockEditorStore ).getBlock( getSelectedBlockClientId() )
?.attributes.blockCommentId
);
return getSelectedBlockClientId();
}, [] );

// Get the dispatch functions to save the comment and update the block attributes.
const { updateBlockAttributes } = useDispatch( blockEditorStore );


const openCollabBoard = () => {
setShowCommentBoard( true );
openGeneralSidebar( 'edit-post/collab-sidebar' );
Expand Down Expand Up @@ -273,16 +275,12 @@ export default function CollabSidebar() {
return (
<>
{ ! blockCommentID && (
<AddCommentButton
onClick={openCollabBoard}
/>
)}
<AddCommentButton onClick={ openCollabBoard } />
) }

{ blockCommentID > 0 && (
<AddCommentToolbarButton
onClick={openCollabBoard}
/>
)}
<AddCommentToolbarButton onClick={ openCollabBoard } />
) }
<PluginSidebar
identifier={ collabSidebarName }
// translators: Comments sidebar title
Expand Down

0 comments on commit e55109f

Please sign in to comment.