diff --git a/apps/hackathon/src/app/certificate/[certId]/page.tsx b/apps/hackathon/src/app/certificate/[certId]/page.tsx index 8268913..2f8a5f8 100644 --- a/apps/hackathon/src/app/certificate/[certId]/page.tsx +++ b/apps/hackathon/src/app/certificate/[certId]/page.tsx @@ -4,6 +4,7 @@ import { Button } from '@imphnen-frontend-service/ui/atoms'; import { decodeCertificateId } from '../../../utils/certificate'; import { useCertificatePublicData, + useAuthStore, } from '@imphnen-frontend-service/service'; import QRCode from 'qrcode'; import html2canvas from 'html2canvas'; @@ -17,6 +18,7 @@ interface DecodedCert { const CertificatePage: FC = (): ReactElement => { const { certId } = useParams<{ certId: string }>(); const navigate = useNavigate(); + const { session } = useAuthStore(); const [decodedInfo, setDecodedInfo] = useState(null); const [error, setError] = useState(null); const teamNameRef = useRef(null); @@ -74,6 +76,9 @@ const CertificatePage: FC = (): ReactElement => { // Certificate name from the user data const certificateName = certificateUser?.fullname; + // Check if current user is viewing their own certificate (team member) + const isTeamMember = session?.user?.id === decodedInfo?.userId; + // Dynamic font sizing: shrink by 2px if height exceeds 80px useEffect(() => { const adjustFontSize = ( @@ -281,7 +286,7 @@ const CertificatePage: FC = (): ReactElement => { {team?.name}

- {team && ( + {team && isTeamMember && ( - - {team && ( + {isTeamMember && ( +
- )} -
+ + {team && ( + + )} + + )} {/* Info Box */}