fix useComment

This commit is contained in:
plebbitor
2023-03-25 15:34:10 +01:00
parent baf0ff2465
commit 1d7961de9b
3 changed files with 13 additions and 11 deletions
+6 -6
View File
@@ -426,7 +426,7 @@ const Board = () => {
) : null}
{commentMediaInfo?.type === "video" ? (
<span key={`fta-${thread.cid}`} className="file-thumb">
{/* <VideoThumbnail
<VideoThumbnail
videoUrl={commentMediaInfo.url}
thumbnailHandler={(thumbnail) => {
const img = document.querySelector(`img[key="img-${thread.cid}"]`);
@@ -434,12 +434,12 @@ const Board = () => {
img.src = thumbnail;
}
}}
/> */}
/>
</span>
) : null}
{commentMediaInfo?.type === "audio" ? (
<span key={`fta-${thread.cid}`} className="file-thumb">
{/* <audio key={`fti-${thread.cid}`} src={commentMediaInfo.url} alt={commentMediaInfo.type} onError={(e) => e.target.src = fallbackImgUrl} /> */}
<audio key={`fti-${thread.cid}`} src={commentMediaInfo.url} alt={commentMediaInfo.type} onError={(e) => e.target.src = fallbackImgUrl} />
</span>
) : null}
</div>
@@ -721,7 +721,7 @@ const Board = () => {
) : commentMediaInfo.type === "video" ? (
<div key={`mob-f-${thread.cid}`} className="file-mobile">
<span key={`mob-ft${thread.cid}`} className="file-thumb-mobile">
{/* <VideoThumbnail
<VideoThumbnail
videoUrl={commentMediaInfo.url}
thumbnailHandler={(thumbnail) => {
const img = document.querySelector(`img[key="img-${thread.cid}"]`);
@@ -729,14 +729,14 @@ const Board = () => {
img.src = thumbnail;
}
}}
/> */}
/>
<div key={`mob-fi-${thread.cid}`} className="file-info-mobile">{commentMediaInfo.type}</div>
</span>
</div>
) : commentMediaInfo.type === "audio" ? (
<div key={`mob-f-${thread.cid}`} className="file-mobile">
<span key={`mob-ft${thread.cid}`} className="file-thumb-mobile">
{/* <audio key={`mob-img-${thread.cid}`} src={commentMediaInfo.url} alt={commentMediaInfo.type} onError={(e) => e.target.src = fallbackImgUrl} /> */}
<audio key={`mob-img-${thread.cid}`} src={commentMediaInfo.url} alt={commentMediaInfo.type} onError={(e) => e.target.src = fallbackImgUrl} />
<div key={`mob-fi-${thread.cid}`} className="file-info-mobile">{commentMediaInfo.type}</div>
</span>
</div>
+1 -3
View File
@@ -45,9 +45,7 @@ const Catalog = () => {
const { subplebbitAddress } = useParams();
const handleClickForm = useClickForm();
useEffect(() => {
console.log(feed);
}, [feed]);
useEffect(() => {
setSelectedAddress(subplebbitAddress);
+6 -2
View File
@@ -44,13 +44,17 @@ const Thread = () => {
const navigate = useNavigate();
const [prevScrollPos, setPrevScrollPos] = useState(0);
const [visible, setVisible] = useState(true);
const comment = useComment({selectedThread});
const comment = useComment({commentCid: selectedThread});
const { subplebbitAddress, threadCid } = useParams();
const handleClickForm = useClickForm();
const commentMediaInfo = getCommentMediaInfo(comment);
const fallbackImgUrl = "/assets/filedeleted-res.gif";
// useEffect(() => {
// console.log(comment);
// }, [comment]);
// temporary title from JSON, gets subplebbitAddress and threadCid from URL
useEffect(() => {
@@ -390,7 +394,7 @@ const Thread = () => {
<hr />
</TopBar>
<BoardForm selectedStyle={selectedStyle}>
{comment ? (
{comment !== undefined ? (
<>
<div className="thread">
<div className="op-container">