feat: add post button to relayInfo component
This commit is contained in:
@@ -27,11 +27,13 @@ import Uploader from './Uploader'
|
||||
export default function PostContent({
|
||||
defaultContent = '',
|
||||
parentEvent,
|
||||
close
|
||||
close,
|
||||
openFrom
|
||||
}: {
|
||||
defaultContent?: string
|
||||
parentEvent?: Event
|
||||
close: () => void
|
||||
openFrom?: string[]
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const { pubkey, publish, checkLogin } = useNostr()
|
||||
@@ -233,6 +235,7 @@ export default function PostContent({
|
||||
parentEvent={parentEvent}
|
||||
specifiedRelayUrls={specifiedRelayUrls}
|
||||
setSpecifiedRelayUrls={setSpecifiedRelayUrls}
|
||||
openFrom={openFrom}
|
||||
/>
|
||||
)}
|
||||
<div className="flex items-center justify-between">
|
||||
|
||||
@@ -13,17 +13,24 @@ import { useTranslation } from 'react-i18next'
|
||||
export default function SendOnlyToSwitch({
|
||||
parentEvent,
|
||||
specifiedRelayUrls,
|
||||
setSpecifiedRelayUrls
|
||||
setSpecifiedRelayUrls,
|
||||
openFrom
|
||||
}: {
|
||||
parentEvent?: Event
|
||||
specifiedRelayUrls?: string[]
|
||||
setSpecifiedRelayUrls: Dispatch<SetStateAction<string[] | undefined>>
|
||||
openFrom?: string[]
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const { currentRelayUrls } = useCurrentRelays()
|
||||
const [urls, setUrls] = useState<string[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
if (openFrom?.length) {
|
||||
setUrls(openFrom)
|
||||
setSpecifiedRelayUrls(openFrom)
|
||||
return
|
||||
}
|
||||
if (!parentEvent) {
|
||||
setUrls(currentRelayUrls)
|
||||
return
|
||||
@@ -36,7 +43,7 @@ export default function SendOnlyToSwitch({
|
||||
} else {
|
||||
setUrls(currentRelayUrls)
|
||||
}
|
||||
}, [parentEvent, currentRelayUrls])
|
||||
}, [parentEvent, currentRelayUrls, openFrom])
|
||||
|
||||
if (!urls.length) return null
|
||||
|
||||
|
||||
@@ -24,12 +24,14 @@ export default function PostEditor({
|
||||
defaultContent = '',
|
||||
parentEvent,
|
||||
open,
|
||||
setOpen
|
||||
setOpen,
|
||||
openFrom
|
||||
}: {
|
||||
defaultContent?: string
|
||||
parentEvent?: Event
|
||||
open: boolean
|
||||
setOpen: Dispatch<boolean>
|
||||
openFrom?: string[]
|
||||
}) {
|
||||
const { isSmallScreen } = useScreenSize()
|
||||
|
||||
@@ -39,6 +41,7 @@ export default function PostEditor({
|
||||
defaultContent={defaultContent}
|
||||
parentEvent={parentEvent}
|
||||
close={() => setOpen(false)}
|
||||
openFrom={openFrom}
|
||||
/>
|
||||
)
|
||||
}, [])
|
||||
|
||||
Reference in New Issue
Block a user