mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix getCommentMediaInfo
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
||||
"@babel/core": "^7.21.3",
|
||||
"@babel/plugin-syntax-flow": "^7.18.6",
|
||||
"@babel/plugin-transform-react-jsx": "^7.21.0",
|
||||
"@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#87e3b09611c002ae385ca4517890fc2e139d3822",
|
||||
"@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#11b519a6ad7a9b96911b2ebb4b7f13cddf5233d5",
|
||||
"@testing-library/dom": "^9.0.1",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
|
||||
@@ -44,8 +44,6 @@ const Board = () => {
|
||||
const commentRef = useRef();
|
||||
const linkRef = useRef();
|
||||
|
||||
const onChallengeVerificationRef = useRef();
|
||||
|
||||
const [isReplyOpen, setIsReplyOpen] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const [prevScrollPos, setPrevScrollPos] = useState(0);
|
||||
@@ -100,10 +98,12 @@ const Board = () => {
|
||||
const onChallengeVerification = (challengeVerification) => {
|
||||
if (challengeVerification.challengeSuccess === true) {
|
||||
setSuccessMessage('Challenge success.', {publishedCid: challengeVerification.publication?.cid});
|
||||
console.log("challenge success", challengeVerification.publication?.cid, challengeVerification)
|
||||
navigate(`/p/${selectedAddress}/c/${challengeVerification.publication?.cid}`);
|
||||
}
|
||||
else if (challengeVerification.challengeSuccess === false) {
|
||||
setErrorMessage('Challenge failed.', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
||||
console.log("challenge failed", challengeVerification.reason, challengeVerification.errors)
|
||||
setErrorMessage("Error: You seem to have mistyped the CAPTCHA. Please try again.");
|
||||
}
|
||||
};
|
||||
@@ -128,12 +128,13 @@ const Board = () => {
|
||||
const [publishCommentOptions, setPublishCommentOptions] = useState({
|
||||
subplebbitAddress: selectedAddress,
|
||||
onChallenge,
|
||||
onChallengeVerification: onChallengeVerificationRef.current,
|
||||
onChallengeVerification,
|
||||
onError: (error) => {
|
||||
setErrorMessage(error);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const { publishComment, index } = usePublishComment(publishCommentOptions);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -144,9 +145,6 @@ const Board = () => {
|
||||
}, [index]);
|
||||
|
||||
|
||||
onChallengeVerificationRef.current = onChallengeVerification;
|
||||
|
||||
|
||||
const resetFields = () => {
|
||||
nameRef.current.value = '';
|
||||
subjectRef.current.value = '';
|
||||
@@ -155,15 +153,6 @@ const Board = () => {
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
||||
...prevPublishCommentOptions,
|
||||
subplebbitAddress: selectedAddress,
|
||||
onChallengeVerification: onChallengeVerificationRef.current,
|
||||
}));
|
||||
}, [selectedAddress]);
|
||||
|
||||
|
||||
const handleSubmit = async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { Tooltip } from 'react-tooltip';
|
||||
import useGeneralStore from '../../hooks/stores/useGeneralStore';
|
||||
@@ -36,10 +36,9 @@ const Pending = () => {
|
||||
useError(errorMessage, [errorMessage]);
|
||||
useSuccess(successMessage, [successMessage]);
|
||||
const navigate = useNavigate();
|
||||
const commentMediaInfo = getCommentMediaInfo(comment);
|
||||
const [commentMediaInfo, setCommentMediaInfo] = useState(null);
|
||||
const fallbackImgUrl = "/assets/filedeleted-res.gif";
|
||||
|
||||
|
||||
// mobile navbar board select functionality
|
||||
const handleSelectChange = (event) => {
|
||||
const selected = event.target.value;
|
||||
@@ -49,6 +48,15 @@ const Pending = () => {
|
||||
navigate(`/p/${selected}`);
|
||||
};
|
||||
|
||||
// get comment media info
|
||||
useEffect(() => {
|
||||
if (comment && comment.link) {
|
||||
const mediaInfo = getCommentMediaInfo(comment);
|
||||
setCommentMediaInfo(mediaInfo);
|
||||
}
|
||||
}, [comment]);
|
||||
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<SettingsModal
|
||||
|
||||
@@ -2459,6 +2459,48 @@
|
||||
ts-custom-error "3.3.1"
|
||||
uuid "9.0.0"
|
||||
|
||||
"@plebbit/plebbit-js@https://github.com/plebbit/plebbit-js.git#dfaa034957f73441fe6d46e3d53645ac5152ce82":
|
||||
version "0.0.3"
|
||||
resolved "https://github.com/plebbit/plebbit-js.git#dfaa034957f73441fe6d46e3d53645ac5152ce82"
|
||||
dependencies:
|
||||
"@keyv/sqlite" "3.6.2"
|
||||
"@plebbit/plebbit-logger" "github:plebbit/plebbit-logger"
|
||||
"@types/node-fetch" "2.6.2"
|
||||
"@types/proper-lockfile" "4.1.2"
|
||||
"@types/uuid" "8.3.4"
|
||||
assert "2.0.0"
|
||||
async-wait-until "2.0.12"
|
||||
buffer "6.0.3"
|
||||
captcha-canvas "3.2.1"
|
||||
err-code "3.0.1"
|
||||
ethers "5.7.2"
|
||||
file-type "16.5.4"
|
||||
form-data "4.0.0"
|
||||
hpagent "1.2.0"
|
||||
ipfs-http-client "56.0.3"
|
||||
ipfs-only-hash "4.0.0"
|
||||
is-ipfs "6.0.2"
|
||||
jose "4.11.0"
|
||||
js-sha256 "0.9.0"
|
||||
keyv "4.5.2"
|
||||
knex "2.3.0"
|
||||
libp2p-crypto "0.21.2"
|
||||
limiter "2.1.0"
|
||||
localforage "1.10.0"
|
||||
lodash-es "4.17.21"
|
||||
open-graph-scraper "5.2.3"
|
||||
p-limit "3.1.0"
|
||||
peer-id "0.16.0"
|
||||
proper-lockfile "github:plebbit/node-proper-lockfile"
|
||||
retry "0.13.1"
|
||||
safe-stable-stringify "2.4.1"
|
||||
skia-canvas "1.0.0"
|
||||
sqlite3 "5.1.2"
|
||||
tiny-typed-emitter "2.1.0"
|
||||
tinycache "1.1.2"
|
||||
ts-custom-error "3.3.1"
|
||||
uuid "9.0.0"
|
||||
|
||||
"@plebbit/plebbit-logger@github:plebbit/plebbit-logger":
|
||||
version "0.0.1"
|
||||
uid "9525ca9539479918931c3b334e8d490d1c87e507"
|
||||
@@ -2472,6 +2514,21 @@
|
||||
dependencies:
|
||||
debug "4.3.3"
|
||||
|
||||
"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#11b519a6ad7a9b96911b2ebb4b7f13cddf5233d5":
|
||||
version "0.0.1"
|
||||
resolved "https://github.com/plebbit/plebbit-react-hooks.git#11b519a6ad7a9b96911b2ebb4b7f13cddf5233d5"
|
||||
dependencies:
|
||||
"@plebbit/plebbit-js" "https://github.com/plebbit/plebbit-js.git#dfaa034957f73441fe6d46e3d53645ac5152ce82"
|
||||
"@plebbit/plebbit-logger" "https://github.com/plebbit/plebbit-logger.git"
|
||||
assert "2.0.0"
|
||||
ethers "5.6.9"
|
||||
localforage "1.10.0"
|
||||
lodash.isequal "4.5.0"
|
||||
memoizee "0.4.15"
|
||||
quick-lru "5.1.1"
|
||||
uuid "8.3.2"
|
||||
zustand "4.0.0"
|
||||
|
||||
"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#87e3b09611c002ae385ca4517890fc2e139d3822":
|
||||
version "0.0.1"
|
||||
resolved "https://github.com/plebbit/plebbit-react-hooks.git#87e3b09611c002ae385ca4517890fc2e139d3822"
|
||||
|
||||
Reference in New Issue
Block a user