issue-274 #278

Open
m wants to merge 14 commits from issue-274 into staging
2 changed files with 17 additions and 5 deletions
Showing only changes of commit c0fc469fee - Show all commits

View File

@ -1,5 +1,10 @@
import { Meta } from '../../types' import { Meta } from '../../types'
import { SigitCardDisplayInfo, SigitStatus, SignStatus } from '../../utils' import {
hexToNpub,
SigitCardDisplayInfo,
SigitStatus,
SignStatus
} from '../../utils'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { formatTimestamp, npubToHex } from '../../utils' import { formatTimestamp, npubToHex } from '../../utils'
import { appPublicRoutes, appPrivateRoutes } from '../../routes' import { appPublicRoutes, appPrivateRoutes } from '../../routes'
@ -20,6 +25,7 @@ import styles from './style.module.scss'
import { getExtensionIconLabel } from '../getExtensionIconLabel' import { getExtensionIconLabel } from '../getExtensionIconLabel'
import { useSigitMeta } from '../../hooks/useSigitMeta' import { useSigitMeta } from '../../hooks/useSigitMeta'
import { extractFileExtensions } from '../../utils/file' import { extractFileExtensions } from '../../utils/file'
import { useAppSelector } from '../../hooks'
type SigitProps = { type SigitProps = {
sigitCreateId: string sigitCreateId: string
@ -32,26 +38,32 @@ export const DisplaySigit = ({
parsedMeta, parsedMeta,
sigitCreateId: sigitCreateId sigitCreateId: sigitCreateId
}: SigitProps) => { }: SigitProps) => {
const { usersPubkey } = useAppSelector((state) => state.auth)
const { title, createdAt, submittedBy, signers, signedStatus, isValid } = const { title, createdAt, submittedBy, signers, signedStatus, isValid } =
parsedMeta parsedMeta
const { signersStatus, fileHashes } = useSigitMeta(meta) const { signersStatus, fileHashes } = useSigitMeta(meta)
const { extensions, isSame } = extractFileExtensions(Object.keys(fileHashes)) const { extensions, isSame } = extractFileExtensions(Object.keys(fileHashes))
const currentUserNpub: string = usersPubkey ? hexToNpub(usersPubkey) : ''
const currentUserSigned =
signersStatus[currentUserNpub as `npub1${string}`] === SignStatus.Signed
return ( return (
<div className={styles.itemWrapper}> <div className={styles.itemWrapper}>
{signedStatus === SigitStatus.Complete && ( {signedStatus === SigitStatus.Complete || currentUserSigned ? (
<Link <Link
to={`${appPublicRoutes.verify}/${sigitCreateId}`} to={`${appPublicRoutes.verify}/${sigitCreateId}`}
className={styles.insetLink} className={styles.insetLink}
></Link> ></Link>
)} ) : (
{signedStatus !== SigitStatus.Complete && (
<Link <Link
to={`${appPrivateRoutes.sign}/${sigitCreateId}`} to={`${appPrivateRoutes.sign}/${sigitCreateId}`}
className={styles.insetLink} className={styles.insetLink}
></Link> ></Link>
)} )}
<p className={`line-clamp-2 ${styles.title}`}>{title}</p> <p className={`line-clamp-2 ${styles.title}`}>{title}</p>
<div className={styles.users}> <div className={styles.users}>
{submittedBy && ( {submittedBy && (

View File

@ -652,7 +652,7 @@ export const SignPage = () => {
return return
} }
let metaUrl: string | undefined let metaUrl: string
try { try {
metaUrl = await uploadMetaToFileStorage(meta, encryptionKey) metaUrl = await uploadMetaToFileStorage(meta, encryptionKey)
} catch (error) { } catch (error) {