release #111
@ -60,6 +60,23 @@ import {
|
||||
import styles from './style.module.scss'
|
||||
import { appPrivateRoutes } from '../../routes'
|
||||
|
||||
/**
|
||||
* Helper function to get the current timestamp in YYMMDD:HHMMSS format
|
||||
*/
|
||||
const getFormattedTimestamp = () => {
|
||||
const now = new Date()
|
||||
const padZero = (num: number) => (num < 10 ? '0' + num : num)
|
||||
|
||||
const year = now.getFullYear()
|
||||
const month = padZero(now.getMonth() + 1) // Months are zero-indexed
|
||||
const day = padZero(now.getDate())
|
||||
const hours = padZero(now.getHours())
|
||||
const minutes = padZero(now.getMinutes())
|
||||
const seconds = padZero(now.getSeconds())
|
||||
|
||||
return `${year}-${month}-${day}_${hours}:${minutes}:${seconds}`
|
||||
}
|
||||
|
||||
export const CreatePage = () => {
|
||||
const navigate = useNavigate()
|
||||
const location = useLocation()
|
||||
@ -70,7 +87,7 @@ export const CreatePage = () => {
|
||||
|
||||
const [authUrl, setAuthUrl] = useState<string>()
|
||||
|
||||
const [title, setTitle] = useState('')
|
||||
const [title, setTitle] = useState(`sigit_${getFormattedTimestamp()}`)
|
||||
const [selectedFiles, setSelectedFiles] = useState<File[]>([])
|
||||
|
||||
const [userInput, setUserInput] = useState('')
|
||||
@ -454,19 +471,19 @@ export const CreatePage = () => {
|
||||
|
||||
setLoadingSpinnerDesc('Signing nostr event for create signature')
|
||||
|
||||
try {
|
||||
const createSignature = await signEventForMetaFile(
|
||||
JSON.stringify(content),
|
||||
nostrController,
|
||||
setIsLoading
|
||||
)
|
||||
).catch(() => {
|
||||
console.log('An error occurred in signing event for meta file', error)
|
||||
toast.error('An error occurred in signing event for meta file')
|
||||
return null
|
||||
})
|
||||
|
||||
if (!createSignature) return null
|
||||
|
||||
return JSON.stringify(createSignature, null, 2)
|
||||
} catch (error) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// Send notifications to signers and viewers
|
||||
@ -580,7 +597,10 @@ export const CreatePage = () => {
|
||||
|
||||
setLoadingSpinnerDesc('Generating create signature')
|
||||
const createSignature = await generateCreateSignature(fileHashes, '')
|
||||
if (!createSignature) return
|
||||
if (!createSignature) {
|
||||
setIsLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
const meta: Meta = {
|
||||
createSignature,
|
||||
|
Loading…
Reference in New Issue
Block a user