release #111

Merged
b merged 39 commits from staging into main 2024-07-11 13:42:05 +00:00
Showing only changes of commit ef5376e2d1 - Show all commits

View File

@ -60,6 +60,23 @@ import {
import styles from './style.module.scss' import styles from './style.module.scss'
import { appPrivateRoutes } from '../../routes' 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 = () => { export const CreatePage = () => {
const navigate = useNavigate() const navigate = useNavigate()
const location = useLocation() const location = useLocation()
@ -70,7 +87,7 @@ export const CreatePage = () => {
const [authUrl, setAuthUrl] = useState<string>() const [authUrl, setAuthUrl] = useState<string>()
const [title, setTitle] = useState('') const [title, setTitle] = useState(`sigit_${getFormattedTimestamp()}`)
const [selectedFiles, setSelectedFiles] = useState<File[]>([]) const [selectedFiles, setSelectedFiles] = useState<File[]>([])
const [userInput, setUserInput] = useState('') const [userInput, setUserInput] = useState('')
@ -454,19 +471,19 @@ export const CreatePage = () => {
setLoadingSpinnerDesc('Signing nostr event for create signature') setLoadingSpinnerDesc('Signing nostr event for create signature')
try { const createSignature = await signEventForMetaFile(
const createSignature = await signEventForMetaFile( JSON.stringify(content),
JSON.stringify(content), nostrController,
nostrController, setIsLoading
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')
if (!createSignature) return null
return JSON.stringify(createSignature, null, 2)
} catch (error) {
return null return null
} })
if (!createSignature) return null
return JSON.stringify(createSignature, null, 2)
} }
// Send notifications to signers and viewers // Send notifications to signers and viewers
@ -580,7 +597,10 @@ export const CreatePage = () => {
setLoadingSpinnerDesc('Generating create signature') setLoadingSpinnerDesc('Generating create signature')
const createSignature = await generateCreateSignature(fileHashes, '') const createSignature = await generateCreateSignature(fileHashes, '')
if (!createSignature) return if (!createSignature) {
setIsLoading(false)
return
}
const meta: Meta = { const meta: Meta = {
createSignature, createSignature,