From b5761ac86b35f94aa7a06b0a254564cd47f5443e Mon Sep 17 00:00:00 2001 From: SwiftHawk Date: Wed, 15 May 2024 16:11:57 +0500 Subject: [PATCH] chore: convert verify to sign --- src/pages/create/index.tsx | 15 ++++++--------- src/pages/home/index.tsx | 4 ++-- src/pages/{verify => sign}/index.tsx | 2 +- src/pages/{verify => sign}/style.module.scss | 0 src/routes/index.tsx | 13 +++++++------ src/utils/misc.ts | 2 +- 6 files changed, 17 insertions(+), 19 deletions(-) rename src/pages/{verify => sign}/index.tsx (99%) rename src/pages/{verify => sign}/style.module.scss (100%) diff --git a/src/pages/create/index.tsx b/src/pages/create/index.tsx index 2847c76..c308026 100644 --- a/src/pages/create/index.tsx +++ b/src/pages/create/index.tsx @@ -20,10 +20,10 @@ import { } from '@mui/material' import { MuiFileInput } from 'mui-file-input' import { useEffect, useState } from 'react' -import { Link, useNavigate } from 'react-router-dom' +import { Link } from 'react-router-dom' import { LoadingSpinner } from '../../components/LoadingSpinner' import { MetadataController, NostrController } from '../../controllers' -import { appPrivateRoutes, getProfileRoute } from '../../routes' +import { getProfileRoute } from '../../routes' import { ProfileMetadata, User, UserRole } from '../../types' import { encryptArrayBuffer, @@ -45,7 +45,6 @@ import { useSelector } from 'react-redux' import { State } from '../../store/rootReducer' export const CreatePage = () => { - const navigate = useNavigate() const [isLoading, setIsLoading] = useState(false) const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('') @@ -350,11 +349,7 @@ export const CreatePage = () => { } setIsLoading(false) - navigate( - `${appPrivateRoutes.verify}?file=${encodeURIComponent( - fileUrl - )}&key=${encodeURIComponent(encryptionKey)}` - ) + // todo: navigate to verify } if (authUrl) { @@ -513,7 +508,9 @@ const DisplayUser = ({ {imageLoadError(event, user.pubkey)}} + onError={(event) => { + imageLoadError(event, user.pubkey) + }} src={userMeta?.picture || roboUrl} alt="Profile Image" className="profile-image" diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index 01ee591..1b46e58 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -15,10 +15,10 @@ export const HomePage = () => { Create ) diff --git a/src/pages/verify/index.tsx b/src/pages/sign/index.tsx similarity index 99% rename from src/pages/verify/index.tsx rename to src/pages/sign/index.tsx index 09133e8..632a885 100644 --- a/src/pages/verify/index.tsx +++ b/src/pages/sign/index.tsx @@ -50,7 +50,7 @@ enum SignedStatus { User_Is_Not_Next_Signer } -export const VerifyPage = () => { +export const SignPage = () => { const [searchParams] = useSearchParams() const [displayInput, setDisplayInput] = useState(false) diff --git a/src/pages/verify/style.module.scss b/src/pages/sign/style.module.scss similarity index 100% rename from src/pages/verify/style.module.scss rename to src/pages/sign/style.module.scss diff --git a/src/routes/index.tsx b/src/routes/index.tsx index c764f98..a7bab3d 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -4,14 +4,15 @@ import { LandingPage } from '../pages/landing/LandingPage' import { Login } from '../pages/login' import { ProfilePage } from '../pages/profile' import { hexToNpub } from '../utils' -import { VerifyPage } from '../pages/verify' import { RelaysPage } from '../pages/relays' +import { SignPage } from '../pages/sign' export const appPrivateRoutes = { homePage: '/', create: '/create', verify: '/verify', - relays: '/relays' + relays: '/relays', + sign: '/sign' } export const appPublicRoutes = { @@ -50,12 +51,12 @@ export const privateRoutes = [ path: appPrivateRoutes.create, element: }, - { - path: appPrivateRoutes.verify, - element: - }, { path: appPrivateRoutes.relays, element: + }, + { + path: appPrivateRoutes.sign, + element: } ] diff --git a/src/utils/misc.ts b/src/utils/misc.ts index 9a4158c..0b9f994 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -76,7 +76,7 @@ export const sendDM = async ( : 'You have received a signed document.' const decryptionUrl = `${window.location.origin}/#${ - appPrivateRoutes.verify + appPrivateRoutes.sign }?file=${encodeURIComponent(fileUrl)}&key=${encodeURIComponent( encryptionKey )}`