From a70d02b4ea543561437576b95113aa07c1bde9ce Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Mon, 25 Mar 2024 10:30:01 +0500 Subject: [PATCH] chore: revert changes related to displaying nsecbunker connection string --- src/components/AppBar/AppBar.tsx | 22 ++------ src/pages/login/index.tsx | 9 ++-- src/pages/nsecbunker/index.tsx | 69 -------------------------- src/pages/nsecbunker/style.module.scss | 7 --- src/routes/index.tsx | 8 +-- src/store/actionTypes.ts | 1 - src/store/auth/action.ts | 10 +--- src/store/auth/reducer.ts | 12 +---- src/store/auth/types.ts | 7 --- 9 files changed, 9 insertions(+), 136 deletions(-) delete mode 100644 src/pages/nsecbunker/index.tsx delete mode 100644 src/pages/nsecbunker/style.module.scss diff --git a/src/components/AppBar/AppBar.tsx b/src/components/AppBar/AppBar.tsx index 4fe3383..8494716 100644 --- a/src/components/AppBar/AppBar.tsx +++ b/src/components/AppBar/AppBar.tsx @@ -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 - {authState.loginMethod === LoginMethods.nsecBunker && ( - navigate(appPrivateRoutes.nsecbunker)} - sx={{ - justifyContent: 'center' - }} - > - Nsecbunker - - )} { 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') diff --git a/src/pages/nsecbunker/index.tsx b/src/pages/nsecbunker/index.tsx deleted file mode 100644 index 8a145f3..0000000 --- a/src/pages/nsecbunker/index.tsx +++ /dev/null @@ -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 ( - - Nsecbunker Setting - - } - > - - - { - navigator.clipboard.writeText(nsecbunkerConnectionString) - toast.success('Copied to clipboard', { - autoClose: 1000, - hideProgressBar: true - }) - }} - > - - - - ) - }} - /> - - - ) -} diff --git a/src/pages/nsecbunker/style.module.scss b/src/pages/nsecbunker/style.module.scss deleted file mode 100644 index 0adf9ba..0000000 --- a/src/pages/nsecbunker/style.module.scss +++ /dev/null @@ -1,7 +0,0 @@ -.textField { - width: 100%; -} - -.subHeader { - border-bottom: 0.5px solid; -} diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 196efeb..ac945aa 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -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: - }, - { - path: appPrivateRoutes.nsecbunker, - element: } ] diff --git a/src/store/actionTypes.ts b/src/store/actionTypes.ts index 233d73c..f1d649f 100644 --- a/src/store/actionTypes.ts +++ b/src/store/actionTypes.ts @@ -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' diff --git a/src/store/auth/action.ts b/src/store/auth/action.ts index ce37944..ac9e39d 100644 --- a/src/store/auth/action.ts +++ b/src/store/auth/action.ts @@ -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 -}) diff --git a/src/store/auth/reducer.ts b/src/store/auth/reducer.ts index a67488f..e384076 100644 --- a/src/store/auth/reducer.ts +++ b/src/store/auth/reducer.ts @@ -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 } diff --git a/src/store/auth/types.ts b/src/store/auth/types.ts index fbecf09..41e76be 100644 --- a/src/store/auth/types.ts +++ b/src/store/auth/types.ts @@ -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