Files
igny8/frontend/dist/assets/js/Industries-CnSbmgkW.js
IGNY8 VPS (Salman) 3c100be1cf more
2025-11-13 14:12:36 +00:00

2 lines
4.3 KiB
JavaScript

import{r as n,j as e}from"./chunk-UIGDSWPH-BhuNDbxn.js";import{u as b,ah as y,s as w,P as k,n as v}from"./main-af3pcbZa.js";import{C as N}from"./Card-CAsJMMfR.js";import{B as K}from"./Badge-DM3morB7.js";import{P as S}from"./PageHeader-iXTYKDGo.js";import{T as V}from"./Tooltip-D9yIUHzL.js";const C=r=>r>=1e6?`${(r/1e6).toFixed(1)}m`:r>=1e3?`${(r/1e3).toFixed(1)}k`:r.toString();function W(){const r=b(),[x,h]=n.useState([]),[u,c]=n.useState(!0);n.useEffect(()=>{g()},[]);const g=async()=>{try{c(!0);const i=(await y()).industries||[];let t=[];try{t=(await w({page_size:1e3})).results||[]}catch(a){console.warn("Failed to fetch keywords, will show without keyword data:",a)}const p=i.map(a=>{const l=t.filter(o=>o.industry_name===a.name),f=[...l].sort((o,d)=>(d.volume||0)-(o.volume||0)).slice(0,5),j=l.reduce((o,d)=>o+(d.volume||0),0);return{...a,keywordsCount:l.length,topKeywords:f,totalVolume:j}}).filter(a=>a.keywordsCount>0);h(p)}catch(s){r.error(`Failed to load industries: ${s.message}`)}finally{c(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(k,{title:"Industries"}),e.jsx(S,{title:"Industries",badge:{icon:e.jsx(v,{}),color:"blue"},hideSiteSector:!0}),e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"mb-6",children:e.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Explore our comprehensive global database of industries, sectors, and high-volume keywords"})}),u?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-gray-500",children:"Loading industries..."})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:x.map(s=>{var i;return e.jsxs(N,{className:"p-4 hover:shadow-lg transition-shadow duration-200 border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsx("h3",{className:"text-base font-bold text-gray-900 dark:text-white leading-tight",children:s.name}),s.totalVolume>0&&e.jsx(V,{text:`Total search volume: ${s.totalVolume.toLocaleString()} monthly searches across all keywords in this industry`,placement:"top",children:e.jsx(K,{variant:"solid",color:"dark",size:"sm",children:C(s.totalVolume)})})]}),s.description&&e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-3 line-clamp-2",children:s.description}),e.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),e.jsx("span",{className:"font-medium",children:((i=s.sectors)==null?void 0:i.length)||s.sectors_count||0}),e.jsx("span",{className:"text-gray-500",children:"sectors"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"})}),e.jsx("span",{className:"font-medium",children:s.keywordsCount||0}),e.jsx("span",{className:"text-gray-500",children:"keywords"})]})]}),s.topKeywords&&s.topKeywords.length>0&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("p",{className:"text-xs font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Top Keywords"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.topKeywords.slice(0,5).map((t,m)=>e.jsxs("div",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[e.jsx("span",{className:"text-xs font-medium text-blue-700 dark:text-blue-300",children:t.keyword}),e.jsx("span",{className:"text-xs text-blue-600 dark:text-blue-400 font-semibold",children:t.volume?t.volume>=1e3?`${(t.volume/1e3).toFixed(1)}k`:t.volume.toString():"-"})]},t.id||m))})]})]},s.slug)})})]})]})}export{W as default};