PageSourceSearch

https://truthlens.pro/assets/Dashboard-YpwftN1a.js

js truthlens.pro collected 2026-10-02 02:08:05 UTC 19,450 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-trpc-DCcAlI5q.js";import{L as d,r as E}from"./vendor-react-D5r-IlYS.js";import{t as N,Z as $,A as p,u as D,f as R,L as f,S as L,k as T,B as o,m as B,U as g,n as w,i as Q,T as P,P as S,o as F,p as z,h as A,q as U,H as M}from"./index-Dqu5qgeY.js";import{D as V}from"./DashboardLayout-DeQdZwdf.js";import{u as _}from"./vendor-i18n-CocHSt1v.js";import{R as G}from"./refresh-cw-COBO6Hk5.js";import{S as I}from"./sparkles-FzfsgF0n.js";import{U as O}from"./users-DC9PW7v0.js";import{T as v}from"./trending-up-Bn6KrcGF.js";import{G as q}from"./gift-DL6BSPqw.js";import{A as C}from"./accountRoutes-BEdisMIx.js";import{C as W}from"./circle-x-BZMcOFdE.js";import{A as H}from"./activity-rDqtC9hr.js";import{R as Z,P as K,a as X,C as J,T as Y}from"./vendor-charts-DMCz1ErY.js";import"./vendor-markdown-fNldIaJy.js";import"./vendor-radix-Cu6bALrx.js";import"./layout-dashboard-CXW3y6ME.js";import"./shield-check-DNuC0uTk.js";function ee({planInfo:r}){const{t:n}=_(),{data:c,isLoading:a}=N.growthStatus.getStatus.useQuery(void 0,{staleTime:3e4,refetchOnWindowFocus:!1}),b=r?.analysesUsedThisMonth??0,m=r?.analysesQuota??0,j=Math.max(0,m-b),i=m>0?Math.min(100,b/m*100):0,x=c?.bonusCredits??0,h=c?.monthlyBonusUsed??0,s=c?.monthlyBonusCap??10,t=c?.daysUntilReset??0,l=c?.referredCount??0,u=c?.creditsEarnedViaReferral??0,y=i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500";return e.jsxs("div",{className:"glass-card rounded-2xl border border-purple-500/20 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-purple-500/20 flex items-center justify-center",children:e.jsx($,{className:"w-4 h-4 text-purple-400"})}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:n("credits.title","Mes crédits")})]}),a&&e.jsx(G,{className:"w-3.5 h-3.5 text-muted-foreground animate-spin"})]}),r&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:n("credits.plan_label","Plan {{plan}}",{plan:r.plan.toUpperCase()})}),e.jsxs("span",{children:[e.jsx("span",{className:i>=90?"text-red-400 font-semibold":"text-foreground",children:b})," / ",m]})]}
1),e.jsx("div",{className:"h-1.5 bg-foreground/10 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${y}`,style:{width:`${i}%`}})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j>0?n("credits.plan_remaining","{{count}} analyse(s) restante(s) ce mois",{count:j}):n("credits.plan_exhausted","Quota mensuel épuisé")})]}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-violet-500/10 to-fuchsia-500/10 border border-violet-500/20 p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(I,{className:"w-4 h-4 text-violet-400"}),e.jsx("span",{className:"text-sm font-semibold text-violet-700 dark:text-violet-300",children:n("credits.bonus_credits","Crédits bonus")})]}),e.jsx("span",{className:"text-2xl font-bold text-foreground",children:a?"—":x})]}),!a&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:n("credits.earned_this_month","Gagnés ce mois")}),e.jsxs("span",{children:[h," / ",s]})]}
1),e.jsx("div",{className:"h-1 bg-foreground/10 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-violet-500 transition-all duration-500",style:{width:`${Math.min(100,h/s*100)}%`}})}),t<=5&&t>0&&e.jsx("p",{className:"text-xs text-amber-400/80",children:n("credits.reset_soon","⚠ Remise à zéro dans {{days}} jour(s)",{days:t})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-foreground/5 rounded-xl p-3 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 mb-1",children:[e.jsx(O,{className:"w-3.5 h-3.5 text-blue-400"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("credits.referrals","Filleuls")})]}),e.jsx("p",{className:"text-lg font-bold text-foreground",children:l})]}),e.jsxs("div",{className:"bg-foreground/5 rounded-xl p-3 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 mb-1",children:[e.jsx(v,{className:"w-3.5 h-3.5 text-green-400"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("credits.earned_total","Gagnés")})]}),e.jsx("p",{className:"text-lg font-bold text-foreground",children:u})]})]}),e.jsx(d,{href:"/explore",children:e.jsxs("a",{className:"flex items-center justify-between w-full px-3 py-2 rounded-xl bg-purple-600/20 hover:bg-purple-600/30 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-sm text-violet-700 dark:text-violet-300 font-medium",children:n("credits.earn_more","Gagner des crédits")})]}),e.jsx(p,{className:"w-4 h-4 text-purple-400 group-hover:translate-x-0.5 transition-transform"})]})})]})}const se={free:"FREE",starter:"STARTER",pro:"PRO",business:"BUSINESS"},ae={free:"text-muted-foreground",starter:"text-blue-400",pro:"text-primary",business:"text-amber-400"},k={real:"#10b981",suspicious:"#f59e0b",ai:"#ef4444"};function ve(){const{t:r}=_(),{isAuthenticated:n,loading:c}=D();E.useEffect(()=>{const s=new URLSearchParams(window.location.search),t=s.get("payment_status"),l=s.get("plan");if(t==="success"){const u=l?l.toUpperCase():"";R.success(`✅ Abonnement ${u} activé avec succès ! Votre quota a été mis à jour.`,{duration:6e3}),window.history.replaceState({},"",window.location.pathname)}else t==="cancelled"&&(R.info("Paiement annulé. Votre abonnement actuel est inchangé.",{duration:4e3}),window.history.replaceState({},"",window.location.pathname))},[]);const{data:a,isLoading:b}=N.subscription.get.useQuery(void 0,{enabled:n}),{data:m,isLoading:j}=N.analysis.list.useQuery({limit:5,offset:0},{enabled:n}),{data:i,isLoading:x}=N.analysis.getStats.useQuery(void 0,{enabled:n});if(c)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(f,{className:"w-8 h-8 text-primary animate-spin"})});if(!n)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center p-8",children:[e.jsx(L,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:r("nav.login")}),e.jsx("p",{className:"text-muted-foreground mb-4",children:r("dashboard.subtitle")}),e.jsx("a",{href:T(),children:e.jsx(o,{children:r("nav.login")})})]})});const h=i?[{name:"Réel",value:i.real,color:k.real},{name:"Suspect",value:i.suspicious,color:k.suspicious},{name:"IA",value:i.ai,color:k.ai}].filter(s=>s.value>0):[];return e.jsx(V,{children:e.jsx("div",{className:"px-6 py-8",children:e.jsxs("div",{className:"container max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold mb-1",children:[r("dashboard.title")," 👋"]}),e.jsx("p",{className:"text-muted-foreground",children:r("dashboard.subtitle")})]}),e.jsx(d,{href:"/upload",children:e.jsxs(o,{size:"lg",className:"gap-2",style:{boxShadow:"0 0 20px oklch(0.72 0.18 200 / 0.3)"},children:[e.jsx(g,{className:"w-4 h-4"}),r("dashboard.newAnalysis")]})})]}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[{label:r("dashboard.stats.total"),value:x?"—":i?.total??0,icon:e.jsx(w,{className:"w-5 h-5 text-primary"}),color:"text-foreground"},{label:r("dashboard.stats.real"),value:x?"—":i?.real??0,icon:e.jsx(Q,{className:"w-5 h-5 text-emerald-400"}),color:"text-emerald-400"},{label:r("dashboard.stats.suspicious"),value:x?"—":i?.suspicious??0,icon:e.jsx(P,{className:"w-5 h-5 text-amber-400"}),color:"text-amber-400"},{label:r("dashboard.stats.aiGenerated"),value:x?"—":i?.ai??0,icon:e.jsx(W,{className:"w-5 h-5 text-red-400"}),color:"text-red-400"}].map(s=>e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s.label}),s.icon]}),e.jsx("div",{className:`text-3xl font-black ${s.color}`,children:s.value})]},s.label))}),a&&B(a)&&e.jsxs("div",{className:"mb-6 rounded-xl border border-amber-400/30 bg-amber-400/10 px-5 py-4 text-sm text-amber-700 dark:text-amber-200 flex items-start gap-3",children:[e.jsx(P,{className:"w-5 h-5 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Abonnement annulé"}),e.jsxs("div",{children:["Votre plan ",S[a.plan]," reste actif jusqu'au ",F(a),". Après cette date, votre compte repassera automatiquement en FREE."]})]})]}),a?.pendingPlan&&e.jsxs("div",{className:"mb-6 rounded-xl border border-primary/30 bg-primary/10 px-5 py-4 text-sm text-primary flex items-start gap-3",children:[e.jsx(v,{className:"w-5 h-5 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Changement de plan programmé"}),e.jsxs("div",{children:["Downgrade vers ",S[a.pendingPlan]," prévu le ",z(a),"."]})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx($,{className:"w-4 h-4 text-primary"}),r("dashboard.quota.title")]}),a&&e.jsxs(A,{variant:"outline",className:`text-xs border-current ${ae[a.plan]}`,children:[e.jsx(U,{className:"w-3 h-3 mr-1"}),se[a.plan]]})]}),b?e.jsx("div",{className:"flex items-center justify-center h-24",children:e.jsx(f,{className:"w-6 h-6 text-primary animate-spin"})}):a?(()=>{const s=a.percentUsed??0,t=s>=80&&s<100,l=s>=100,u=l?"bg-red-500":t?"bg-amber-400":"bg-primary";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative flex items-center justify-center mb-4",children:[e.jsxs("svg",{viewBox:"0 0 120 70",className:"w-40 h-24",children:[e.jsx("path",{d:"M 10 65 A 50 50 0 0 1 110 65",fill:"none",stroke:"oklch(0.22 0.02 240)",strokeWidth:"10",strokeLinecap:"round"}),e.jsx("path",{d:"M 10 65 A 50 50 0 0 1 110 65",fill:"none",stroke:l?"#ef4444":t?"#f59e0b":"oklch(0.72 0.18 200)",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${Math.PI*50}`,strokeDashoffset:`${Math.PI*50*(1-Math.min(s,100)/100)}`,style:{transition:"stroke-dashoffset 0.6s ease"}})]}),e.jsxs("div",{className:"absolute bottom-1 text-center",children:[e.jsx("div",{className:`text-3xl font-black ${l?"text-red-400":t?"text-amber-400":"text-primary"}`,children:a.remaining}),e.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight",children:"restantes"})]})]}),e.jsx("div",{className:"w-full bg-border/40 rounded-full h-1.5 mb-2",children:e.jsx("div",{className:`h-1.5 rounded-full transition-all duration-500 ${u}`,style:{width:`${Math.min(s,100)}%`}})}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-3",children:[e.jsxs("span",{children:[a.analysesUsedThisMonth," utilisées"]}),e.jsxs("span",{children:[a.quota," total"]})]}),l&&e.jsxs("div",{className:"rounded-lg bg-red-500/10 border border-red-500/30 p-3 mb-3 text-xs text-red-400",children:[e.jsx("strong",{children:"Quota épuisé !"})," Passez à un plan supérieur pour continuer."]}),t&&e.jsxs("div",{className:"rounded-lg bg-amber-400/10 border border-amber-400/30 p-3 mb-3 text-xs text-amber-400",children:[e.jsx("strong",{children:"Bientôt limité !"})," Il vous reste ",a.remaining," analyse",a.remaining>1?"s":"","."]}),a.plan!=="business"&&e.jsx(d,{href:C,children:e.jsxs(o,{variant:"outline",size:"sm",className:`w-full gap-2 ${l?"border-red-500/40 text-red-400 hover:bg-red-500/10":t?"border-amber-400/40 text-amber-400 hover:bg-amber-400/10":"border-primary/30 text-primary hover:bg-primary/10"}`,children:[e.jsx(v,{className:"w-3.5 h-3.5"}),l?"Mettre à niveau maintenant":"Passer au plan supérieur"]})})]})})():null]}),a&&e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-primary"}),"Quota vidéo"]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["max ",Math.round((a.videoMaxDurationSec??0)/60)," min/clip"]})]}),a.videoQuota===0&&a.bonusVideoCredits===0?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Plan ",(a.plan??"free").toUpperCase()," : pas de vidéo incluse. Achetez à l'unité pour tester (5 €)."]}),e.jsx(d,{href:C,children:e.jsxs(o,{variant:"outline",size:"sm",className:"w-full gap-2",children:[e.jsx(v,{className:"w-3.5 h-3.5"}),"Acheter à l'unité"]})})]}):(()=>{const s=Math.max(0,(a.videoQuota??0)-(a.videoUsed??0)),t=a.videoRemaining??0,l=a.bonusVideoCredits??0,u=a.videoPercentUsed??0,y=s===0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-1.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-3xl font-black text-primary",children:t}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"vidéos restantes"})]}),l>0&&e.jsxs(A,{variant:"outline",className:"border-cyan-500/40 text-primary text-[10px]",children:["+",l," à l'unité"]})]}),e.jsx("div",{className:"w-full bg-border/40 rounded-full h-1.5 mb-2",children:e.jsx("div",{className:`h-1.5 rounded-full transition-all duration-500 ${y?"bg-amber-400":"bg-cyan-400"}`,style:{width:`${Math.min(u,100)}%`}})}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[a.videoUsed??0," utilisées"]}),e.jsxs("span",{children:[a.videoQuota??0," plan"]})]})]})})()]}),e.jsx(ee,{})]}),"            ",e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card p-6",children:[e.jsxs("h2",{className:"font-semibold mb-4 flex items-center gap-2",children:[e.jsx(w,{className:"w-4 h-4 text-primary"}),"Distribution des verdicts"]}),x?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(f,{className:"w-6 h-6 text-primary animate-spin"})}):h.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Z,{width:"100%",height:140,children:e.jsxs(K,{children:[e.jsx(X,{data:h,cx:"50%",cy:"50%",innerRadius:40,outerRadius:60,paddingAngle:3,dataKey:"value",children:h.map((s,t)=>e.jsx(J,{fill:s.color},t))}),e.jsx(Y,{contentStyle:{background:"oklch(0.14 0.018 240)",border:"1px solid oklch(0.22 0.02 240)",borderRadius:"8px",color:"oklch(0.95 0.01 240)"}})]})}),e.jsx("div",{className:"flex justify-center gap-4 mt-2",children:h.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{background:s.
1color}}),e.jsxs("span",{className:"text-muted-foreground",children:[s.name," (",s.value,")"]})]},s.name))})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground text-sm",children:[e.jsx(w,{className:"w-8 h-8 mb-2 opacity-30"}),"Aucune donnée disponible"]})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card p-6",children:[e.jsx("h2",{className:"font-semibold mb-4",children:r("dashboard.newAnalysis")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(d,{href:"/upload",children:e.jsxs(o,{className:"w-full justify-between gap-2",variant:"outline",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"w-4 h-4 text-primary"}),r("dashboard.newAnalysis")]}),e.jsx(p,{className:"w-4 h-4"})]})}),e.jsx(d,{href:"/history",children:e.jsxs(o,{className:"w-full justify-between gap-2",variant:"outline",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4 text-primary"}),r("dashboard.viewHistory")]}),e.jsx(p,{className:"w-4 h-4"})]})}),e.jsx(d,{href:C,children:e.jsxs(o,{className:"w-full justify-between gap-2",variant:"outline",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4 text-amber-400"}),r("dashboard.managePlan")]}),e.jsx(p,{className:"w-4 h-4"})]})})]})]})]}),e.jsxs("div",{className:"mt-6 rounded-xl border border-border/60 bg-card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4 text-primary"}),r("dashboard.recent.title")]}),e.jsx(d,{href:"/history",children:e.jsxs(o,{variant:"ghost",size:"sm",className:"gap-1 text-primary hover:text-primary",children:[r("common.viewAll")," ",e.jsx(p,{className:"w-3.5 h-3.5"})]})})]}),j?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(f,{className:"w-6 h-6 text-primary animate-spin"})}):m?.items.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(g,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{className:"font-medium mb-1",children:r("dashboard.recent.empty")}),e.jsx("p",{className:"text-sm mb-4",children:r("dashboard.stats.noData")}),e.jsx(d,{href:"/upload",children:e.jsxs(o,{size:"sm",className:"gap-2",children:[e.jsx(g,{className:"w-3.5 h-3.5"}),r("dashboard.newAnalysis")]})})]}):e.jsx("div",{className:"space-y-2",children:m?.items.map(s=>{const t={real:{label:"Probablement Réel",color:"text-emerald-400",bg:"bg-emerald-500/10",border:"border-emerald-500/30"},suspicious:{label:"Suspect",color:"text-amber-400",bg:"bg-amber-500/10",border:"border-amber-500/30"},ai_generated:{label:"Probablement IA",color:"text-red-400",bg:"bg-red-500/10",border:"border-red-500/30"}},l=t[s.verdict]??t.suspicious;return e.jsx(d,{href:`/results/${s.id}`,children:e.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-border/40 hover:border-primary/30 hover:bg-primary/5 transition-all cursor-pointer group",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-secondary flex items-center justify-center shrink-0",children:e.jsx(L,{className:"w-5 h-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium truncate text-sm",children:s.fileName??"Image"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.createdAt?new Date(s.createdAt).toLocaleDateString("fr-FR",{day:"2-digit",month:"2-digit",year:"numeric"}):"—"})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx(A,{variant:"outline",className:`text-xs ${l.border} ${l.color} ${l.bg}`,children:l.label}),e.jsxs("span",{className:"text-sm font-mono font-semibold text-muted-foreground",children:[s.scoreFinal??0,"/100"]}),e.jsx(p,{className:"w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors"})]})]})},s.id)})})]})]})})})}export{ve as default};

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.