Skip to content

Commit

Permalink
Fix: cover image and view credential fix
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik cs authored and georgepadayatti committed Apr 8, 2024
1 parent 5c99d64 commit 6377013
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/component/OrganisationDetails/OrgCoverImageUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ type Props = {
};

const OrgCoverImageUpload = (props: Props) => {
const { editMode, handleEdit } = props;
let coverImageBase64 = localStorage.getItem('cachedCoverImage')

const { editMode, handleEdit, setCoverImageBase64, coverImageBase64 } = props;
let coverImage = coverImageBase64 ? coverImageBase64 : localStorage.getItem('cachedCoverImage')

const myFile: { file: string; imagePreviewUrl: any } = {
file: "",
Expand All @@ -58,6 +57,7 @@ const OrgCoverImageUpload = (props: Props) => {
.then((res) => {
HttpService.getCoverImage().then((imageBase64) => {
handleEdit();
setCoverImageBase64(imageBase64);
localStorage.setItem('cachedCoverImage', imageBase64)
});
})
Expand All @@ -76,9 +76,9 @@ const OrgCoverImageUpload = (props: Props) => {
duration={0}
style={{ opacity: editMode ? 0.25 : 1, transitionDuration: "0ms" }}
src={
!coverImageBase64
!coverImage
? defaultCoverImage
: coverImageBase64
: coverImage
}
/>

Expand Down
19 changes: 7 additions & 12 deletions src/component/OrganisationDetails/OrgDetailsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,22 @@ const OrganisationDetailsContainer = (props: Props) => {
'policyUrl': organisationDetails?.policyUrl,
'description': organisationDetails?.description
})
HttpService.getCoverImage().then((coverImage) => {
setCoverImageBase64(coverImage);
localStorage.setItem('cachedCoverImage', coverImage)
});
HttpService.getLogoImage().then((logoImage) => {
setLogoImageBase64(logoImage);
localStorage.setItem('cachedLogoImage', logoImage)
});
}, [organisationDetails])

const verifyConnectionObj = useAppSelector(
(state) => state?.gettingStart?.data
);

const isVerify = verifyConnectionObj?.verification?.presentationState == 'verified';

const callRightSideDrawer = () => {
isEnableAddCredential && setOpenRightSideDrawer(!openRightSideDrawer)
isVerify && setOpenRightSideDrawer(!openRightSideDrawer)
}

const verifyConnectionObj = useAppSelector(
(state) => state?.gettingStart?.data
);

const isVerify = verifyConnectionObj?.verification?.presentationState == 'verified';


const handleChange = (e) => {
const { name, value } = e.target;
setFormValue({
Expand Down
10 changes: 8 additions & 2 deletions src/container/GettingStarted/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next';
import { useAppDispatch, useAppSelector } from "../../customHooks";
import { gettingStartAction, listConnectionAction } from '../../redux/actionCreators/gettingStart';
import Loader from "../../component/Loader";
import { HttpService } from '../../service/HttpService';

const Container = styled("div")(({ theme }) => ({
margin: "0px 15px 0px 15px",
Expand Down Expand Up @@ -39,6 +40,7 @@ const Item = styled("div")(({ theme }) => ({

const GettingStarted = () => {
const [editMode, setEditMode] = useState(false);
const [coverImageBase64, setCoverImageBase64] = useState();
const dispatch = useAppDispatch();
const { t } = useTranslation('translation');
const navigate = useNavigate();
Expand All @@ -56,6 +58,10 @@ const GettingStarted = () => {
useEffect(() => {
!gettingStartData && dispatch(gettingStartAction());
!listConnections && dispatch(listConnectionAction(10, 0, false));
HttpService.getCoverImage().then((coverImage) => {
setCoverImageBase64(coverImage);
localStorage.setItem('cachedCoverImage', coverImage)
});
}, []);

const handleEdit = () => {
Expand All @@ -67,8 +73,8 @@ const GettingStarted = () => {
<Container className='pageContainer'>
<OrgCoverImageUpload
editMode={editMode}
coverImageBase64={'logoImageBase64'}
setCoverImageBase64={'logoImageBase64'}
coverImageBase64={coverImageBase64}
setCoverImageBase64={setCoverImageBase64}
handleEdit={handleEdit}
/>
<OrganisationDetailsContainer
Expand Down

0 comments on commit 6377013

Please sign in to comment.