From 6604ea2046afea40fc3deeb0548016b3ec1fe53d Mon Sep 17 00:00:00 2001 From: Davinci Date: Fri, 17 May 2024 09:37:30 +0200 Subject: [PATCH 1/5] fix: looping trough robo sets, image not shown when visiting profile while not logged in --- .env.example | 2 +- src/pages/profile/index.tsx | 17 ++++++++++++----- src/utils/nostr.ts | 4 ++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 7239454..6b61434 100644 --- a/.env.example +++ b/.env.example @@ -1 +1 @@ -VITE_MOST_POPULAR_RELAYS=wss://relay.damus.io wss://eden.nostr.land wss://nos.lol wss://relay.snort.social wss://relay.current.fyi wss://brb.io wss://nostr.orangepill.dev wss://nostr-pub.wellorder.net wss://nostr.wine wss://nostr.oxtr.dev wss://relay.nostr.bg wss://nostr.mom wss://nostr.fmt.wiz.biz wss://relay.nostr.band wss://nostr-pub.semisol.dev wss://nostr.milou.lol wss://puravida.nostr.land wss://nostr.onsats.org wss://relay.nostr.info wss://offchain.pub wss://relay.orangepill.dev wss://no.str.cr wss://atlas.nostr.land wss://nostr.zebedee.cloud wss://nostr-relay.wlvs.space wss://relay.nostrati.com wss://relay.nostr.com.au wss://nostr.inosta.cc wss://nostr.rocks \ No newline at end of file +VITE_MOST_POPULAR_RELAYS=wss://relay.damus.io wss://eden.nostr.land wss://nos.lol wss://relay.snort.social wss://relay.current.fyi wss://brb.io wss://nostr.orangepill.dev wss://nostr-pub.wellorder.net wss://nostr.bitcoiner.social wss://nostr.wine wss://nostr.oxtr.dev wss://relay.nostr.bg wss://nostr.mom wss://nostr.fmt.wiz.biz wss://relay.nostr.band wss://nostr-pub.semisol.dev wss://nostr.milou.lol wss://puravida.nostr.land wss://nostr.onsats.org wss://relay.nostr.info wss://offchain.pub wss://relay.orangepill.dev wss://no.str.cr wss://atlas.nostr.land wss://nostr.zebedee.cloud wss://nostr-relay.wlvs.space wss://relay.nostrati.com wss://relay.nostr.com.au wss://nostr.inosta.cc wss://nostr.rocks \ No newline at end of file diff --git a/src/pages/profile/index.tsx b/src/pages/profile/index.tsx index ca6fbd5..677bbe7 100644 --- a/src/pages/profile/index.tsx +++ b/src/pages/profile/index.tsx @@ -12,7 +12,7 @@ import { useTheme } from '@mui/material' import { UnsignedEvent, nip19, kinds, VerifiedEvent } from 'nostr-tools' -import { useEffect, useMemo, useState } from 'react' +import { useEffect, useMemo, useRef, useState } from 'react' import { Link, useParams } from 'react-router-dom' import { toast } from 'react-toastify' import { MetadataController, NostrController } from '../../controllers' @@ -26,6 +26,7 @@ import { setMetadataEvent } from '../../store/actions' import { LoadingSpinner } from '../../components/LoadingSpinner' import { LoginMethods } from '../../store/auth/types' import { SmartToy } from '@mui/icons-material' +import { getRoboHashPicture } from '../../utils' export const ProfilePage = () => { const theme = useTheme() @@ -52,6 +53,8 @@ export const ProfilePage = () => { const [isLoading, setIsLoading] = useState(true) const [loadingSpinnerDesc] = useState('Fetching metadata') + const robotSet = useRef(1) + useEffect(() => { if (npub) { try { @@ -213,7 +216,10 @@ export const ProfilePage = () => { const generateRobotAvatar = () => { setAvatarLoading(true) - const robotAvatarLink = `https://robohash.org/${npub}.png?set=set3` + robotSet.current++ + if (robotSet.current > 5) robotSet.current = 1 + + const robotAvatarLink = getRoboHashPicture(npub!, robotSet.current) setProfileMetadata((prev) => ({ ...prev, @@ -233,8 +239,6 @@ export const ProfilePage = () => { * @returns robohash generate button, loading spinner or no button */ const robohashButton = () => { - if (profileMetadata?.picture?.includes('robohash')) return null - return ( {avatarLoading ? ( @@ -280,6 +284,9 @@ export const ProfilePage = () => { }} > { + event.target.src = npub ? getRoboHashPicture(npub) : '' + }} onLoad={() => { setAvatarLoading(false) }} @@ -305,7 +312,7 @@ export const ProfilePage = () => { {editItem('picture', 'Picture URL', undefined, undefined, { - endAdornment: robohashButton() + endAdornment: isUsersOwnProfile ? robohashButton() : undefined })} {editItem('name', 'Username')} diff --git a/src/utils/nostr.ts b/src/utils/nostr.ts index a39502f..7d5b23d 100644 --- a/src/utils/nostr.ts +++ b/src/utils/nostr.ts @@ -145,7 +145,7 @@ export const base64DecodeAuthToken = (authToken: string): SignedEvent => { * @param pubkey in hex or npub format * @returns robohash.org url for the avatar */ -export const getRoboHashPicture = (pubkey: string): string => { +export const getRoboHashPicture = (pubkey: string, set: number = 1): string => { const npub = hexToNpub(pubkey) - return `https://robohash.org/${npub}.png?set=set3` + return `https://robohash.org/${npub}.png?set=set${set}` } -- 2.34.1 From 5f8e8fd6f4eb6bf74c04abb51c2af545eda2be45 Mon Sep 17 00:00:00 2001 From: Davinci Date: Fri, 17 May 2024 13:33:01 +0200 Subject: [PATCH 2/5] fix: profile picture inconsistencies, login with enter --- src/components/AppBar/AppBar.tsx | 14 +++++--- src/controllers/AuthController.ts | 24 ------------- src/controllers/MetadataController.ts | 1 + src/layouts/Main.tsx | 24 +++++++++++-- src/main.tsx | 3 +- src/pages/login/index.tsx | 11 ++++++ src/pages/profile/index.tsx | 52 ++++++++++++++------------- src/store/actionTypes.ts | 2 ++ src/store/rootReducer.ts | 5 ++- src/store/userRobotImage/action.ts | 7 ++++ src/store/userRobotImage/reducer.ts | 22 ++++++++++++ src/store/userRobotImage/types.ts | 9 +++++ src/utils/nostr.ts | 3 +- 13 files changed, 119 insertions(+), 58 deletions(-) create mode 100644 src/store/userRobotImage/action.ts create mode 100644 src/store/userRobotImage/reducer.ts create mode 100644 src/store/userRobotImage/types.ts diff --git a/src/components/AppBar/AppBar.tsx b/src/components/AppBar/AppBar.tsx index af03c5c..c846a56 100644 --- a/src/components/AppBar/AppBar.tsx +++ b/src/components/AppBar/AppBar.tsx @@ -25,6 +25,7 @@ import { shorten } from '../../utils' import styles from './style.module.scss' +import { setUserRobotImage } from '../../store/userRobotImage/action' const metadataController = new MetadataController() @@ -39,23 +40,24 @@ export const AppBar = () => { const authState = useSelector((state: State) => state.auth) const metadataState = useSelector((state: State) => state.metadata) + const userRobotImage = useSelector((state: State) => state.userRobotImage) useEffect(() => { if (metadataState) { if (metadataState.content) { const { picture, display_name, name } = JSON.parse(metadataState.content) - if (picture) { - setUserAvatar(picture) + if (picture || userRobotImage) { + setUserAvatar(picture || userRobotImage) } setUsername(shorten(display_name || name || '', 7)) } else { - setUserAvatar('') + setUserAvatar(userRobotImage || '') setUsername('') } } - }, [metadataState]) + }, [metadataState, userRobotImage]) const handleOpenUserMenu = (event: React.MouseEvent) => { setAnchorElUser(event.currentTarget) @@ -83,10 +85,12 @@ export const AppBar = () => { nsecBunkerPubkey: undefined }) ) - dispatch( setMetadataEvent(metadataController.getEmptyMetadataEvent()) ) + dispatch( + setUserRobotImage(null) + ) // clear authToken saved in local storage clearAuthToken() diff --git a/src/controllers/AuthController.ts b/src/controllers/AuthController.ts index 7e1c00d..c866273 100644 --- a/src/controllers/AuthController.ts +++ b/src/controllers/AuthController.ts @@ -34,34 +34,10 @@ export class AuthController { async authenticateAndFindMetadata(pubkey: string) { const emptyMetadata = this.metadataController.getEmptyMetadataEvent() - emptyMetadata.content = JSON.stringify({ - picture: getRoboHashPicture(pubkey) - }) - this.metadataController .findMetadata(pubkey) .then((event) => { if (event) { - // In case of NIP05 there is scenario where login content will be populated but without an image - // In such case we will add robohash image - if (event.content) { - const content = JSON.parse(event.content) - - if (!content) { - event.content = '' - } - - if (!content.picture) { - content.picture = getRoboHashPicture(pubkey) - } - - event.content = JSON.stringify(content) - } else { - event.content = JSON.stringify({ - picture: getRoboHashPicture(pubkey) - }) - } - store.dispatch(setMetadataEvent(event)) } else { store.dispatch(setMetadataEvent(emptyMetadata)) diff --git a/src/controllers/MetadataController.ts b/src/controllers/MetadataController.ts index f13440d..360acc6 100644 --- a/src/controllers/MetadataController.ts +++ b/src/controllers/MetadataController.ts @@ -142,6 +142,7 @@ export class MetadataController { public extractProfileMetadataContent = (event: VerifiedEvent) => { try { + if (!event.content) return {} return JSON.parse(event.content) as ProfileMetadata } catch (error) { console.log('error in parsing metadata event content :>> ', error) diff --git a/src/layouts/Main.tsx b/src/layouts/Main.tsx index e258e36..c1a827e 100644 --- a/src/layouts/Main.tsx +++ b/src/layouts/Main.tsx @@ -1,21 +1,24 @@ import { Box } from '@mui/material' import Container from '@mui/material/Container' import { useEffect, useState } from 'react' -import { useDispatch } from 'react-redux' +import { useDispatch, useSelector } from 'react-redux' import { Outlet } from 'react-router-dom' import { AppBar } from '../components/AppBar/AppBar' import { restoreState, setAuthState, setMetadataEvent } from '../store/actions' -import { clearAuthToken, clearState, loadState, saveNsecBunkerDelegatedKey } from '../utils' +import { clearAuthToken, clearState, getRoboHashPicture, loadState, saveNsecBunkerDelegatedKey } from '../utils' import { LoadingSpinner } from '../components/LoadingSpinner' import { Dispatch } from '../store/store' import { MetadataController, NostrController } from '../controllers' import { LoginMethods } from '../store/auth/types' +import { setUserRobotImage } from '../store/userRobotImage/action' +import { State } from '../store/rootReducer' const metadataController = new MetadataController() export const MainLayout = () => { const dispatch: Dispatch = useDispatch() const [isLoading, setIsLoading] = useState(true) + const authState = useSelector((state: State) => state.auth) useEffect(() => { const logout = () => { @@ -67,6 +70,23 @@ export const MainLayout = () => { setIsLoading(false) }, [dispatch]) + /** + * When authState change user logged in / or app reloaded + * we set robohash avatar in the global state based on user npub + * so that avatar will be consistent across the app when kind 0 is empty + */ + useEffect(() => { + if (authState && authState.loggedIn) { + const pubkey = authState.usersPubkey || authState.keyPair?.public + + if (pubkey) { + dispatch( + setUserRobotImage(getRoboHashPicture(pubkey)) + ) + } + } + }, [authState]) + if (isLoading) return return ( diff --git a/src/main.tsx b/src/main.tsx index 0b362fc..d586217 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -14,7 +14,8 @@ store.subscribe( _.throttle(() => { saveState({ auth: store.getState().auth, - metadata: store.getState().metadata + metadata: store.getState().metadata, + userRobotImage: store.getState().userRobotImage }) }, 1000) ) diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index d05edb8..d0990a8 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -43,6 +43,16 @@ export const Login = () => { }, 500) }, []) + /** + * Call login function when enter is pressed + */ + const handleInputKeyDown = (event: any) => { + if (event.code === "Enter" || event.code === "NumpadEnter") { + event.preventDefault(); + login() + } + } + const loginWithExtension = async () => { setIsLoading(true) setLoadingSpinnerDesc('Capturing pubkey from nostr extension') @@ -303,6 +313,7 @@ export const Login = () => {
Welcome to Sigit setInputValue(e.target.value)} diff --git a/src/pages/profile/index.tsx b/src/pages/profile/index.tsx index 677bbe7..bc6d587 100644 --- a/src/pages/profile/index.tsx +++ b/src/pages/profile/index.tsx @@ -1,6 +1,5 @@ import ContentCopyIcon from '@mui/icons-material/ContentCopy' import { - CircularProgress, IconButton, InputProps, List, @@ -43,10 +42,10 @@ export const ProfilePage = () => { useState(null) const [profileMetadata, setProfileMetadata] = useState() const [savingProfileMetadata, setSavingProfileMetadata] = useState(false) - const [avatarLoading, setAvatarLoading] = useState(false) const metadataState = useSelector((state: State) => state.metadata) const keys = useSelector((state: State) => state.auth?.keyPair) const { usersPubkey, loginMethod } = useSelector((state: State) => state.auth) + const userRobotImage = useSelector((state: State) => state.userRobotImage) const [isUsersOwnProfile, setIsUsersOwnProfile] = useState(false) @@ -213,9 +212,12 @@ export const ProfilePage = () => { setSavingProfileMetadata(false) } + /** + * Called by clicking on the robot icon inside Picture URL input + * On every click, next robohash set will be generated. + * There are 5 sets at the moment, after 5th set function will start over from set 1. + */ const generateRobotAvatar = () => { - setAvatarLoading(true) - robotSet.current++ if (robotSet.current > 5) robotSet.current = 1 @@ -223,15 +225,8 @@ export const ProfilePage = () => { setProfileMetadata((prev) => ({ ...prev, - picture: '' + picture: robotAvatarLink })) - - setTimeout(() => { - setProfileMetadata((prev) => ({ - ...prev, - picture: robotAvatarLink - })) - }) } /** @@ -241,17 +236,29 @@ export const ProfilePage = () => { const robohashButton = () => { return ( - {avatarLoading ? ( - - ) : ( - - - - )} + + + ) } + /** + * Handles the logic for Image URL. + * If no picture in kind 0 found - use robohash avatar + * + * @returns robohash image url + */ + const getProfileImage = (metadata: ProfileMetadata) => { + if (!isUsersOwnProfile) { + return metadata.picture || getRoboHashPicture(npub!) + } + + // userRobotImage is used only when visiting own profile + // while kind 0 picture is not set + return metadata.picture || userRobotImage || getRoboHashPicture(npub!) + } + return ( <> {isLoading && } @@ -285,13 +292,10 @@ export const ProfilePage = () => { > { - event.target.src = npub ? getRoboHashPicture(npub) : '' + event.target.src = getRoboHashPicture(npub!) }} - onLoad={() => { - setAvatarLoading(false) - }} className={styles.img} - src={profileMetadata.picture} + src={getProfileImage(profileMetadata)} alt="Profile Image" /> diff --git a/src/store/actionTypes.ts b/src/store/actionTypes.ts index d3047a6..6e0cc66 100644 --- a/src/store/actionTypes.ts +++ b/src/store/actionTypes.ts @@ -7,3 +7,5 @@ export const UPDATE_NSECBUNKER_PUBKEY = 'UPDATE_NSECBUNKER_PUBKEY' export const UPDATE_NSECBUNKER_RELAYS = 'UPDATE_NSECBUNKER_RELAYS' export const SET_METADATA_EVENT = 'SET_METADATA_EVENT' + +export const SET_USER_ROBOT_IMAGE = 'SET_USER_ROBOT_IMAGE' diff --git a/src/store/rootReducer.ts b/src/store/rootReducer.ts index f56217f..03c9b5c 100644 --- a/src/store/rootReducer.ts +++ b/src/store/rootReducer.ts @@ -3,13 +3,16 @@ import { combineReducers } from 'redux' import authReducer from './auth/reducer' import { AuthState } from './auth/types' import metadataReducer from './metadata/reducer' +import userRobotImageReducer from './userRobotImage/reducer' export interface State { auth: AuthState metadata?: Event + userRobotImage?: string } export default combineReducers({ auth: authReducer, - metadata: metadataReducer + metadata: metadataReducer, + userRobotImage: userRobotImageReducer }) diff --git a/src/store/userRobotImage/action.ts b/src/store/userRobotImage/action.ts new file mode 100644 index 0000000..cfb83e6 --- /dev/null +++ b/src/store/userRobotImage/action.ts @@ -0,0 +1,7 @@ +import * as ActionTypes from '../actionTypes' +import { SetUserRobotImage } from './types' + +export const setUserRobotImage = (payload: string | null): SetUserRobotImage => ({ + type: ActionTypes.SET_USER_ROBOT_IMAGE, + payload +}) diff --git a/src/store/userRobotImage/reducer.ts b/src/store/userRobotImage/reducer.ts new file mode 100644 index 0000000..61369ed --- /dev/null +++ b/src/store/userRobotImage/reducer.ts @@ -0,0 +1,22 @@ +import * as ActionTypes from '../actionTypes' +import { MetadataDispatchTypes } from './types' + +const initialState: string | null = null + +const reducer = ( + state = initialState, + action: MetadataDispatchTypes +): string | null => { + switch (action.type) { + case ActionTypes.SET_USER_ROBOT_IMAGE: + return action.payload + + case ActionTypes.RESTORE_STATE: + return action.payload.userRobotImage || null + + default: + return state + } +} + +export default reducer diff --git a/src/store/userRobotImage/types.ts b/src/store/userRobotImage/types.ts new file mode 100644 index 0000000..05d1475 --- /dev/null +++ b/src/store/userRobotImage/types.ts @@ -0,0 +1,9 @@ +import * as ActionTypes from '../actionTypes' +import { RestoreState } from '../actions' + +export interface SetUserRobotImage { + type: typeof ActionTypes.SET_USER_ROBOT_IMAGE + payload: string | null +} + +export type MetadataDispatchTypes = SetUserRobotImage | RestoreState diff --git a/src/utils/nostr.ts b/src/utils/nostr.ts index 7d5b23d..ad68486 100644 --- a/src/utils/nostr.ts +++ b/src/utils/nostr.ts @@ -145,7 +145,8 @@ export const base64DecodeAuthToken = (authToken: string): SignedEvent => { * @param pubkey in hex or npub format * @returns robohash.org url for the avatar */ -export const getRoboHashPicture = (pubkey: string, set: number = 1): string => { +export const getRoboHashPicture = (pubkey?: string, set: number = 1): string => { + if (!pubkey) return '' const npub = hexToNpub(pubkey) return `https://robohash.org/${npub}.png?set=set${set}` } -- 2.34.1 From 194c564ddc22c7ca9c616672c5925805f5bdccdb Mon Sep 17 00:00:00 2001 From: Davinci Date: Fri, 17 May 2024 13:35:37 +0200 Subject: [PATCH 3/5] style: lint fix --- src/components/AppBar/AppBar.tsx | 14 ++++++-------- src/layouts/Main.tsx | 14 +++++++++----- src/pages/login/index.tsx | 6 +++--- src/pages/profile/index.tsx | 6 +++--- src/store/userRobotImage/action.ts | 4 +++- src/utils/nostr.ts | 5 ++++- 6 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/components/AppBar/AppBar.tsx b/src/components/AppBar/AppBar.tsx index 372dfd2..78f4f01 100644 --- a/src/components/AppBar/AppBar.tsx +++ b/src/components/AppBar/AppBar.tsx @@ -45,8 +45,10 @@ export const AppBar = () => { useEffect(() => { if (metadataState) { if (metadataState.content) { - const { picture, display_name, name } = JSON.parse(metadataState.content) - + const { picture, display_name, name } = JSON.parse( + metadataState.content + ) + if (picture || userRobotImage) { setUserAvatar(picture || userRobotImage) } @@ -85,12 +87,8 @@ export const AppBar = () => { nsecBunkerPubkey: undefined }) ) - dispatch( - setMetadataEvent(metadataController.getEmptyMetadataEvent()) - ) - dispatch( - setUserRobotImage(null) - ) + dispatch(setMetadataEvent(metadataController.getEmptyMetadataEvent())) + dispatch(setUserRobotImage(null)) // clear authToken saved in local storage clearAuthToken() diff --git a/src/layouts/Main.tsx b/src/layouts/Main.tsx index 35dd962..9c4f4e4 100644 --- a/src/layouts/Main.tsx +++ b/src/layouts/Main.tsx @@ -5,7 +5,13 @@ import { useDispatch, useSelector } from 'react-redux' import { Outlet } from 'react-router-dom' import { AppBar } from '../components/AppBar/AppBar' import { restoreState, setAuthState, setMetadataEvent } from '../store/actions' -import { clearAuthToken, clearState, getRoboHashPicture, loadState, saveNsecBunkerDelegatedKey } from '../utils' +import { + clearAuthToken, + clearState, + getRoboHashPicture, + loadState, + saveNsecBunkerDelegatedKey +} from '../utils' import { LoadingSpinner } from '../components/LoadingSpinner' import { Dispatch } from '../store/store' import { MetadataController, NostrController } from '../controllers' @@ -76,11 +82,9 @@ export const MainLayout = () => { useEffect(() => { if (authState && authState.loggedIn) { const pubkey = authState.usersPubkey || authState.keyPair?.public - + if (pubkey) { - dispatch( - setUserRobotImage(getRoboHashPicture(pubkey)) - ) + dispatch(setUserRobotImage(getRoboHashPicture(pubkey))) } } }, [authState]) diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index 69df0a0..edfe5ae 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -47,9 +47,9 @@ export const Login = () => { * Call login function when enter is pressed */ const handleInputKeyDown = (event: any) => { - if (event.code === "Enter" || event.code === "NumpadEnter") { - event.preventDefault(); - login() + if (event.code === 'Enter' || event.code === 'NumpadEnter') { + event.preventDefault() + login() } } diff --git a/src/pages/profile/index.tsx b/src/pages/profile/index.tsx index bc6d587..318f115 100644 --- a/src/pages/profile/index.tsx +++ b/src/pages/profile/index.tsx @@ -246,14 +246,14 @@ export const ProfilePage = () => { /** * Handles the logic for Image URL. * If no picture in kind 0 found - use robohash avatar - * + * * @returns robohash image url */ const getProfileImage = (metadata: ProfileMetadata) => { if (!isUsersOwnProfile) { return metadata.picture || getRoboHashPicture(npub!) } - + // userRobotImage is used only when visiting own profile // while kind 0 picture is not set return metadata.picture || userRobotImage || getRoboHashPicture(npub!) @@ -293,7 +293,7 @@ export const ProfilePage = () => { { event.target.src = getRoboHashPicture(npub!) - }} + }} className={styles.img} src={getProfileImage(profileMetadata)} alt="Profile Image" diff --git a/src/store/userRobotImage/action.ts b/src/store/userRobotImage/action.ts index cfb83e6..5bec4ef 100644 --- a/src/store/userRobotImage/action.ts +++ b/src/store/userRobotImage/action.ts @@ -1,7 +1,9 @@ import * as ActionTypes from '../actionTypes' import { SetUserRobotImage } from './types' -export const setUserRobotImage = (payload: string | null): SetUserRobotImage => ({ +export const setUserRobotImage = ( + payload: string | null +): SetUserRobotImage => ({ type: ActionTypes.SET_USER_ROBOT_IMAGE, payload }) diff --git a/src/utils/nostr.ts b/src/utils/nostr.ts index e027b8a..229b7be 100644 --- a/src/utils/nostr.ts +++ b/src/utils/nostr.ts @@ -143,7 +143,10 @@ export const base64DecodeAuthToken = (authToken: string): SignedEvent => { * @param pubkey in hex or npub format * @returns robohash.org url for the avatar */ -export const getRoboHashPicture = (pubkey?: string, set: number = 1): string => { +export const getRoboHashPicture = ( + pubkey?: string, + set: number = 1 +): string => { if (!pubkey) return '' const npub = hexToNpub(pubkey) return `https://robohash.org/${npub}.png?set=set${set}` -- 2.34.1 From 2cb7088f5ef5333881b3e5cafe3aa527d5e272de Mon Sep 17 00:00:00 2001 From: Davinci Date: Fri, 17 May 2024 13:41:01 +0200 Subject: [PATCH 4/5] chore: env.example --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 6b61434..7239454 100644 --- a/.env.example +++ b/.env.example @@ -1 +1 @@ -VITE_MOST_POPULAR_RELAYS=wss://relay.damus.io wss://eden.nostr.land wss://nos.lol wss://relay.snort.social wss://relay.current.fyi wss://brb.io wss://nostr.orangepill.dev wss://nostr-pub.wellorder.net wss://nostr.bitcoiner.social wss://nostr.wine wss://nostr.oxtr.dev wss://relay.nostr.bg wss://nostr.mom wss://nostr.fmt.wiz.biz wss://relay.nostr.band wss://nostr-pub.semisol.dev wss://nostr.milou.lol wss://puravida.nostr.land wss://nostr.onsats.org wss://relay.nostr.info wss://offchain.pub wss://relay.orangepill.dev wss://no.str.cr wss://atlas.nostr.land wss://nostr.zebedee.cloud wss://nostr-relay.wlvs.space wss://relay.nostrati.com wss://relay.nostr.com.au wss://nostr.inosta.cc wss://nostr.rocks \ No newline at end of file +VITE_MOST_POPULAR_RELAYS=wss://relay.damus.io wss://eden.nostr.land wss://nos.lol wss://relay.snort.social wss://relay.current.fyi wss://brb.io wss://nostr.orangepill.dev wss://nostr-pub.wellorder.net wss://nostr.wine wss://nostr.oxtr.dev wss://relay.nostr.bg wss://nostr.mom wss://nostr.fmt.wiz.biz wss://relay.nostr.band wss://nostr-pub.semisol.dev wss://nostr.milou.lol wss://puravida.nostr.land wss://nostr.onsats.org wss://relay.nostr.info wss://offchain.pub wss://relay.orangepill.dev wss://no.str.cr wss://atlas.nostr.land wss://nostr.zebedee.cloud wss://nostr-relay.wlvs.space wss://relay.nostrati.com wss://relay.nostr.com.au wss://nostr.inosta.cc wss://nostr.rocks \ No newline at end of file -- 2.34.1 From ccc31c51c99945b5f0634bbe2ce11851d86ae367 Mon Sep 17 00:00:00 2001 From: Davinci Date: Fri, 17 May 2024 13:49:23 +0200 Subject: [PATCH 5/5] fix: userRobotImage reducer type fix --- src/store/userRobotImage/reducer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/userRobotImage/reducer.ts b/src/store/userRobotImage/reducer.ts index 61369ed..4235a48 100644 --- a/src/store/userRobotImage/reducer.ts +++ b/src/store/userRobotImage/reducer.ts @@ -6,13 +6,13 @@ const initialState: string | null = null const reducer = ( state = initialState, action: MetadataDispatchTypes -): string | null => { +): string | null | undefined => { switch (action.type) { case ActionTypes.SET_USER_ROBOT_IMAGE: return action.payload case ActionTypes.RESTORE_STATE: - return action.payload.userRobotImage || null + return action.payload.userRobotImage default: return state -- 2.34.1