From 6b44c3982b5a37b21f96931f4cfe5d6498533619 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Mon, 22 Jun 2026 11:18:48 +0530 Subject: [PATCH 1/2] fix: batch UI/UX fixes - safe area, empty state, clipboard, dropdown #614 #613 #611 #610 #581 --- index.html | 2 +- src/components/layout/PublicNavbar.jsx | 10 ++++++++++ src/index.css | 1 + src/pages/CardBuilder.jsx | 12 ++++++++---- src/pages/Friends.jsx | 19 ++++++++++++++++--- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index a36ddf5..fa50f8d 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + diff --git a/src/components/layout/PublicNavbar.jsx b/src/components/layout/PublicNavbar.jsx index 4cd455a..4045043 100644 --- a/src/components/layout/PublicNavbar.jsx +++ b/src/components/layout/PublicNavbar.jsx @@ -35,6 +35,16 @@ export const PublicNavbar = () => { const navRef = useRef(null); const glareRef = useRef(null); + useEffect(() => { + const handleClickOutside = (event) => { + if (mobileExpanded && navRef.current && !navRef.current.contains(event.target)) { + setMobileExpanded(false); + } + }; + document.addEventListener("mousedown", handleClickOutside); + return () => document.removeEventListener("mousedown", handleClickOutside); + }, [mobileExpanded]); + // Function to update the pill position and width const updatePill = (index, smooth = true) => { const btn = buttonRefs.current[index]; diff --git a/src/index.css b/src/index.css index 1ca36a3..dfdcd49 100644 --- a/src/index.css +++ b/src/index.css @@ -25,6 +25,7 @@ min-height: 100vh !important; display: block !important; text-align: left !important; + padding-bottom: env(safe-area-inset-bottom, 0px) !important; } } diff --git a/src/pages/CardBuilder.jsx b/src/pages/CardBuilder.jsx index 684cf08..8b44bcc 100644 --- a/src/pages/CardBuilder.jsx +++ b/src/pages/CardBuilder.jsx @@ -25,10 +25,14 @@ const CardBuilder = () => { const markdownCode = `[![RankerHub Stats](${devcardUrl})](${baseUrl}/dashboard/profile/${githubUsername})`; - const handleCopy = () => { - navigator.clipboard.writeText(markdownCode); - setCopied(true); - setTimeout(() => setCopied(false), 2000); + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(markdownCode); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + } catch { + setCopied(false); + } }; return ( diff --git a/src/pages/Friends.jsx b/src/pages/Friends.jsx index 1dca192..cb3568e 100644 --- a/src/pages/Friends.jsx +++ b/src/pages/Friends.jsx @@ -279,12 +279,25 @@ export const Friends = () => { ) : ( -

No developers here yet

-

- {activeTab === "leaderboard" +

+ {activeTab === "friends" ? "No friends yet!" : "No developers here yet"} +

+

+ {activeTab === "friends" + ? "Follow other developers to grow your friend circle and see their activity here." + : activeTab === "leaderboard" ? "Follow other developers to populate your Friends Leaderboard." : "Follow developers from suggestions to grow this section instantly."}

+ {activeTab === "friends" && ( + + + Discover Developers + + )}
)} From 4c9ed97fbf5f0f51b5eac3a809227f7a95dddfa9 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Fri, 24 Jul 2026 13:42:56 +0530 Subject: [PATCH 2/2] fix: use latestData in transaction for hubCoins, handle batch flush promise rejection --- src/context/AuthContext.jsx | 2 +- src/utils/firestoreOptimization.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/context/AuthContext.jsx b/src/context/AuthContext.jsx index 64b7f1e..cdbf8f6 100644 --- a/src/context/AuthContext.jsx +++ b/src/context/AuthContext.jsx @@ -81,7 +81,7 @@ const checkAndUpdateStreak = async (data, docRef) => { lastLogin: currentNow.toISOString(), "points.streakPoints": newStreakPoints, "points.totalPoints": newTotalPoints, - hubCoins: (data.hubCoins || 0) + 10 + hubCoins: (latestData.hubCoins || 0) + 10 }); }); } catch (err) { diff --git a/src/utils/firestoreOptimization.js b/src/utils/firestoreOptimization.js index c8bb66f..afea6ef 100644 --- a/src/utils/firestoreOptimization.js +++ b/src/utils/firestoreOptimization.js @@ -157,7 +157,9 @@ export class FirestoreBatchOptimizer { // Flush if batch is full if (this.batch.length >= this.maxBatchSize) { - this.flush(); + this.flush().catch((err) => { + console.error("Batch flush failed:", err); + }); return; }