fix(home-page): sigit file type display now correctly shows multiple file types
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
ae08b07d74
commit
acc8c84617
@ -10,7 +10,8 @@ import {
|
|||||||
faCalendar,
|
faCalendar,
|
||||||
faCopy,
|
faCopy,
|
||||||
faEye,
|
faEye,
|
||||||
faFile
|
faFile,
|
||||||
|
faFileCircleExclamation
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||||
import { UserAvatarGroup } from '../UserAvatarGroup'
|
import { UserAvatarGroup } from '../UserAvatarGroup'
|
||||||
@ -20,6 +21,7 @@ import { TooltipChild } from '../TooltipChild'
|
|||||||
import { getExtensionIconLabel } from '../getExtensionIconLabel'
|
import { getExtensionIconLabel } from '../getExtensionIconLabel'
|
||||||
import { useSigitProfiles } from '../../hooks/useSigitProfiles'
|
import { useSigitProfiles } from '../../hooks/useSigitProfiles'
|
||||||
import { useSigitMeta } from '../../hooks/useSigitMeta'
|
import { useSigitMeta } from '../../hooks/useSigitMeta'
|
||||||
|
import { extractFileExtensions } from '../../utils/file'
|
||||||
|
|
||||||
type SigitProps = {
|
type SigitProps = {
|
||||||
meta: Meta
|
meta: Meta
|
||||||
@ -27,23 +29,18 @@ type SigitProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const DisplaySigit = ({ meta, parsedMeta }: SigitProps) => {
|
export const DisplaySigit = ({ meta, parsedMeta }: SigitProps) => {
|
||||||
const {
|
const { title, createdAt, submittedBy, signers, signedStatus, isValid } =
|
||||||
title,
|
parsedMeta
|
||||||
createdAt,
|
|
||||||
submittedBy,
|
|
||||||
signers,
|
|
||||||
signedStatus,
|
|
||||||
fileExtensions,
|
|
||||||
isValid
|
|
||||||
} = parsedMeta
|
|
||||||
|
|
||||||
const { signersStatus } = useSigitMeta(meta)
|
const { signersStatus, fileHashes } = useSigitMeta(meta)
|
||||||
|
|
||||||
const profiles = useSigitProfiles([
|
const profiles = useSigitProfiles([
|
||||||
...(submittedBy ? [submittedBy] : []),
|
...(submittedBy ? [submittedBy] : []),
|
||||||
...signers
|
...signers
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const { extensions, isSame } = extractFileExtensions(Object.keys(fileHashes))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.itemWrapper}>
|
<div className={styles.itemWrapper}>
|
||||||
<Link
|
<Link
|
||||||
@ -120,17 +117,21 @@ export const DisplaySigit = ({ meta, parsedMeta }: SigitProps) => {
|
|||||||
<span className={styles.iconLabel}>
|
<span className={styles.iconLabel}>
|
||||||
<FontAwesomeIcon icon={faEye} /> {signedStatus}
|
<FontAwesomeIcon icon={faEye} /> {signedStatus}
|
||||||
</span>
|
</span>
|
||||||
{fileExtensions.length > 0 ? (
|
{extensions.length > 0 ? (
|
||||||
<span className={styles.iconLabel}>
|
<span className={styles.iconLabel}>
|
||||||
{fileExtensions.length > 1 ? (
|
{!isSame ? (
|
||||||
<>
|
<>
|
||||||
<FontAwesomeIcon icon={faFile} /> Multiple File Types
|
<FontAwesomeIcon icon={faFile} /> Multiple File Types
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
getExtensionIconLabel(fileExtensions[0])
|
getExtensionIconLabel(extensions[0])
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : (
|
||||||
|
<>
|
||||||
|
<FontAwesomeIcon icon={faFileCircleExclamation} /> —
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.itemActions}>
|
<div className={styles.itemActions}>
|
||||||
<Tooltip title="Duplicate" arrow placement="top" disableInteractive>
|
<Tooltip title="Duplicate" arrow placement="top" disableInteractive>
|
||||||
|
Loading…
Reference in New Issue
Block a user