-
{profile.name}
+
{profile.name}
{profile.about}
{/* Nostr Public Key */}
diff --git a/src/components/app-body/nostr/nostr-read/index.js b/src/components/app-body/nostr/nostr-read/index.js
index 9b53889..1cc910b 100644
--- a/src/components/app-body/nostr/nostr-read/index.js
+++ b/src/components/app-body/nostr/nostr-read/index.js
@@ -7,14 +7,17 @@ import React, { useState } from 'react'
import { Container } from 'react-bootstrap'
import ProfileRead from './profile-read.js'
import PublicRead from './public-read.js'
+import { useParams } from 'react-router-dom'
function NostrRead (props) {
const [profile, setProfile] = useState(false)
+ const { npub } = useParams()
+ console.log('npub', npub)
return (
<>
-
-
+
+
>
)
diff --git a/src/components/app-body/nostr/nostr-read/profile-read.js b/src/components/app-body/nostr/nostr-read/profile-read.js
index a332658..b3d8a02 100644
--- a/src/components/app-body/nostr/nostr-read/profile-read.js
+++ b/src/components/app-body/nostr/nostr-read/profile-read.js
@@ -9,21 +9,27 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faUser } from '@fortawesome/free-solid-svg-icons'
import NostrFormat from '../nostr-format'
import { RelayPool } from 'nostr'
+import * as nip19 from 'nostr-tools/nip19'
function ProfileRead (props) {
+ const { npub } = props
const { bchWalletState } = props.appData
+ console.log('npub prop', npub)
const { setProfile } = props
const [post, setPost] = useState({})
const [loaded, setLoaded] = useState(false)
useEffect(() => {
const start = () => {
- const { nostrKeyPair } = bchWalletState
+ const pubHexData = nip19.decode(npub)
+ const pubHex = pubHexData.data
+ console.log('pubhex', pubHex)
const psf = 'wss://nostr-relay.psfoundation.info'
const pool = RelayPool([psf])
pool.on('open', relay => {
- relay.subscribe('subid', { limit: 5, kinds: [0], authors: [nostrKeyPair.pubHex] })
+ relay.subscribe('subid', { limit: 5, kinds: [0], authors: [pubHex] })
+ setLoaded(true)
})
pool.on('eose', relay => {
@@ -42,10 +48,10 @@ function ProfileRead (props) {
setLoaded(true)
}
- if (!loaded) {
+ if (!loaded && npub) {
start()
}
- }, [bchWalletState, loaded, setProfile])
+ }, [bchWalletState, loaded, setProfile, npub])
return (
diff --git a/src/components/app-body/nostr/nostr-read/public-read.js b/src/components/app-body/nostr/nostr-read/public-read.js
index 24204fc..c3c3d1c 100644
--- a/src/components/app-body/nostr/nostr-read/public-read.js
+++ b/src/components/app-body/nostr/nostr-read/public-read.js
@@ -8,8 +8,10 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faUser } from '@fortawesome/free-solid-svg-icons'
import NostrFormat from '../nostr-format'
import { RelayPool } from 'nostr'
+import * as nip19 from 'nostr-tools/nip19'
function PublicRead (props) {
+ const { npub } = props
const { bchWalletState } = props.appData
const [posts, setPosts] = useState([])
const [loaded, setLoaded] = useState(false)
@@ -17,13 +19,15 @@ function PublicRead (props) {
useEffect(() => {
// Get Last post from a author
const start = () => {
- const { nostrKeyPair } = bchWalletState
-
+ const pubHexData = nip19.decode(npub)
+ const pubHex = pubHexData.data
+ console.log('pubhex', pubHex)
const psf = 'wss://nostr-relay.psfoundation.info'
const pool = RelayPool([psf])
pool.on('open', relay => {
- relay.subscribe('subid', { limit: 5, kinds: [1], authors: [nostrKeyPair.pubHex] })
+ relay.subscribe('subid', { limit: 5, kinds: [1], authors: [pubHex] })
+ setLoaded(true)
})
pool.on('eose', relay => {
@@ -38,10 +42,10 @@ function PublicRead (props) {
})
}
- if (!loaded) {
+ if (!loaded && npub) {
start()
}
- }, [bchWalletState, loaded])
+ }, [bchWalletState, loaded, npub])
return (
diff --git a/src/components/nav-menu/index.js b/src/components/nav-menu/index.js
index a957ba3..0737add 100644
--- a/src/components/nav-menu/index.js
+++ b/src/components/nav-menu/index.js
@@ -15,7 +15,7 @@ import Logo from './psf-logo.png'
function NavMenu (props) {
// Get the current path
- const { currentPath } = props.appData
+ const { currentPath, bchWalletState } = props.appData
// Navbar state
const [expanded, setExpanded] = useState(false)
@@ -72,7 +72,7 @@ function NavMenu (props) {
Nostr Profile