add author to view post modal
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 42s
Details
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 42s
Details
This commit is contained in:
parent
df5cbaba87
commit
51c954a6da
|
@ -42,7 +42,7 @@ function App() {
|
|||
|
||||
const [showAddPost, setShowAddPost] = useState(false);
|
||||
const [showViewPost, setShowViewPost] = useState(false);
|
||||
const [viewPostContent, setViewPostContent] = useState('');
|
||||
const [viewPost, setViewPost] = useState({});
|
||||
|
||||
const web3ProviderValue = useMemo(() => ({
|
||||
provider,
|
||||
|
@ -264,11 +264,12 @@ function App() {
|
|||
|
||||
const handleShowAddPost = () => setShowAddPost(true);
|
||||
|
||||
const handleShowViewPost = async (post) => {
|
||||
const { content } = await Post.read(post.contentId);
|
||||
setViewPostContent(content);
|
||||
const handleShowViewPost = useCallback(async ({ contentId }) => {
|
||||
const post = await Post.read(contentId);
|
||||
console.log('handleShowViewPost, read', { post });
|
||||
setViewPost(post);
|
||||
setShowViewPost(true);
|
||||
};
|
||||
}, [setViewPost, setShowViewPost]);
|
||||
|
||||
/* -------------------------------------------------------------------------------- */
|
||||
/* --------------------------- END UI ACTIONS ------------------------------------- */
|
||||
|
@ -285,7 +286,7 @@ function App() {
|
|||
|
||||
<AddPostModal show={showAddPost} setShow={setShowAddPost} postToBlockchain />
|
||||
|
||||
<ViewPostModal show={showViewPost} setShow={setShowViewPost} content={viewPostContent} />
|
||||
<ViewPostModal show={showViewPost} setShow={setShowViewPost} post={viewPost} />
|
||||
|
||||
{!connected && <Button onClick={() => connect()}>Connect</Button>}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,18 +1,28 @@
|
|||
import Button from 'react-bootstrap/Button';
|
||||
import Modal from 'react-bootstrap/Modal';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
function ViewPostModal({
|
||||
show, setShow, title, content,
|
||||
show, setShow, title, post,
|
||||
}) {
|
||||
const handleClose = () => setShow(false);
|
||||
const { content, author } = useMemo(() => post, [post]);
|
||||
|
||||
return (
|
||||
<Modal show={show} onHide={handleClose}>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>{title}</Modal.Title>
|
||||
<Modal.Title>
|
||||
{title}
|
||||
</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<h6>
|
||||
Author:
|
||||
{' '}
|
||||
{author}
|
||||
</h6>
|
||||
<hr />
|
||||
<p className="post-content">
|
||||
{content}
|
||||
</p>
|
||||
|
@ -30,11 +40,12 @@ ViewPostModal.propTypes = {
|
|||
show: PropTypes.bool.isRequired,
|
||||
setShow: PropTypes.func.isRequired,
|
||||
title: PropTypes.string,
|
||||
content: PropTypes.string.isRequired,
|
||||
post: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
||||
};
|
||||
|
||||
ViewPostModal.defaultProps = {
|
||||
title: 'View Post',
|
||||
post: {},
|
||||
};
|
||||
|
||||
export default ViewPostModal;
|
||||
|
|
|
@ -37,7 +37,7 @@ function WorkRequests({
|
|||
const [showEvidenceModal, setShowEvidenceModal] = useState(false);
|
||||
const [currentRequestId, setCurrentRequestId] = useState();
|
||||
const [showViewRequestModal, setShowViewRequestModal] = useState(false);
|
||||
const [viewRequestContent, setViewRequestContent] = useState('');
|
||||
const [viewRequest, setViewRequest] = useState({});
|
||||
|
||||
const {
|
||||
provider, account,
|
||||
|
@ -133,8 +133,9 @@ function WorkRequests({
|
|||
}, [workContract, account, currentRequestId]);
|
||||
|
||||
const handleShowViewRequestModal = async (request) => {
|
||||
const { content } = await Post.read(request.requestContentId);
|
||||
setViewRequestContent(content);
|
||||
const post = await Post.read(request.requestContentId);
|
||||
console.log('show post modal', { post });
|
||||
setViewRequest(post);
|
||||
setShowViewRequestModal(true);
|
||||
};
|
||||
|
||||
|
@ -142,7 +143,7 @@ function WorkRequests({
|
|||
<>
|
||||
<AddPostModal title={`${verb} Request`} show={showRequestModal} setShow={setShowRequestModal} onSubmit={onSubmitRequest} />
|
||||
<AddPostModal title="Work Evidence" show={showEvidenceModal} setShow={setShowEvidenceModal} onSubmit={onSubmitEvidence} />
|
||||
<ViewPostModal title={`${verb} Request`} show={showViewRequestModal} setShow={setShowViewRequestModal} content={viewRequestContent} />
|
||||
<ViewPostModal title={`${verb} Request`} show={showViewRequestModal} setShow={setShowViewRequestModal} post={viewRequest} />
|
||||
<div>
|
||||
{`Price: ${price} ETH`}
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"DAO": "0x65B0922fe7F0c4012aa38704071f26aeF6F22650",
|
||||
"Work1": "0x95673D8710A8eD59f8551e9B12509D6812e0623e",
|
||||
"Onboarding": "0xc6b3b8A641c52F7bC13a9D444e1f0759CA3b87b4",
|
||||
"Proposals": "0x98550F017a8d7B9d759D59c1cA7B8D7B922e1dAf"
|
||||
"Proposals": "0x859cd550d5b3BDdde4Cf0ca71D060f945E9E42DD"
|
||||
},
|
||||
"sepolia": {
|
||||
"DAO": "0x8Cb4ab513A863ac29e855c85064ea53dec7dA24C",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"DAO": "0x65B0922fe7F0c4012aa38704071f26aeF6F22650",
|
||||
"Work1": "0x95673D8710A8eD59f8551e9B12509D6812e0623e",
|
||||
"Onboarding": "0xc6b3b8A641c52F7bC13a9D444e1f0759CA3b87b4",
|
||||
"Proposals": "0x98550F017a8d7B9d759D59c1cA7B8D7B922e1dAf"
|
||||
"Proposals": "0x859cd550d5b3BDdde4Cf0ca71D060f945E9E42DD"
|
||||
},
|
||||
"sepolia": {
|
||||
"DAO": "0x8Cb4ab513A863ac29e855c85064ea53dec7dA24C",
|
||||
|
|
|
@ -193,6 +193,7 @@ contract DAO is ERC20("Reputation", "REP") {
|
|||
// TODO: refund stakes
|
||||
// Callback if requested
|
||||
if (pool.callbackOnValidate) {
|
||||
console.log("quorum not met, calling onValidate");
|
||||
IOnValidate(pool.sender).onValidate(
|
||||
votePasses,
|
||||
false,
|
||||
|
@ -268,6 +269,7 @@ contract DAO is ERC20("Reputation", "REP") {
|
|||
}
|
||||
// Callback if requested
|
||||
if (pool.callbackOnValidate) {
|
||||
console.log("calling onValidate");
|
||||
IOnValidate(pool.sender).onValidate(
|
||||
votePasses,
|
||||
true,
|
||||
|
|
Loading…
Reference in New Issue