From 981f049811ae46cfce078ce8f8d5ee480516cdbf Mon Sep 17 00:00:00 2001 From: plebbitor Date: Sat, 22 Apr 2023 18:02:47 +0200 Subject: [PATCH] fixed undefined values and tooltips --- src/components/views/Board.jsx | 16 ++++++++-------- src/components/views/Pending.jsx | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx index 90fa6d3f..9d985ff4 100644 --- a/src/components/views/Board.jsx +++ b/src/components/views/Board.jsx @@ -501,10 +501,10 @@ const Board = () => { {thread.content ? ( - thread.content.length > 1000 ? + thread.content?.length > 1000 ?
- + (...)

Post too long.  @@ -642,13 +642,13 @@ const Board = () => { ) : null} {reply.content ? ( - reply.content.length > 500 ? + reply.content?.length > 500 ?
{}} key={`r-pm-${reply.cid}`} className="quotelink" onClick={(event) => handleQuoteClick(reply, shortParentCid, thread.shortCid, event)}> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null} - + (...)

Comment too long.  @@ -766,10 +766,10 @@ const Board = () => { ) : null} {thread.content ? ( - thread.content.length > 500 ? + thread.content?.length > 500 ?
- + (...)

Post too long.  @@ -879,13 +879,13 @@ const Board = () => { ) : null} {reply.content ? ( - reply.content.length > 500 ? + reply.content?.length > 500 ?
{}} key={`mob-r-pm-${reply.cid}`} className="quotelink" onClick={(event) => handleQuoteClick(reply, shortParentCid, thread.shortCid, event)}> {`c/${shortParentCid}`}{shortParentCid === thread.shortCid ? " (OP)" : null} - + (...)

Comment too long.  diff --git a/src/components/views/Pending.jsx b/src/components/views/Pending.jsx index dd2f38e9..378a80e4 100644 --- a/src/components/views/Pending.jsx +++ b/src/components/views/Pending.jsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { Helmet } from 'react-helmet-async'; import { Link, useNavigate, useParams } from 'react-router-dom'; import { Tooltip } from 'react-tooltip'; -import { useAccountComment } from '@plebbit/plebbit-react-hooks'; +import { useAccount, useAccountComment } from '@plebbit/plebbit-react-hooks'; import useGeneralStore from '../../hooks/stores/useGeneralStore'; import { Container, NavBar, Header, Break, PostForm, BoardForm } from '../styled/Board.styled'; import { ReplyFormLink, TopBar, BottomBar } from '../styled/Thread.styled'; @@ -31,6 +31,7 @@ const Pending = () => { const { index } = useParams(); + const account = useAccount(); const comment = useAccountComment({commentIndex: index}); const [visible] = useState(true); @@ -258,8 +259,12 @@ const Pending = () => {   (u/ - - {comment.author?.address} + + {account?.author?.address.slice(0, 10) + "(...)"} )   @@ -302,8 +307,12 @@ const Pending = () => {   (u/ - - {comment.author?.address} + + {account?.author?.address.slice(0, 10) + "(...)"}