|
7 | 7 | } from '@heroicons/react/24/outline'; |
8 | 8 | import { Tooltip } from '@nextui-org/react'; |
9 | 9 | import type { VerifiableCredential } from '@veramo/core'; |
| 10 | +import type { Disclosure } from '@blockchain-lab-um/masca-connector'; |
10 | 11 | import clsx from 'clsx'; |
11 | 12 | import { isAddress } from 'ethers/address'; |
12 | 13 | import { useTranslations } from 'next-intl'; |
@@ -124,6 +125,7 @@ const CredentialSubject = ({ |
124 | 125 |
|
125 | 126 | const FormattedPanel = ({ credential }: FormattedPanelProps) => { |
126 | 127 | const t = useTranslations('FormattedPanel'); |
| 128 | + const tCredentialPanel = useTranslations('CredentialPanel'); |
127 | 129 | const types = useMemo(() => convertTypes(credential.type), [credential.type]); |
128 | 130 |
|
129 | 131 | const [jsonModalOpen, setJsonModalOpen] = useState(false); |
@@ -178,6 +180,38 @@ const FormattedPanel = ({ credential }: FormattedPanelProps) => { |
178 | 180 | viewJsonText={t('view-json')} |
179 | 181 | selectJsonData={selectJsonData} |
180 | 182 | /> |
| 183 | + {Array.isArray( |
| 184 | + (credential as unknown as { disclosures?: Disclosure[] }) |
| 185 | + .disclosures |
| 186 | + ) && |
| 187 | + ((credential as unknown as { disclosures?: Disclosure[] }) |
| 188 | + .disclosures?.length ?? 0) > 0 && ( |
| 189 | + <div className="mt-4 flex w-full flex-col items-start space-y-2"> |
| 190 | + <h2 className="text-md dark:text-orange-accent-dark font-medium text-pink-500"> |
| 191 | + {tCredentialPanel('disclosures')} |
| 192 | + </h2> |
| 193 | + {( |
| 194 | + (credential as unknown as { disclosures?: Disclosure[] }) |
| 195 | + .disclosures || [] |
| 196 | + ) |
| 197 | + .filter((d: Disclosure) => d.key !== 'id') |
| 198 | + .map((d: Disclosure) => ( |
| 199 | + <div |
| 200 | + key={`disclosure-${d.key}`} |
| 201 | + className="flex w-full overflow-clip flex-col items-start space-y-0.5" |
| 202 | + > |
| 203 | + <div className="flex items-center space-x-2 w-full"> |
| 204 | + <h2 className="dark:text-navy-blue-200 pr-2 font-bold capitalize text-gray-800"> |
| 205 | + {camelToTitleCase(d.key)}: |
| 206 | + </h2> |
| 207 | + <div className="text-md dark:text-navy-blue-300 truncate font-normal text-gray-700"> |
| 208 | + {d.value} |
| 209 | + </div> |
| 210 | + </div> |
| 211 | + </div> |
| 212 | + ))} |
| 213 | + </div> |
| 214 | + )} |
181 | 215 | </div> |
182 | 216 | <div className="flex flex-1"> |
183 | 217 | <div className="flex flex-col space-y-8"> |
|
0 commit comments