Skip to content

Commit badca9b

Browse files
committed
Move the status ribbon into CredentialImage.js
1 parent 01bf38b commit badca9b

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

src/components/Credentials/CredentialImage.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState, useEffect } from "react"
22
import { parseCredential } from "../../functions/parseCredential";
3+
import StatusRibbon from '../../components/Credentials/StatusRibbon';
34

45

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

1415
return (
1516
<>
16-
{parsedCredential &&
17+
{parsedCredential &&(
18+
<>
1719
<img src={parsedCredential.credentialBranding.image.url} alt={"Credential"} className={className} onClick={onClick} />
18-
}
20+
<StatusRibbon credential={credential}/>
21+
</>
22+
)}
1923
</>
2024
)
2125
}

src/components/Popups/SelectCredentials.js

Lines changed: 2 additions & 3 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

@@ -37,6 +36,7 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
3736
);
3837

3938
setRequestedFields(conformantCredentialsMap[keys[currentIndex]].requestedFields);
39+
console.log('->',simplifiedCredentials);
4040
setImages(simplifiedCredentials);
4141
} catch (error) {
4242
console.error('Failed to fetch data', error);
@@ -83,7 +83,7 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
8383
};
8484

8585
return (
86-
<div className="fixed inset-0 flex items-center justify-center z-50">
86+
<div className="fixed inset-0 flex items-center justify-center z-40">
8787
<div className="absolute inset-0 bg-black opacity-50"></div>
8888
<div className="bg-white p-4 rounded-lg shadow-lg w-full lg:max-w-[33.33%] sm:max-w-[66.67%] max-h-[90vh] z-10 relative m-4 overflow-y-auto">
8989
<h2 className="text-lg font-bold mb-2 text-custom-blue">
@@ -134,7 +134,6 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
134134
<div className="m-3 flex justify-center">
135135
<div className="relative rounded-xl w-2/3 overflow-hidden transition-shadow shadow-md hover:shadow-lg cursor-pointer">
136136
<CredentialImage key={image.credentialIdentifier} credential={image.credential} onClick={() => handleClick(image.credentialIdentifier)} className={"w-full object-cover rounded-xl"} />
137-
<StatusRibbon credential={image.credential} />
138137
</div>
139138
</div>
140139
))}

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: 0 additions & 2 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
<></>

src/pages/Home/Home.js

Lines changed: 0 additions & 3 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

0 commit comments

Comments
 (0)