chore: revert changes related to displaying nsecbunker connection string
All checks were successful
Release / build_and_release (push) Successful in 43s

This commit is contained in:
Sabir Hassan 2024-03-25 10:30:01 +05:00
parent b2a8cff907
commit a70d02b4ea
9 changed files with 9 additions and 136 deletions

View File

@ -17,19 +17,14 @@ import Username from '../username'
import { Link, useNavigate } from 'react-router-dom'
import nostrichAvatar from '../../assets/images/avatar.png'
import nostrichLogo from '../../assets/images/nostr-logo.jpg'
import {
appPrivateRoutes,
appPublicRoutes,
getProfileRoute
} from '../../routes'
import { NostrController } from '../../controllers'
import { appPublicRoutes, getProfileRoute } from '../../routes'
import {
clearAuthToken,
saveNsecBunkerDelegatedKey,
shorten
} from '../../utils'
import styles from './style.module.scss'
import { NostrController } from '../../controllers'
import { LoginMethods } from '../../store/auth/types'
export const AppBar = () => {
const navigate = useNavigate()
@ -73,8 +68,7 @@ export const AppBar = () => {
loggedIn: false,
usersPubkey: undefined,
loginMethod: undefined,
nsecBunkerPubkey: undefined,
nsecbunkerRelay: undefined
nsecBunkerPubkey: undefined
})
)
@ -147,16 +141,6 @@ export const AppBar = () => {
>
Profile
</MenuItem>
{authState.loginMethod === LoginMethods.nsecBunker && (
<MenuItem
onClick={() => navigate(appPrivateRoutes.nsecbunker)}
sx={{
justifyContent: 'center'
}}
>
Nsecbunker
</MenuItem>
)}
<Link
to={appPublicRoutes.help}
target='_blank'

View File

@ -2,6 +2,7 @@ import { Box, Button, TextField, Typography } from '@mui/material'
import { getPublicKey, nip19 } from 'nostr-tools'
import { useEffect, useState } from 'react'
import { useDispatch } from 'react-redux'
import { useNavigate } from 'react-router-dom'
import { toast } from 'react-toastify'
import { LoadingSpinner } from '../../components/LoadingSpinner'
import {
@ -12,14 +13,12 @@ import {
import {
updateKeyPair,
updateLoginMethod,
updateNsecbunkerPubkey,
updateNsecbunkerRelay
updateNsecbunkerPubkey
} from '../../store/actions'
import { LoginMethods } from '../../store/auth/types'
import { Dispatch } from '../../store/store'
import styles from './style.module.scss'
import { useNavigate } from 'react-router-dom'
import { pubToHex, queryNip05 } from '../../utils'
import styles from './style.module.scss'
export const Login = () => {
const dispatch: Dispatch = useDispatch()
@ -184,7 +183,6 @@ export const Login = () => {
dispatch(updateLoginMethod(LoginMethods.nsecBunker))
dispatch(updateNsecbunkerPubkey(pubkey))
dispatch(updateNsecbunkerRelay(relays![0]))
setLoadingSpinnerDesc('Authenticating and finding metadata')
@ -244,7 +242,6 @@ export const Login = () => {
dispatch(updateLoginMethod(LoginMethods.nsecBunker))
dispatch(updateNsecbunkerPubkey(pubkey))
dispatch(updateNsecbunkerRelay(relay))
setLoadingSpinnerDesc('Authenticating and finding metadata')

View File

@ -1,69 +0,0 @@
import {
IconButton,
InputAdornment,
List,
ListItem,
ListSubheader,
TextField
} from '@mui/material'
import { ContentCopy } from '@mui/icons-material'
import { useSelector } from 'react-redux'
import { State } from '../../store/rootReducer'
import styles from './style.module.scss'
import { toast } from 'react-toastify'
export const Nsecbunker = () => {
const authState = useSelector((state: State) => state.auth)
const nsecbunkerConnectionString = `bunker://${authState?.nsecBunkerPubkey}?relay=${authState?.nsecbunkerRelay}`
return (
<List
sx={{
bgcolor: 'background.paper',
marginTop: 2
}}
subheader={
<ListSubheader
sx={{
paddingBottom: 1,
paddingTop: 1,
fontSize: '1.5rem'
}}
className={styles.subHeader}
>
Nsecbunker Setting
</ListSubheader>
}
>
<ListItem sx={{ marginTop: 1 }}>
<TextField
label='Nsecbunker connection string'
variant='outlined'
size='small'
className={styles.textField}
value={nsecbunkerConnectionString}
disabled
InputProps={{
endAdornment: (
<InputAdornment position='end'>
<IconButton
aria-label='copy value icon button'
onClick={() => {
navigator.clipboard.writeText(nsecbunkerConnectionString)
toast.success('Copied to clipboard', {
autoClose: 1000,
hideProgressBar: true
})
}}
>
<ContentCopy />
</IconButton>
</InputAdornment>
)
}}
/>
</ListItem>
</List>
)
}

View File

@ -1,7 +0,0 @@
.textField {
width: 100%;
}
.subHeader {
border-bottom: 0.5px solid;
}

View File

@ -1,12 +1,10 @@
import { LandingPage } from '../pages/landing/LandingPage'
import { Login } from '../pages/login'
import { Nsecbunker } from '../pages/nsecbunker'
import { ProfilePage } from '../pages/profile'
import { hexToNpub } from '../utils'
export const appPrivateRoutes = {
homePage: '/',
nsecbunker: '/nsecbunker'
homePage: '/'
}
export const appPublicRoutes = {
@ -34,9 +32,5 @@ export const privateRoutes = [
{
path: appPrivateRoutes.homePage,
element: <LandingPage />
},
{
path: appPrivateRoutes.nsecbunker,
element: <Nsecbunker />
}
]

View File

@ -4,6 +4,5 @@ export const SET_AUTH_STATE = 'SET_AUTH_STATE'
export const UPDATE_LOGIN_METHOD = 'UPDATE_LOGIN_METHOD'
export const UPDATE_KEYPAIR = 'UPDATE_KEYPAIR'
export const UPDATE_NSECBUNKER_PUBKEY = 'UPDATE_NSECBUNKER_PUBKEY'
export const UPDATE_NSECBUNKER_RELAY = 'UPDATE_NSECBUNKER_RELAY'
export const SET_METADATA_EVENT = 'SET_METADATA_EVENT'

View File

@ -6,8 +6,7 @@ import {
SetAuthState,
UpdateKeyPair,
UpdateLoginMethod,
UpdateNsecBunkerPubkey,
UpdateNsecbunkerRelay
UpdateNsecBunkerPubkey
} from './types'
export const setAuthState = (payload: AuthState): SetAuthState => ({
@ -33,10 +32,3 @@ export const updateNsecbunkerPubkey = (
type: ActionTypes.UPDATE_NSECBUNKER_PUBKEY,
payload
})
export const updateNsecbunkerRelay = (
payload: string | undefined
): UpdateNsecbunkerRelay => ({
type: ActionTypes.UPDATE_NSECBUNKER_RELAY,
payload
})

View File

@ -11,13 +11,12 @@ const reducer = (
): AuthState | null => {
switch (action.type) {
case ActionTypes.SET_AUTH_STATE: {
const { loginMethod, keyPair, nsecBunkerPubkey, nsecbunkerRelay } = state
const { loginMethod, keyPair, nsecBunkerPubkey } = state
return {
loginMethod,
keyPair,
nsecBunkerPubkey,
nsecbunkerRelay,
...action.payload
}
}
@ -48,15 +47,6 @@ const reducer = (
}
}
case ActionTypes.UPDATE_NSECBUNKER_RELAY: {
const { payload } = action
return {
...state,
nsecbunkerRelay: payload
}
}
default:
return state
}

View File

@ -18,7 +18,6 @@ export interface AuthState {
loginMethod?: LoginMethods
keyPair?: Keys
nsecBunkerPubkey?: string
nsecbunkerRelay?: string
}
export interface SetAuthState {
@ -41,14 +40,8 @@ export interface UpdateNsecBunkerPubkey {
payload: string | undefined
}
export interface UpdateNsecbunkerRelay {
type: typeof ActionTypes.UPDATE_NSECBUNKER_RELAY
payload: string | undefined
}
export type AuthDispatchTypes =
| SetAuthState
| UpdateLoginMethod
| UpdateKeyPair
| UpdateNsecBunkerPubkey
| UpdateNsecbunkerRelay