chore: convert verify to sign

This commit is contained in:
SwiftHawk 2024-05-15 16:11:57 +05:00 committed by Yury
parent 150e7a447c
commit b5761ac86b
6 changed files with 17 additions and 19 deletions

View File

@ -20,10 +20,10 @@ import {
} from '@mui/material' } from '@mui/material'
import { MuiFileInput } from 'mui-file-input' import { MuiFileInput } from 'mui-file-input'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { Link, useNavigate } from 'react-router-dom' import { Link } from 'react-router-dom'
import { LoadingSpinner } from '../../components/LoadingSpinner' import { LoadingSpinner } from '../../components/LoadingSpinner'
import { MetadataController, NostrController } from '../../controllers' import { MetadataController, NostrController } from '../../controllers'
import { appPrivateRoutes, getProfileRoute } from '../../routes' import { getProfileRoute } from '../../routes'
import { ProfileMetadata, User, UserRole } from '../../types' import { ProfileMetadata, User, UserRole } from '../../types'
import { import {
encryptArrayBuffer, encryptArrayBuffer,
@ -45,7 +45,6 @@ import { useSelector } from 'react-redux'
import { State } from '../../store/rootReducer' import { State } from '../../store/rootReducer'
export const CreatePage = () => { export const CreatePage = () => {
const navigate = useNavigate()
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('') const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('')
@ -350,11 +349,7 @@ export const CreatePage = () => {
} }
setIsLoading(false) setIsLoading(false)
navigate( // todo: navigate to verify
`${appPrivateRoutes.verify}?file=${encodeURIComponent(
fileUrl
)}&key=${encodeURIComponent(encryptionKey)}`
)
} }
if (authUrl) { if (authUrl) {
@ -513,7 +508,9 @@ const DisplayUser = ({
<TableCell className={styles.tableCell}> <TableCell className={styles.tableCell}>
<Box className={styles.user}> <Box className={styles.user}>
<img <img
onError={(event) => {imageLoadError(event, user.pubkey)}} onError={(event) => {
imageLoadError(event, user.pubkey)
}}
src={userMeta?.picture || roboUrl} src={userMeta?.picture || roboUrl}
alt="Profile Image" alt="Profile Image"
className="profile-image" className="profile-image"

View File

@ -15,10 +15,10 @@ export const HomePage = () => {
Create Create
</Button> </Button>
<Button <Button
onClick={() => navigate(appPrivateRoutes.verify)} onClick={() => navigate(appPrivateRoutes.sign)}
variant="contained" variant="contained"
> >
Verify Sign
</Button> </Button>
</Box> </Box>
) )

View File

@ -50,7 +50,7 @@ enum SignedStatus {
User_Is_Not_Next_Signer User_Is_Not_Next_Signer
} }
export const VerifyPage = () => { export const SignPage = () => {
const [searchParams] = useSearchParams() const [searchParams] = useSearchParams()
const [displayInput, setDisplayInput] = useState(false) const [displayInput, setDisplayInput] = useState(false)

View File

@ -4,14 +4,15 @@ import { LandingPage } from '../pages/landing/LandingPage'
import { Login } from '../pages/login' import { Login } from '../pages/login'
import { ProfilePage } from '../pages/profile' import { ProfilePage } from '../pages/profile'
import { hexToNpub } from '../utils' import { hexToNpub } from '../utils'
import { VerifyPage } from '../pages/verify'
import { RelaysPage } from '../pages/relays' import { RelaysPage } from '../pages/relays'
import { SignPage } from '../pages/sign'
export const appPrivateRoutes = { export const appPrivateRoutes = {
homePage: '/', homePage: '/',
create: '/create', create: '/create',
verify: '/verify', verify: '/verify',
relays: '/relays' relays: '/relays',
sign: '/sign'
} }
export const appPublicRoutes = { export const appPublicRoutes = {
@ -50,12 +51,12 @@ export const privateRoutes = [
path: appPrivateRoutes.create, path: appPrivateRoutes.create,
element: <CreatePage /> element: <CreatePage />
}, },
{
path: appPrivateRoutes.verify,
element: <VerifyPage />
},
{ {
path: appPrivateRoutes.relays, path: appPrivateRoutes.relays,
element: <RelaysPage /> element: <RelaysPage />
},
{
path: appPrivateRoutes.sign,
element: <SignPage />
} }
] ]

View File

@ -76,7 +76,7 @@ export const sendDM = async (
: 'You have received a signed document.' : 'You have received a signed document.'
const decryptionUrl = `${window.location.origin}/#${ const decryptionUrl = `${window.location.origin}/#${
appPrivateRoutes.verify appPrivateRoutes.sign
}?file=${encodeURIComponent(fileUrl)}&key=${encodeURIComponent( }?file=${encodeURIComponent(fileUrl)}&key=${encodeURIComponent(
encryptionKey encryptionKey
)}` )}`