PageSourceSearch

https://startup-gate.net/assets/ProfileViewsAnalyticsSection-K4nfSMLG.js

js startup-gate.net collected 2026-10-08 16:30:43 UTC 6,112 bytes, 1 lines download raw bytes

1import{r as N,j as e}from"./vendor-radix-DLGwGdby.js";import{a_ as y,D as o,C as r,e as i,B as w,b as m,c as h,M as b}from"./index-Cz1Nuibl.js";import{a3 as p,U as C,T as u,bk as _}from"./vendor-lucide-BWW0XcuW.js";import{R as f,A as k,C as A,X as P,Y as S,T as j,a as T,k as V,l as R,m as D}from"./vendor-recharts-dzgay_RI.js";import"./vendor-datefns-CU7NMMYW.js";const d=["hsl(var(--primary))","hsl(var(--destructive))","hsl(var(--warning))","hsl(var(--success))","hsl(var(--accent-foreground))"];function L(l){return l.charAt(0).toUpperCase()+l.slice(1).replace(/_/g," ")}const O=[7,14,30,90];function K(){const[l,g]=N.useState(30),{data:a,isLoading:v}=y(l);if(v)return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(s=>e.jsx(o,{className:"h-28 rounded-xl"},s))}),e.jsx(o,{className:"h-72 rounded-xl"}),e.jsx(o,{className:"h-64 rounded-xl"})]});if(!a)return e.jsx(r,{className:"border-dashed",children:e.jsxs(i,{className:"py-16 text-center",children:[e.jsx(p,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/30"}),e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"No profile view data available"}),e.jsx("p",{className:"text-sm text-muted-foreground/70 mt-1",children:"Profile view activity will appear here once users browse profiles."})]})});const x=a.by_day.map(s=>({day:s.day.slice(5),views:s.count})),n=a.by_profile_type.map((s,t)=>({name:L(s.profile_type),value:s.count,fill:d[t%d.length]})),c=n.reduce((s,t)=>s+t.value,0);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Time range:"}),O.map(s=>e.jsxs(w,{variant:l===s?"default":"outline",size:"sm",onClick:()=>g(s),"data-testid":`button-profile-views-days-${s}`,children:[s,"d"]},s))]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsx(r,{children:e.jsxs(i,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(p,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:a.total_views.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Views"})]})]}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/70 mt-2",children:["in last ",a.days," days"]})]})}),e.jsx(r,{children:e.jsxs(i,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-success/10 flex items-center justify-center shrink-0",children:e.jsx(C,{className:"h-5 w-5 text-success"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:a.unique_profiles_viewed.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique Profiles Viewed"})]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 mt-2",children:"distinct profiles visited"})]})}),e.jsx(r,{children:e.jsxs(i,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-warning/10 flex items-center justify-center shrink-0",children:e.jsx(u,{className:"h-5 w-5 text-warning"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:a.unique_profiles_viewed>0?(a.total_views/a.unique_profiles_viewed).toFixed(1):"0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Avg Views / Profile"})]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 mt-2",children:"views per unique profile"})]})})]}),e.jsxs(r,{children:[e.jsx(m,{className:"pb-2",children:e.jsxs(h,{className:"text-sm flex items-center gap-2",children:[e.jsx(u,{className:"h-4 w-4 text-primary"}),"Daily Profile Views"]})}),e.jsx(i,{children:x.length>0?e.jsx(f,{width:"100%",height:200,children:e.jsxs(k,{data:x,margin:{left:-10},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"viewsGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",
1stopColor:"hsl(var(--primary))",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"hsl(var(--primary))",stopOpacity:0})]})}),e.jsx(A,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",vertical:!1}),e.jsx(P,{dataKey:"day",tick:{fontSize:10,fill:"hsl(var(--muted-foreground))"}}),e.jsx(S,{allowDecimals:!1,tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"}}),e.jsx(j,{}),e.jsx(T,{type:"monotone",dataKey:"views",name:"Views",stroke:"hsl(var(--primary))",fill:"url(#viewsGradient)",strokeWidth:2})]})}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No daily view data"})})]}),e.jsxs(r,{children:[e.jsx(m,{className:"pb-2",children:e.jsxs(h,{className:"text-sm flex items-center gap-2",children:[e.jsx(_,{className:"h-4 w-4 text-primary"}),"Views by Profile Type"]})}),e.jsx(i,{children:n.length>0?e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(f,{width:"40%",height:160,children:e.jsxs(V,{children:[e.jsx(R,{data:n,cx:"50%",cy:"50%",innerRadius:38,outerRadius:62,paddingAngle:4,dataKey:"value",children:n.map((s,t)=>e.jsx(D,{fill:s.fill},t))}),e.jsx(j,{formatter:s=>s.toLocaleString()})]})}),e.jsx("div",{className:"space-y-3 flex-1",children:n.map((s,t)=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{backgroundColor:d[t%d.length]}}),s.name]}),e.jsx("span",{className:"font-semibold",children:s.value.toLocaleString()})]}),e.jsx(b,{value:c>0?s.value/c*100:0,className:"h-1.5","aria-label":`${s.name}: ${c>0?Math.round(s.value/c*100):0}% of profile views`})]},s.name))})]}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No profile type data"})})]})]})}export{K as ProfileViewsAnalyticsSection};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.