Compare commits

..

No commits in common. "202a18f73d912f104bb698a3f6f4b01b7cd6cc22" and "819902eafbd1a0af0ae5880440abd3e2f9fa8f87" have entirely different histories.

4 changed files with 15 additions and 35 deletions

View File

@ -9,10 +9,10 @@ export const HomePage = () => {
return ( return (
<Box className={styles.container}> <Box className={styles.container}>
<Button <Button
onClick={() => navigate(appPrivateRoutes.create)} onClick={() => navigate(appPrivateRoutes.sign)}
variant="contained" variant="contained"
> >
Create Sign
</Button> </Button>
<Button <Button
onClick={() => navigate(appPrivateRoutes.verify)} onClick={() => navigate(appPrivateRoutes.verify)}

View File

@ -20,11 +20,11 @@ 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 placeholderAvatar from '../../assets/images/nostr-logo.jpg' import placeholderAvatar from '../../assets/images/nostr-logo.jpg'
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,
@ -44,8 +44,7 @@ import JSZip from 'jszip'
import { useSelector } from 'react-redux' import { useSelector } from 'react-redux'
import { State } from '../../store/rootReducer' import { State } from '../../store/rootReducer'
export const CreatePage = () => { export const SignPage = () => {
const navigate = useNavigate()
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('') const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('')
@ -64,22 +63,6 @@ export const CreatePage = () => {
const nostrController = NostrController.getInstance() const nostrController = NostrController.getInstance()
useEffect(() => {
if (usersPubkey) {
setUsers((prev) => {
const existingUserIndex = prev.findIndex(
(user) => user.pubkey === usersPubkey
)
// make logged in user the first signer by default
if (existingUserIndex === -1)
return [{ pubkey: usersPubkey, role: UserRole.signer }, ...prev]
return prev
})
}
}, [usersPubkey])
const handleAddUser = async () => { const handleAddUser = async () => {
setError(undefined) setError(undefined)
@ -106,6 +89,8 @@ export const CreatePage = () => {
return updatedUsers return updatedUsers
}) })
setUserInput('')
} }
if (userInput.startsWith('npub')) { if (userInput.startsWith('npub')) {
@ -183,7 +168,7 @@ export const CreatePage = () => {
) )
} }
const handleCreate = async () => { const handleSign = async () => {
if (users.length === 0) { if (users.length === 0) {
toast.error( toast.error(
'No signer/viewer is provided. At least add one signer or viewer.' 'No signer/viewer is provided. At least add one signer or viewer.'
@ -344,13 +329,8 @@ export const CreatePage = () => {
) )
} }
} }
setIsLoading(false)
navigate( setIsLoading(false)
`${appPrivateRoutes.verify}?file=${encodeURIComponent(
fileUrl
)}&key=${encodeURIComponent(encryptionKey)}`
)
} }
if (authUrl) { if (authUrl) {
@ -433,8 +413,8 @@ export const CreatePage = () => {
handleRemoveUser={handleRemoveUser} handleRemoveUser={handleRemoveUser}
/> />
<Box sx={{ mt: 1, display: 'flex', justifyContent: 'center' }}> <Box sx={{ mt: 1, display: 'flex', justifyContent: 'center' }}>
<Button onClick={handleCreate} variant="contained"> <Button onClick={handleSign} variant="contained">
Create Sign
</Button> </Button>
</Box> </Box>
</> </>

View File

@ -1,5 +1,5 @@
import { HomePage } from '../pages/home' import { HomePage } from '../pages/home'
import { CreatePage } from '../pages/create' import { SignPage } from '../pages/sign'
import { LandingPage } from '../pages/landing/LandingPage' 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'
@ -8,7 +8,7 @@ import { VerifyPage } from '../pages/verify'
export const appPrivateRoutes = { export const appPrivateRoutes = {
homePage: '/', homePage: '/',
create: '/create', sign: '/sign',
verify: '/verify' verify: '/verify'
} }
@ -45,8 +45,8 @@ export const privateRoutes = [
element: <HomePage /> element: <HomePage />
}, },
{ {
path: appPrivateRoutes.create, path: appPrivateRoutes.sign,
element: <CreatePage /> element: <SignPage />
}, },
{ {
path: appPrivateRoutes.verify, path: appPrivateRoutes.verify,