feat: add post button to relayInfo component
This commit is contained in:
parent
8c9416a6c8
commit
8b1f11d2ab
19 changed files with 57 additions and 49 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue