diff --git a/client/src/components/forms/PostFormCard.tsx b/client/src/components/forms/PostFormCard.tsx index 2059dd3..ed2029d 100644 --- a/client/src/components/forms/PostFormCard.tsx +++ b/client/src/components/forms/PostFormCard.tsx @@ -7,6 +7,7 @@ import { useSubmitForm } from "./handleSubmit"; import "../../styles/Form.css"; import EmotePicker from "../modals/EmotePicker/EmotePicker"; import emotes from "../modals/EmotePicker/custom_emojis.json" +import { DEFAULT_DIFFICULTY } from "../../config"; interface FormProps { refEvent?: NostrEvent; @@ -16,7 +17,7 @@ interface FormProps { const NewNoteCard = ({ refEvent, - tagType, + tagType, hashtag, }: FormProps) => { const [comment, setComment] = useState(""); @@ -33,7 +34,7 @@ const NewNoteCard = ({ pubkey: "", }); const [difficulty, setDifficulty] = useState( - localStorage.getItem("difficulty") || "21" + localStorage.getItem("difficulty") || DEFAULT_DIFFICULTY.toString() ); useEffect(() => { @@ -44,7 +45,7 @@ const NewNoteCard = ({ if (refEvent && tagType) { unsigned.tags = Array.from(new Set(unsigned.tags.concat(refEvent.tags))); unsigned.tags.push(['p', refEvent.pubkey]); - + if (tagType === 'Reply') { unsigned.tags.push(['e', refEvent.id, refEvent.tags.some(tag => tag[0] === 'e') ? 'root' : '']); } else { @@ -78,7 +79,7 @@ const NewNoteCard = ({ })); }, [comment]); - const { handleSubmit: originalHandleSubmit, doingWorkProp, doingWorkProgress } = useSubmitForm(unsigned, difficulty); + const { handleSubmit: originalHandleSubmit, doingWorkProp, hashrate, bestPow } = useSubmitForm(unsigned, difficulty); const handleSubmit = async (event: React.FormEvent) => { await originalHandleSubmit(event); @@ -127,13 +128,30 @@ const NewNoteCard = ({ rows={comment.split('\n').length || 1} />
- {difficulty} Work -
+ setDifficulty(e.target.value)} + min="10" // Assuming a minimum difficulty value of 1 + /> + +