diff --git a/apps/marginfi-v2-ui/src/components/desktop/DesktopAccountSummary/DesktopAccountSummary.tsx b/apps/marginfi-v2-ui/src/components/desktop/DesktopAccountSummary/DesktopAccountSummary.tsx
index 860cf3c3dd..e20813dc70 100644
--- a/apps/marginfi-v2-ui/src/components/desktop/DesktopAccountSummary/DesktopAccountSummary.tsx
+++ b/apps/marginfi-v2-ui/src/components/desktop/DesktopAccountSummary/DesktopAccountSummary.tsx
@@ -23,7 +23,7 @@ const AccountSummary = () => {
return (
-
+
Global stats
{
{connected && (
-
+
Your account
= ({ userPointsData }) => {
-
+
Total Points
= ({ userPointsData }) => {
-
+
Lending Points
= ({ userPointsData }) => {
-
+
Borrowing Points
= ({ userPointsData }) => {
-
+
Referral Points
!uuidPattern.test(code));
- isCustomReferralLink = true;
- } else {
- userReferralCode = userReferralData?.referralCode || "";
- isCustomReferralLink = false;
+ try {
+ userPublicProfileSnap = await getDoc(userPublicProfileDoc);
+ userReferralData = userPublicProfileSnap.data();
+ if (userReferralData && Array.isArray(userReferralData?.referralCode)) {
+ const uuidPattern = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-\b[0-9a-fA-F]{12}$/;
+ userReferralCode = userReferralData.referralCode.find((code) => !uuidPattern.test(code));
+ isCustomReferralLink = true;
+ } else {
+ userReferralCode = userReferralData?.referralCode || "";
+ isCustomReferralLink = false;
+ }
+ } catch (e) {
+ console.log("error", e);
}
const pointsData = userPointsSnap.data();
+ if (!pointsData) {
+ return {
+ ...DEFAULT_USER_POINTS_DATA,
+ owner: wallet,
+ };
+ }
+
+ console.log("pointsData", pointsData);
+
const depositPoints = pointsData.total_deposit_points.toFixed(4);
const borrowPoints = pointsData.total_borrow_points.toFixed(4);
const referralPoints = (pointsData.total_referral_deposit_points + pointsData.total_referral_borrow_points).toFixed(