diff --git a/client/package.json b/client/package.json index 0d336ec..a69bf84 100644 --- a/client/package.json +++ b/client/package.json @@ -16,13 +16,11 @@ "react-linkify": "^1.0.0-alpha", "react-router-dom": "^6.15.0", "react-scripts": "5.0.1", - "web-vitals": "^2.1.4", "workbox-background-sync": "^6.6.0", "workbox-broadcast-update": "^6.6.0", "workbox-cacheable-response": "^6.6.0", "workbox-core": "^6.6.0", "workbox-expiration": "^6.6.0", - "workbox-google-analytics": "^6.6.0", "workbox-navigation-preload": "^6.6.0", "workbox-precaching": "^6.6.0", "workbox-range-requests": "^6.6.0", diff --git a/client/src/components/forms/PostFormCard.tsx b/client/src/components/forms/PostFormCard.tsx index 1215504..7d73bcb 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 { DEFAULT_DIFFICULTY } from "../../config"; +import PostCard from "../modals/PostCard"; interface FormProps { refEvent?: NostrEvent; @@ -24,6 +25,7 @@ const timeUnits = [ { unit: 'd', value: 60 * 60 * 24 }, { unit: 'h', value: 60 * 60 }, { unit: 'm', value: 60 }, + { unit: 's', value: 1 }, ]; const timeToGoEst = (difficulty: string, hashrate: number): string => { @@ -43,7 +45,7 @@ const timeToGoEst = (difficulty: string, hashrate: number): string => { } } - return result.trim() || '0m'; // Return '0m' if result is empty, indicating less than a minute + return result.trim() || 'now'; // Return 'now' if result is empty }; const NewNoteCard = ({ @@ -88,7 +90,6 @@ const NewNoteCard = ({ addEventTags(); break; case 'Quote': - setComment(comment + '\nnostr:' + nip19.noteEncode(refEvent.id)); unsigned.tags.push(['q', refEvent.id]); break; default: @@ -118,10 +119,16 @@ const NewNoteCard = ({ })); }, [comment]); - const { handleSubmit: originalHandleSubmit, doingWorkProp, hashrate, bestPow } = useSubmitForm(unsigned, difficulty); + const { handleSubmit: originalHandleSubmit, doingWorkProp, hashrate, bestPow, signedPoWEvent } = useSubmitForm(unsigned, difficulty); const handleSubmit = async (event: React.FormEvent) => { await originalHandleSubmit(event); + + // Check if tagType is 'Quote' and update comment + if (tagType === 'Quote' && refEvent) { + setComment(prevComment => prevComment + '\nnostr:' + nip19.noteEncode(refEvent.id)); + } + setComment(""); setUnsigned(prevUnsigned => ({ ...prevUnsigned, @@ -161,9 +168,13 @@ const NewNoteCard = ({