|
| 1 | +import { AccountAPI } from "@/lib/accountapi" |
| 2 | +import Template1 from "@/lib/templates/template1" |
| 3 | +import { useEffect, useState } from "react" |
| 4 | + |
1 | 5 | const ConnectionCard = ({cardId}: any) => { |
| 6 | + console.log(cardId) |
| 7 | + const themeStyle = "absolute -top-[44px] -left-[73px] w-[475px] h-[282px] bg-gradient-to-r from-[#7F7FD5] to-[#91EAE4] rounded-xl scale-[0.7] z-20 hover:cursor-pointer"; |
| 8 | + const [userDetails, setUserDetails] = useState({ |
| 9 | + name: "", |
| 10 | + email: "", |
| 11 | + type: "", |
| 12 | + userId: "", |
| 13 | + }) |
| 14 | + |
| 15 | + const [cardInfo, setCardInfo] = useState({ |
| 16 | + profession: "", |
| 17 | + organisation: "", |
| 18 | + firmType: "", |
| 19 | + contactNo: "", |
| 20 | + socials: [], |
| 21 | + }) |
| 22 | + |
| 23 | + const getDetails = () => { |
| 24 | + } |
| 25 | + |
| 26 | + useEffect(() => { |
| 27 | + AccountAPI.getUserCardDocument(cardId).then((res: any) => { |
| 28 | + console.log(res, "user") |
| 29 | + const data = res.documents[0] |
| 30 | + setUserDetails((prev: any) => ({ |
| 31 | + ...prev, |
| 32 | + name: data.name, |
| 33 | + email: data.email, |
| 34 | + type: data.type, |
| 35 | + userId: data.userId, |
| 36 | + })) |
| 37 | + }) |
| 38 | + |
| 39 | + AccountAPI.fetchingProfile(cardId).then((res: any) => { |
| 40 | + console.log(res,"profile") |
| 41 | + if(res.total != 0) { |
| 42 | + const data = res.documents[0] |
| 43 | + setCardInfo((prev: any) => ({ |
| 44 | + ...prev, |
| 45 | + profession: data.profession, |
| 46 | + organisation: data.organisation, |
| 47 | + firmType: data.firmType, |
| 48 | + contactNo: data.contactNo, |
| 49 | + socials: data.socials, |
| 50 | + })) |
| 51 | + } |
| 52 | + }) |
| 53 | + console.log(userDetails) |
| 54 | + console.log(cardInfo) |
| 55 | + },[]) |
| 56 | + console.log(userDetails) |
| 57 | + console.log(cardInfo) |
| 58 | + |
2 | 59 | return ( |
3 | 60 | <div |
4 | 61 | className="h-[225px] w-[375px] m-auto flex flex-col justify-center items-center max-[470px]:scale-[0.87] max-[400px]:scale-[0.85] max-[470px]:m-0" |
5 | 62 | > |
6 | | - <div |
7 | | - className="bg-[#ffd803] w-[350px] h-[175px] rounded-lg" |
8 | | - > |
| 63 | + <div className="relative w-[333px] h-[198px] rounded-lg"> |
| 64 | + {userDetails.name != "" && <div |
| 65 | + className={themeStyle} |
| 66 | + ><Template1 {...{ |
| 67 | + userDetails, |
| 68 | + cardInfo, |
| 69 | + }}/></div>} |
9 | 70 | </div> |
10 | | - |
11 | | - <p |
12 | | - className="text-center font-medium pt-2" |
13 | | - >Date Added: 00/00/000</p> |
14 | 71 | </div> |
15 | 72 | ) |
16 | 73 | } |
|
0 commit comments