Skip to content

Commit f413c51

Browse files
authored
Merge pull request #207 from wwWallet/fix/status-ribbon-hide
'Expired Ribbon' Not Displaying as Expected in Credential Selection
2 parents 01bf38b + 0a9cbfb commit f413c51

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { useState, useEffect } from "react"
22
import { parseCredential } from "../../functions/parseCredential";
3+
import StatusRibbon from '../../components/Credentials/StatusRibbon';
34

45

5-
export const CredentialImage = ({ credential, className, onClick }) => {
6+
export const CredentialImage = ({ credential, className, onClick, showRibbon = true }) => {
67
const [parsedCredential, setParsedCredential] = useState(null);
78

89
useEffect(() => {
@@ -13,9 +14,14 @@ export const CredentialImage = ({ credential, className, onClick }) => {
1314

1415
return (
1516
<>
16-
{parsedCredential &&
17-
<img src={parsedCredential.credentialBranding.image.url} alt={"Credential"} className={className} onClick={onClick} />
18-
}
17+
{parsedCredential && (
18+
<>
19+
<img src={parsedCredential.credentialBranding.image.url} alt={"Credential"} className={className} onClick={onClick} />
20+
{showRibbon &&
21+
<StatusRibbon credential={credential} />
22+
}
23+
</>
24+
)}
1925
</>
2026
)
2127
}

src/components/Popups/SelectCredentials.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
22
import { useNavigate } from 'react-router-dom';
33
import { FaShare } from 'react-icons/fa';
44
import { useTranslation } from 'react-i18next';
5-
import StatusRibbon from '../../components/Credentials/StatusRibbon';
65
import { useApi } from '../../api';
76
import { CredentialImage } from '../Credentials/CredentialImage';
87

@@ -134,7 +133,6 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
134133
<div className="m-3 flex justify-center">
135134
<div className="relative rounded-xl w-2/3 overflow-hidden transition-shadow shadow-md hover:shadow-lg cursor-pointer">
136135
<CredentialImage key={image.credentialIdentifier} credential={image.credential} onClick={() => handleClick(image.credentialIdentifier)} className={"w-full object-cover rounded-xl"} />
137-
<StatusRibbon credential={image.credential} />
138136
</div>
139137
</div>
140138
))}

src/pages/History/History.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { useApi } from '../../api';
1010

1111
import CredentialInfo from '../../components/Credentials/CredentialInfo';
1212
import { formatDate } from '../../functions/DateFormat';
13-
import StatusRibbon from '../../components/Credentials/StatusRibbon';
1413
import { base64url } from 'jose';
1514
import { CredentialImage } from '../../components/Credentials/CredentialImage';
1615

@@ -132,7 +131,6 @@ const History = () => {
132131
<React.Fragment key={Math.random()}>
133132
<div className="relative rounded-xl xl:w-full md:w-full sm:w-full overflow-hidden transition-shadow shadow-md hover:shadow-lg cursor-pointer w-full">
134133
<CredentialImage credential={credential} className={"w-full object-cover rounded-xl"} />
135-
<StatusRibbon credential={credential} />
136134
</div>
137135
<div className="flex items-center justify-end mt-2 mr-3">
138136
<span className="mr-4">{currentSlide} of {matchingCredentials.length}</span>

src/pages/Home/CredentialDetail.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import CredentialJson from '../../components/Credentials/CredentialJson';
1313
import CredentialDeleteButton from '../../components/Credentials/CredentialDeleteButton';
1414
import FullscreenPopup from '../../components/Popups/FullscreenImg';
1515
import DeletePopup from '../../components/Popups/DeletePopup';
16-
import StatusRibbon from '../../components/Credentials/StatusRibbon';
1716
import { CredentialImage } from '../../components/Credentials/CredentialImage';
1817

1918
const CredentialDetail = () => {
@@ -87,7 +86,6 @@ const CredentialDetail = () => {
8786
// Open the modal when the credential is clicked
8887
<div className="relative rounded-xl xl:w-4/5 pt-5 md:w-full sm:w-full overflow-hidden transition-shadow shadow-md hover:shadow-lg cursor-pointer w-full" onClick={() => setShowFullscreenImgPopup(true)}>
8988
<CredentialImage credential={vcEntity.credential} className={"w-full object-cover rounded-xl"} />
90-
<StatusRibbon credential={vcEntity.credential} />
9189
</div>
9290
) : (
9391
<></>
@@ -113,7 +111,7 @@ const CredentialDetail = () => {
113111
isOpen={showFullscreenImgPopup}
114112
onClose={() => setShowFullscreenImgPopup(false)}
115113
content={
116-
<CredentialImage credential={vcEntity.credential} className={"max-w-full max-h-full rounded-xl"} />
114+
<CredentialImage credential={vcEntity.credential} className={"max-w-full max-h-full rounded-xl"} showRibbon={false} />
117115
}
118116
/>
119117
)}

src/pages/Home/Home.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import CredentialDeleteButton from '../../components/Credentials/CredentialDelet
1919
import QRCodeScanner from '../../components/QRCodeScanner/QRCodeScanner';
2020
import FullscreenPopup from '../../components/Popups/FullscreenImg';
2121
import DeletePopup from '../../components/Popups/DeletePopup';
22-
import StatusRibbon from '../../components/Credentials/StatusRibbon';
2322
import { CredentialImage } from '../../components/Credentials/CredentialImage';
2423

2524
const Home = () => {
@@ -159,7 +158,6 @@ const Home = () => {
159158
<>
160159
<div className="relative rounded-xl xl:w-4/5 md:w-full sm:w-full overflow-hidden transition-shadow shadow-md hover:shadow-lg cursor-pointer w-full" onClick={() => { setShowFullscreenImgPopup(true); setSelectedVcEntity(vcEntity); }}>
161160
<CredentialImage credential={vcEntity.credential} className={"w-full h-full object-cover rounded-xl"} />
162-
<StatusRibbon credential={vcEntity.credential} />
163161
</div>
164162
<div className="flex items-center justify-end mt-2 mr-3">
165163
<span className="mr-4">{currentSlide} of {vcEntityList.length}</span>
@@ -189,7 +187,6 @@ const Home = () => {
189187
onClick={() => handleImageClick(vcEntity)}
190188
>
191189
<CredentialImage credential={vcEntity.credential} className={"w-full h-full object-cover rounded-xl"} />
192-
<StatusRibbon credential={vcEntity.credential} />
193190
</div>
194191
))}
195192
<div
@@ -216,7 +213,7 @@ const Home = () => {
216213
isOpen={showFullscreenImgPopup}
217214
onClose={() => setShowFullscreenImgPopup(false)}
218215
content={
219-
<CredentialImage credential={selectedVcEntity.credential} className={"max-w-full max-h-full rounded-xl"} />
216+
<CredentialImage credential={selectedVcEntity.credential} className={"max-w-full max-h-full rounded-xl"} showRibbon={false} />
220217
}
221218
/>
222219
)}

0 commit comments

Comments
 (0)