From b49e5ada2ca506771cdd739e8791de59870b22c7 Mon Sep 17 00:00:00 2001 From: Atul Upadhyay Date: Mon, 23 Feb 2026 22:34:37 +0530 Subject: [PATCH] fix: show GitHub stars count and add VS Code stats in mobile view - Uncomment CountingNumbers import and usage in mobile-menu.tsx to display GitHub stars count (was previously commented out) - Add VS Code Extension installs stats section in mobile menu matching the desktop header style with proper icon and install count - Fetch VS Code marketplace install count via gallery API - Ensure consistent behavior across desktop and mobile views Fixes #[issue]: Inconsistent Display of GitHub and VS Code Stats in Mobile View Signed-off-by: Atul Upadhyay --- components/ui/mobile-menu.tsx | 84 +++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/components/ui/mobile-menu.tsx b/components/ui/mobile-menu.tsx index af3e1db5..c78656b5 100644 --- a/components/ui/mobile-menu.tsx +++ b/components/ui/mobile-menu.tsx @@ -3,7 +3,7 @@ import { useState, useRef, useEffect } from "react"; import { Transition } from "@headlessui/react"; import Link from "next/link"; -// import CountingNumbers from "../utils/countingNumbers"; +import CountingNumbers from "../utils/countingNumbers"; import Image from "next/image"; import { UpIcon } from "../nav/UpIcon"; import DownIcon from "../nav/DownIcon"; @@ -11,15 +11,58 @@ import { PillarPages } from "../utils/resources"; import { StarIcon } from "@heroicons/react/24/solid"; import { ProductsSection } from "../utils/Products"; import { GlossarySection } from "../utils/Products"; + interface MobileMenuProps { starsCount: number; + vsCodeInstalls?: string; } -const MobileMenu: React.FC = ({ starsCount }) => { +const MobileMenu: React.FC = ({ starsCount, vsCodeInstalls }) => { const [mobileNavOpen, setMobileNavOpen] = useState(false); const [showResourcesDropdown,setShowResourcesDropdown] =useState(false); const [showProductsDropdown,setShowProductsDropdown] =useState(false); const [showGlossaryDropdown,setShowGlossaryDropdown] =useState(false); + const [vscodeInstallCount, setVscodeInstallCount] = useState(vsCodeInstalls || "1M+"); + + useEffect(() => { + // Fetch VS Code extension install count from the marketplace + const fetchVSCodeStats = async () => { + try { + const response = await fetch( + "https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery", + { + method: "POST", + headers: { + "Content-Type": "application/json", + Accept: "application/json;api-version=7.1-preview.1", + }, + body: JSON.stringify({ + filters: [{ criteria: [{ filterType: 7, value: "Keploy.keployio" }] }], + flags: 914, + }), + } + ); + if (response.ok) { + const data = await response.json(); + const stats = data?.results?.[0]?.extensions?.[0]?.statistics; + const installStat = stats?.find( + (s: { statisticName: string; value: number }) => s.statisticName === "install" + ); + if (installStat) { + const count = installStat.value as number; + const formatted = Intl.NumberFormat("en-US", { + notation: "compact", + maximumFractionDigits: 1, + }).format(count); + setVscodeInstallCount(formatted); + } + } + } catch (error) { + console.error("Error fetching VS Code stats:", error); + } + }; + fetchVSCodeStats(); + }, []); const trigger = useRef(null); const mobileNav = useRef(null); @@ -129,10 +172,43 @@ const MobileMenu: React.FC = ({ starsCount }) => { - {/* */} + + + + + {/* VS Code Extension Stats */} +
  • +
    + {/* Sliding effect span */} + + + {/* VS Code Icon */} + + VS Code Logo + + + + + + + + + + | + + + + + + {vscodeInstallCount}
    - {/*Github*/}