From 28c814560a1f0a94671ba07da8da88e57d01595c Mon Sep 17 00:00:00 2001 From: Desktop Date: Thu, 13 Nov 2025 01:15:47 +0500 Subject: [PATCH] Update Industries.tsx --- frontend/src/pages/Reference/Industries.tsx | 24 ++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/Reference/Industries.tsx b/frontend/src/pages/Reference/Industries.tsx index 078e0830..dec70f9d 100644 --- a/frontend/src/pages/Reference/Industries.tsx +++ b/frontend/src/pages/Reference/Industries.tsx @@ -10,8 +10,19 @@ import { PieChartIcon } from '../../icons'; interface IndustryWithData extends Industry { keywordsCount: number; topKeywords: SeedKeyword[]; + totalVolume: number; } +// Format volume with k for thousands and m for millions +const formatVolume = (volume: number): string => { + if (volume >= 1000000) { + return `${(volume / 1000000).toFixed(1)}m`; + } else if (volume >= 1000) { + return `${(volume / 1000).toFixed(1)}k`; + } + return volume.toString(); +}; + export default function Industries() { const toast = useToast(); const [industries, setIndustries] = useState([]); @@ -51,10 +62,17 @@ export default function Industries() { .sort((a, b) => (b.volume || 0) - (a.volume || 0)) .slice(0, 5); + // Calculate total volume of all keywords + const totalVolume = industryKeywords.reduce( + (sum, kw) => sum + (kw.volume || 0), + 0 + ); + return { ...industry, keywordsCount: industryKeywords.length, topKeywords, + totalVolume, }; }); @@ -102,9 +120,9 @@ export default function Industries() {

{industry.name}

- {industry.is_active !== false && ( - - Active + {industry.totalVolume > 0 && ( + + {formatVolume(industry.totalVolume)} )}