harshapitla/stackoverflow
0
1"use strict";(self.webpackChunkreact_template=self.webpackChunkreact_template||[]).push([[354],{15:(e,t,r)=>{r.d(t,{A:()=>o});r(5043);var s=r(579);function o(e){let{title:t,subtitle:r,children:o,actions:n,footer:i}=e;return(0,s.jsxs)("section",{className:"card chart-card",children:[(t||r||n)&&(0,s.jsxs)("div",{className:"chart-card-header",children:[(0,s.jsxs)("div",{children:[t&&(0,s.jsx)("h3",{className:"chart-card-title",children:t}),r&&(0,s.jsx)("p",{className:"chart-card-subtitle",children:r})]}),n&&(0,s.jsx)("div",{className:"chart-card-actions",children:n})]}),(0,s.jsx)("div",{className:"chart-card-body",children:o}),i&&(0,s.jsx)("div",{className:"chart-card-footer",children:i})]})}},5354:(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var s=r(5043),o=r(379),n=r(1180),i=r(7734),a=r(23),l=r(2185),c=r(6026),d=r(2291),u=r(15),h=r(579);function f(e){if(null===e||void 0===e)return 0;if("number"===typeof e)return e;if("string"===typeof e){const t=e.replace(/,/g,"").trim(),r=Number(t);return isNaN(r)?0:r}return 0}function g(e){let{active:t,payload:r,label:s}=e;return t&&r&&r.length?(0,h.jsxs)("div",{style:{background:"#ffffff",padding:"8px 12px",borderRadius:6,border:"1px solid #cbd5e1"},children:[(0,h.jsx)("strong",{children:s}),(0,h.jsxs)("div",{style:{marginTop:4},children:["Value: ",r[0].value.toLocaleString()]})]}):null}function p(e){let{rows:t=[]}=e;const[r,p]=(0,s.useState)("followers"),v=(0,s.useMemo)(()=>{if(!Array.isArray(t))return[];const e={};return t.forEach(t=>{if(!t.title)return;const s=f(t.followers_count),o=f(t.reviews_count),n=f(t.used_by_count),i="followers"===r?s:"reviews"===r?o:n;if(i<=0)return;const a=function(e){if(!e||"string"!==typeof e)return"unknown";const t=e.split("/").filter(Boolean);return t[t.length-1]||"unknown"}(t.product_detail_page_url),l="".concat(t.title," (").concat(a,")");e[l]=(e[l]||0)+i}),Object.entries(e).map(e=>{let[t,r]=e;return{title:t,value:r}}).sort((e,t)=>t.value-e.value).slice(0,10)},[t,r]),b=(0,s.useMemo)(()=>{if(!v.length)return[];const e=v[0],t=v[Math.floor(v.length/2)],s=v.reduce((e,t)=>e+t.value,0)/v.length;return"followers"===r?["".concat(e.title," attracts significantly more followers than the rest, showing a clear lead in visibility and interest."),"Follower distribution is uneven \u2014 a small number of products dominate attention while others trail behind.","Products above the average follower count of ".concat(Math.round(s).toLocaleString()," can be considered strong contenders in terms of market presence.")]:"reviews"===r?["".concat(e.title," receives the highest review activity, indicating consistent user feedback rather than passive interest."),"Review volume drops sharply after the top few products, suggesting that only select products drive discussions.","Products around ".concat(Math.round(t.value).toLocaleString()," reviews reflect moderate but healthy engagement levels.")]:["".concat(e.title," shows the highest real-world usage, highlighting adoption beyond early hype."),"Usage is concentrated among a few products, while the majority see comparatively lower traction.","Products above ".concat(Math.round(s).toLocaleString()," users demonstrate sustained practical value.")]},[v,r]);return v.length?(0,h.jsxs)(u.A,{title:"followers"===r?"Top Products by Followers":"reviews"===r?"Top Products by Reviews":"Top Products by Usage",subtitle:"Distinct products shown using Product Hunt identifiers",children:[(0,h.jsxs)("div",{style:{marginBottom:16,display:"flex",gap:"8px"},children:[(0,h.jsx)("button",{onClick:()=>p("followers"),style:{padding:"10px 16px",borderRadius:"8px",background:"followers"===r?"#007acc":"#f0f0f0",color:"followers"===r?"white":"black",border:"none",cursor:"pointer"},children:"\ud83d\udc65 Followers"}),(0,h.jsx)("button",{onClick:()=>p("reviews"),style:{padding:"10px 16px",borderRadius:"8px",background:"reviews"===r?"#007acc":"#f0f0f0",color:"reviews"===r?"white":"black",border:"none",cursor:"pointer"},children:"\ud83d\udcdd Reviews"}),(0,h.jsx)("button",{onClick:()=>p("usage"),style:{padding:"10px 16px",borderRadius:"8px",background:"usage"===r?"#007acc":"#f0f0f0",color:"usage"===r?"white":"black",border:"none",cursor:"pointer"},children:"\ud83d\udc65 Usage"})]}),(0,h.jsx)(n.u,{width:"100%",height:420,children:(0,h.jsxs)(d.E,{data:v,margin:{top:30,right:30,left:20,bottom:140},children:[(0,h.jsx)(i.d,{strokeDasharray:"3 3"}),(0,h.jsx)(l.W,{dataKey:"title",angle:-45,textAnchor:"end",interval:0,height:120,tick:{fontSize:12}}),(0,h.jsx)(c.h,{}),(0,h.jsx)(o.m,{content:(0,h.jsx)(g,{})}),(0,h.jsx)(a.y,{dataKey:"value",fill:"#8884d8",radius:[6,6,0,0]})]})}),(0,h.jsxs)("div",{style:{marginTop:18},children:[(0,h.jsx)("strong",{children:"Key Insights"}),(0,h.jsx)("ul",{style:{marginTop:8,paddingLeft:18},children:b.map((e,t)=>(0,h.jsx)("li",{style:{marginBottom:6},children:e},t))})]})]}):(0,h.jsx)(u.A,{title:"Top Product Hunt Products",subtitle:"Based on followers, reviews, or usage",children:(0,h.jsx)("p",{className:"small",children:"No valid data available."})})}}}]);2//# sourceMappingURL=354.f65d3712.chunk.js.map