issue-38 #62
@ -53,8 +53,8 @@ export const AppBar = () => {
|
|||||||
metadataState.content
|
metadataState.content
|
||||||
)
|
)
|
||||||
|
|
||||||
if (picture || userRobotImage) {
|
if (picture) {
|
||||||
setUserAvatar(picture || userRobotImage)
|
setUserAvatar(picture)
|
||||||
}
|
}
|
||||||
|
|
||||||
setUsername(shorten(display_name || name || '', 7))
|
setUsername(shorten(display_name || name || '', 7))
|
||||||
@ -91,8 +91,8 @@ export const AppBar = () => {
|
|||||||
nsecBunkerPubkey: undefined
|
nsecBunkerPubkey: undefined
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
dispatch(setMetadataEvent(metadataController.getEmptyMetadataEvent()))
|
dispatch(setMetadataEvent(metadataController.getEmptyMetadataEvent()))
|
||||||
dispatch(setUserRobotImage(null))
|
|
||||||
|
|
||||||
// clear authToken saved in local storage
|
// clear authToken saved in local storage
|
||||||
clearAuthToken()
|
clearAuthToken()
|
||||||
|
@ -54,6 +54,10 @@ type UserProps = {
|
|||||||
image?: string
|
image?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This component will be used for the displaying username and profile picture.
|
||||||
|
* If image is not available, robohash image will be displayed
|
||||||
|
*/
|
||||||
export const UserComponent = ({ pubkey, name, image }: UserProps) => {
|
export const UserComponent = ({ pubkey, name, image }: UserProps) => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
|
||||||
|
@ -5,7 +5,12 @@ import { useDispatch, useSelector } from 'react-redux'
|
|||||||
import { Outlet } from 'react-router-dom'
|
import { Outlet } from 'react-router-dom'
|
||||||
import { AppBar } from '../components/AppBar/AppBar'
|
import { AppBar } from '../components/AppBar/AppBar'
|
||||||
import { restoreState, setAuthState, setMetadataEvent } from '../store/actions'
|
import { restoreState, setAuthState, setMetadataEvent } from '../store/actions'
|
||||||
import { clearAuthToken, clearState, getRoboHashPicture, loadState, saveNsecBunkerDelegatedKey } from '../utils'
|
import {
|
||||||
|
clearAuthToken,
|
||||||
|
clearState,
|
||||||
|
loadState,
|
||||||
|
saveNsecBunkerDelegatedKey
|
||||||
|
} from '../utils'
|
||||||
import { LoadingSpinner } from '../components/LoadingSpinner'
|
import { LoadingSpinner } from '../components/LoadingSpinner'
|
||||||
import { Dispatch } from '../store/store'
|
import { Dispatch } from '../store/store'
|
||||||
import { MetadataController, NostrController } from '../controllers'
|
import { MetadataController, NostrController } from '../controllers'
|
||||||
@ -32,9 +37,7 @@ export const MainLayout = () => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
dispatch(
|
dispatch(setMetadataEvent(metadataController.getEmptyMetadataEvent()))
|
||||||
setMetadataEvent(metadataController.getEmptyMetadataEvent())
|
|
||||||
)
|
|
||||||
|
|
||||||
// clear authToken saved in local storage
|
// clear authToken saved in local storage
|
||||||
clearAuthToken()
|
clearAuthToken()
|
||||||
@ -78,11 +81,9 @@ export const MainLayout = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (authState && authState.loggedIn) {
|
if (authState && authState.loggedIn) {
|
||||||
const pubkey = authState.usersPubkey || authState.keyPair?.public
|
const pubkey = authState.usersPubkey || authState.keyPair?.public
|
||||||
|
|
||||||
if (pubkey) {
|
if (pubkey) {
|
||||||
dispatch(
|
dispatch(setUserRobotImage(getRoboHashPicture(pubkey)))
|
||||||
setUserRobotImage(getRoboHashPicture(pubkey))
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [authState])
|
}, [authState])
|
||||||
|
@ -63,7 +63,6 @@ export const Login = () => {
|
|||||||
dispatch(updateLoginMethod(LoginMethods.extension))
|
dispatch(updateLoginMethod(LoginMethods.extension))
|
||||||
|
|
||||||
setLoadingSpinnerDesc('Authenticating and finding metadata')
|
setLoadingSpinnerDesc('Authenticating and finding metadata')
|
||||||
|
|
||||||
const redirectPath =
|
const redirectPath =
|
||||||
await authController.authAndGetMetadataAndRelaysMap(pubkey)
|
await authController.authAndGetMetadataAndRelaysMap(pubkey)
|
||||||
|
|
||||||
|
@ -90,6 +90,8 @@ export const SignPage = () => {
|
|||||||
} else {
|
} else {
|
||||||
for (const signer of meta.signers) {
|
for (const signer of meta.signers) {
|
||||||
if (!signedBy.includes(signer)) {
|
if (!signedBy.includes(signer)) {
|
||||||
|
// signers in meta.json are in npub1 format
|
||||||
|
// so, convert it to hex before setting to nextSigner
|
||||||
setNextSinger(npubToHex(signer)!)
|
setNextSinger(npubToHex(signer)!)
|
||||||
|
|
||||||
const usersNpub = hexToNpub(usersPubkey!)
|
const usersNpub = hexToNpub(usersPubkey!)
|
||||||
|
Loading…
Reference in New Issue
Block a user