diff --git a/src/pages/sign/index.tsx b/src/pages/create/index.tsx
similarity index 94%
rename from src/pages/sign/index.tsx
rename to src/pages/create/index.tsx
index 3cd6de1..5977d9c 100644
--- a/src/pages/sign/index.tsx
+++ b/src/pages/create/index.tsx
@@ -20,11 +20,11 @@ import {
} from '@mui/material'
import { MuiFileInput } from 'mui-file-input'
import { useEffect, useState } from 'react'
-import { Link } from 'react-router-dom'
+import { Link, useNavigate } from 'react-router-dom'
import placeholderAvatar from '../../assets/images/nostr-logo.jpg'
import { LoadingSpinner } from '../../components/LoadingSpinner'
import { MetadataController, NostrController } from '../../controllers'
-import { getProfileRoute } from '../../routes'
+import { appPrivateRoutes, getProfileRoute } from '../../routes'
import { ProfileMetadata, User, UserRole } from '../../types'
import {
encryptArrayBuffer,
@@ -44,7 +44,8 @@ import JSZip from 'jszip'
import { useSelector } from 'react-redux'
import { State } from '../../store/rootReducer'
-export const SignPage = () => {
+export const CreatePage = () => {
+ const navigate = useNavigate()
const [isLoading, setIsLoading] = useState(false)
const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('')
@@ -63,6 +64,22 @@ export const SignPage = () => {
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)
@@ -89,8 +106,6 @@ export const SignPage = () => {
return updatedUsers
})
-
- setUserInput('')
}
if (userInput.startsWith('npub')) {
@@ -168,7 +183,7 @@ export const SignPage = () => {
)
}
- const handleSign = async () => {
+ const handleCreate = async () => {
if (users.length === 0) {
toast.error(
'No signer/viewer is provided. At least add one signer or viewer.'
@@ -329,8 +344,13 @@ export const SignPage = () => {
)
}
}
-
setIsLoading(false)
+
+ navigate(
+ `${appPrivateRoutes.verify}?file=${encodeURIComponent(
+ fileUrl
+ )}&key=${encodeURIComponent(encryptionKey)}`
+ )
}
if (authUrl) {
@@ -413,8 +433,8 @@ export const SignPage = () => {
handleRemoveUser={handleRemoveUser}
/>
-
>
diff --git a/src/pages/sign/style.module.scss b/src/pages/create/style.module.scss
similarity index 100%
rename from src/pages/sign/style.module.scss
rename to src/pages/create/style.module.scss
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 93d01e8..01ee591 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -9,10 +9,10 @@ export const HomePage = () => {
return (
navigate(appPrivateRoutes.sign)}
+ onClick={() => navigate(appPrivateRoutes.create)}
variant="contained"
>
- Sign
+ Create
navigate(appPrivateRoutes.verify)}
diff --git a/src/routes/index.tsx b/src/routes/index.tsx
index c7e8757..dbbf728 100644
--- a/src/routes/index.tsx
+++ b/src/routes/index.tsx
@@ -1,5 +1,5 @@
import { HomePage } from '../pages/home'
-import { SignPage } from '../pages/sign'
+import { CreatePage } from '../pages/create'
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: '/',
- sign: '/sign',
+ create: '/create',
verify: '/verify'
}
@@ -45,8 +45,8 @@ export const privateRoutes = [
element:
},
{
- path: appPrivateRoutes.sign,
- element:
+ path: appPrivateRoutes.create,
+ element:
},
{
path: appPrivateRoutes.verify,