refactor: pass meta to UserDetails instead of individual props

This commit is contained in:
enes 2024-08-14 14:44:11 +02:00
parent d8adb2c744
commit 1c3d3ca88f
2 changed files with 20 additions and 50 deletions

View File

@ -10,7 +10,7 @@ import {
SignStatus SignStatus
} from '../../utils' } from '../../utils'
import { UserAvatar } from '../UserAvatar' import { UserAvatar } from '../UserAvatar'
import { FlatMeta } from '../../hooks/useSigitMeta' import { useSigitMeta } from '../../hooks/useSigitMeta'
import { UserAvatarGroup } from '../UserAvatarGroup' import { UserAvatarGroup } from '../UserAvatarGroup'
import styles from './style.module.scss' import styles from './style.module.scss'
@ -28,31 +28,24 @@ import { useSelector } from 'react-redux'
import { State } from '../../store/rootReducer' import { State } from '../../store/rootReducer'
import { TooltipChild } from '../TooltipChild' import { TooltipChild } from '../TooltipChild'
import { DisplaySigner } from '../DisplaySigner' import { DisplaySigner } from '../DisplaySigner'
import { Meta } from '../../types'
type UsersDetailsProps = Pick< interface UsersDetailsProps {
FlatMeta, meta: Meta
| 'submittedBy' }
| 'signers'
| 'viewers'
| 'fileHashes'
| 'parsedSignatureEvents'
| 'createdAt'
| 'signedStatus'
| 'completedAt'
| 'signersStatus'
>
export const UsersDetails = ({ export const UsersDetails = ({ meta }: UsersDetailsProps) => {
submittedBy, const {
signers, submittedBy,
viewers, signers,
fileHashes, viewers,
parsedSignatureEvents, fileHashes,
createdAt, signersStatus,
signedStatus, createdAt,
completedAt, completedAt,
signersStatus parsedSignatureEvents,
}: UsersDetailsProps) => { signedStatus
} = useSigitMeta(meta)
const { usersPubkey } = useSelector((state: State) => state.auth) const { usersPubkey } = useSelector((state: State) => state.auth)
const profiles = useSigitProfiles([ const profiles = useSigitProfiles([
...(submittedBy ? [submittedBy] : []), ...(submittedBy ? [submittedBy] : []),

View File

@ -54,19 +54,8 @@ export const VerifyPage = () => {
*/ */
const { uploadedZip, meta } = location.state || {} const { uploadedZip, meta } = location.state || {}
const { const { submittedBy, zipUrl, encryptionKey, signers, viewers, fileHashes } =
submittedBy, useSigitMeta(meta)
zipUrl,
encryptionKey,
signers,
viewers,
fileHashes,
parsedSignatureEvents,
createdAt,
signedStatus,
completedAt,
signersStatus
} = useSigitMeta(meta)
const profiles = useSigitProfiles([ const profiles = useSigitProfiles([
...(submittedBy ? [submittedBy] : []), ...(submittedBy ? [submittedBy] : []),
@ -470,19 +459,7 @@ export const VerifyPage = () => {
</Box> </Box>
</> </>
} }
right={ right={<UsersDetails meta={meta} />}
<UsersDetails
submittedBy={submittedBy}
signers={signers}
viewers={viewers}
fileHashes={fileHashes}
parsedSignatureEvents={parsedSignatureEvents}
createdAt={createdAt}
signedStatus={signedStatus}
completedAt={completedAt}
signersStatus={signersStatus}
/>
}
/> />
)} )}
</Container> </Container>