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 (
<Box className={styles.container}>
<Button
onClick={() => navigate(appPrivateRoutes.create)}
onClick={() => navigate(appPrivateRoutes.sign)}
variant="contained"
>
Create
Sign
</Button>
<Button
onClick={() => navigate(appPrivateRoutes.verify)}

View File

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

View File

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