staging to main #107
@ -61,8 +61,8 @@ export const CreatePage = () => {
|
|||||||
|
|
||||||
const [authUrl, setAuthUrl] = useState<string>()
|
const [authUrl, setAuthUrl] = useState<string>()
|
||||||
|
|
||||||
|
const [title, setTitle] = useState('')
|
||||||
const [selectedFiles, setSelectedFiles] = useState<File[]>([])
|
const [selectedFiles, setSelectedFiles] = useState<File[]>([])
|
||||||
const [displayUserInput, setDisplayUserInput] = useState(false)
|
|
||||||
|
|
||||||
const [userInput, setUserInput] = useState('')
|
const [userInput, setUserInput] = useState('')
|
||||||
const [userRole, setUserRole] = useState<UserRole>(UserRole.signer)
|
const [userRole, setUserRole] = useState<UserRole>(UserRole.signer)
|
||||||
@ -204,7 +204,6 @@ export const CreatePage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSelectFiles = (files: File[]) => {
|
const handleSelectFiles = (files: File[]) => {
|
||||||
setDisplayUserInput(true)
|
|
||||||
setSelectedFiles((prev) => {
|
setSelectedFiles((prev) => {
|
||||||
const prevFileNames = prev.map((file) => file.name)
|
const prevFileNames = prev.map((file) => file.name)
|
||||||
|
|
||||||
@ -223,6 +222,11 @@ export const CreatePage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleCreate = async () => {
|
const handleCreate = async () => {
|
||||||
|
if (!title.trim()) {
|
||||||
|
toast.error('Title can not be empty')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
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.'
|
||||||
@ -290,6 +294,7 @@ export const CreatePage = () => {
|
|||||||
|
|
||||||
// create content for meta file
|
// create content for meta file
|
||||||
const meta: Meta = {
|
const meta: Meta = {
|
||||||
|
title,
|
||||||
createSignature: JSON.stringify(createSignature, null, 2),
|
createSignature: JSON.stringify(createSignature, null, 2),
|
||||||
docSignatures: {}
|
docSignatures: {}
|
||||||
}
|
}
|
||||||
@ -422,17 +427,23 @@ export const CreatePage = () => {
|
|||||||
<>
|
<>
|
||||||
{isLoading && <LoadingSpinner desc={loadingSpinnerDesc} />}
|
{isLoading && <LoadingSpinner desc={loadingSpinnerDesc} />}
|
||||||
<Box className={styles.container}>
|
<Box className={styles.container}>
|
||||||
<Typography component="label" variant="h6">
|
<TextField
|
||||||
Select files
|
label="Title"
|
||||||
</Typography>
|
value={title}
|
||||||
|
onChange={(e) => setTitle(e.target.value)}
|
||||||
|
variant="outlined"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Box>
|
||||||
<MuiFileInput
|
<MuiFileInput
|
||||||
|
fullWidth
|
||||||
multiple
|
multiple
|
||||||
placeholder="Choose Files"
|
placeholder="Choose Files"
|
||||||
value={selectedFiles}
|
value={selectedFiles}
|
||||||
onChange={(value) => handleSelectFiles(value)}
|
onChange={(value) => handleSelectFiles(value)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{selectedFiles.length > 0 && (
|
||||||
<ul>
|
<ul>
|
||||||
{selectedFiles.map((file, index) => (
|
{selectedFiles.map((file, index) => (
|
||||||
<li key={index}>
|
<li key={index}>
|
||||||
@ -443,12 +454,13 @@ export const CreatePage = () => {
|
|||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
|
||||||
{displayUserInput && (
|
|
||||||
<>
|
|
||||||
<Typography component="label" variant="h6">
|
<Typography component="label" variant="h6">
|
||||||
Add Counterparties
|
Add Counterparts
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<Box className={styles.inputBlock}>
|
||||||
<Box className={styles.inputBlock}>
|
<Box className={styles.inputBlock}>
|
||||||
<TextField
|
<TextField
|
||||||
label="nip05 / npub"
|
label="nip05 / npub"
|
||||||
@ -481,6 +493,7 @@ export const CreatePage = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
<DisplayUser
|
<DisplayUser
|
||||||
users={users}
|
users={users}
|
||||||
handleUserRoleChange={handleUserRoleChange}
|
handleUserRoleChange={handleUserRoleChange}
|
||||||
@ -492,8 +505,6 @@ export const CreatePage = () => {
|
|||||||
Create
|
Create
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
<CopyModal
|
<CopyModal
|
||||||
open={openCopyModal}
|
open={openCopyModal}
|
||||||
|
@ -4,12 +4,13 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
color: $text-color;
|
color: $text-color;
|
||||||
|
margin-top: 10px;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
.inputBlock {
|
.inputBlock {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 25px;
|
gap: 25px;
|
||||||
margin-top: 10px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ export interface User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Meta {
|
export interface Meta {
|
||||||
|
title: string
|
||||||
createSignature: string
|
createSignature: string
|
||||||
docSignatures: { [key: `npub1${string}`]: string }
|
docSignatures: { [key: `npub1${string}`]: string }
|
||||||
exportSignature?: string
|
exportSignature?: string
|
||||||
|
Loading…
Reference in New Issue
Block a user