diff --git a/src/components/Notes/Note.tsx b/src/components/Notes/Note.tsx
index aba2445..eb0ced3 100644
--- a/src/components/Notes/Note.tsx
+++ b/src/components/Notes/Note.tsx
@@ -4,7 +4,6 @@ import {
NDKKind,
NDKSubscriptionCacheUsage
} from '@nostr-dev-kit/ndk'
-import { AlertPopup } from 'components/AlertPopup'
import { CommentContent } from 'components/comment/CommentContent'
import { Reactions } from 'components/comment/Reactions'
import { Zap } from 'components/comment/Zap'
@@ -18,8 +17,8 @@ import { Link } from 'react-router-dom'
import { appRoutes, getProfilePageRoute } from 'routes'
import { UserProfile } from 'types'
import { hexToNpub } from 'utils'
-import { NoteSubmit } from './NoteSubmit'
import { NoteRepostPopup } from './NoteRepostPopup'
+import { NoteQuoteRepostPopup } from './NoteQuoteRepostPopup'
interface NoteProps {
ndkEvent: NDKEvent
@@ -138,12 +137,6 @@ export const Note = ({ ndkEvent }: NoteProps) => {
>
) : null
- const handleQuoteRepost = async (confirm: boolean) => {
- setShowQuoteRepostPopup(false)
-
- if (!confirm) return
- }
-
const handleRepost = async (confirm: boolean) => {
setShowRepostPopup(false)
@@ -227,25 +220,14 @@ export const Note = ({ ndkEvent }: NoteProps) => {
- {/* TODO: new popup */}
{showQuoteRepostPopup && (
- setShowQuoteRepostPopup(false)}
- header={'Quote Repost'}
- label={``}
- yesButtonLabel='Post'
- noButtonLabel='Cancel'
- >
-
-
+ />
)}
- {/* Repost, Kind 6 */}
+ {/* Repost, Kind 6 */}
{!isUsersRepost && (
void
+}
+
+export const NoteQuoteRepostPopup = ({
+ ndkEvent,
+ handleClose
+}: PropsWithChildren
) => {
+ const content = ndkEvent.encode()
+
+ return createPortal(
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
,
+ document.body
+ )
+}
diff --git a/src/components/Notes/NoteSubmit.tsx b/src/components/Notes/NoteSubmit.tsx
index 530bf06..1d9d17c 100644
--- a/src/components/Notes/NoteSubmit.tsx
+++ b/src/components/Notes/NoteSubmit.tsx
@@ -4,26 +4,37 @@ import { useAppSelector } from 'hooks'
import { useProfile } from 'hooks/useProfile'
import { Navigate, useSubmit } from 'react-router-dom'
import { appRoutes } from 'routes'
-import { useState } from 'react'
+import { useEffect, useRef, useState } from 'react'
import { adjustTextareaHeight } from 'utils'
import { NotePreview } from './NotePreview'
interface NoteSubmitProps {
initialContent?: string | undefined
+ handleClose?: () => void | undefined
}
-export const NoteSubmit = ({ initialContent }: NoteSubmitProps) => {
+export const NoteSubmit = ({
+ initialContent,
+ handleClose
+}: NoteSubmitProps) => {
const userState = useAppSelector((state) => state.user)
const profile = useProfile(userState.user?.pubkey as string | undefined, {
cacheUsage: NDKSubscriptionCacheUsage.PARALLEL
})
const [content, setContent] = useState(initialContent ?? '')
const [nsfw, setNsfw] = useState(false)
- const [showPreview, setShowPreview] = useState(false)
+ const [showPreview, setShowPreview] = useState(!!initialContent)
const image = profile?.image || FALLBACK_PROFILE_IMAGE
-
+ const ref = useRef(null)
const submit = useSubmit()
+ useEffect(() => {
+ if (ref.current && !!initialContent) {
+ adjustTextareaHeight(ref.current)
+ ref.current.focus()
+ }
+ }, [initialContent])
+
const handleContentChange = (
event: React.ChangeEvent
) => {
@@ -72,6 +83,7 @@ export const NoteSubmit = ({ initialContent }: NoteSubmitProps) => {
name='content'
className='inputMain feedPostsPostInsideInput'
placeholder='Watcha thinking about?'
+ ref={ref}
value={content}
onChange={handleContentChange}
/>
@@ -97,6 +109,16 @@ export const NoteSubmit = ({ initialContent }: NoteSubmitProps) => {
+ {typeof handleClose === 'function' && (
+
+ )}