fix: when opening a sigit after user signed it, asks user to sign again instead of redirecting to /verify
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 40s
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 40s
This commit is contained in:
parent
9882393b7a
commit
ccb4036029
@ -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 && (
|
||||||
|
Loading…
Reference in New Issue
Block a user