PageSourceSearch

https://skrotahusvagn.lovable.app/assets/GscTrendsTab-Cru71_96.js

js skrotahusvagn.lovable.app collected 2026-10-03 03:48:42 UTC 4,604 bytes, 1 lines download raw bytes

1import{b as F,j as s}from"./react-vendor-zBl7e66q.js";import{u as y,a as T}from"./useGscSnapshots-DnC9XkTx.js";import{B as V,h as t,j as i,m as o,k as n,i as x,S as N}from"./index-DDJP99TE.js";import{B as Y}from"./badge-B6PfYjAf.js";import{ay as P,Y as X}from"./icons-ddqYUsFI.js";import{R as b,m as C,X as L,Y as m,T as K,n as S}from"./generateCategoricalChart-iQL_5rf8.js";import{L as I}from"./LineChart-DxToTGFH.js";import{L as l}from"./Line-Blrg2Q85.js";import"./query-CqHJrFw1.js";import"./supabase-CPiqIBkr.js";import"./radix-BsWLCLsF.js";import"./date-fns-DKRY5Ax4.js";import"./router-DxihJGWf.js";import"./framer-CVxE5Mud.js";import"./forms-BZpIKt6_.js";import"./index-DYCccshK.js";const w=e=>e.slice(5),ns=()=>{var g,j,p,k;const{data:e,isLoading:A}=y({searchType:"web",days:90}),{data:a,isLoading:B}=y({searchType:"image",days:90}),d=T(),r=F.useMemo(()=>{const u=e!=null?e:[],f=u.slice(-7),D=u.slice(-14,-7),c=(R,W)=>R.reduce((H,E)=>H+E[W],0),v=c(f,"clicks"),h=c(D,"clicks"),G=h>0?(v-h)/h*100:0;return{lastClicks:v,lastImpressions:c(f,"impressions"),change:G}},[e]);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[s.jsx(P,{className:"h-5 w-5"}),"Historiska Google-trender"]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Lagrad data från Google Search Console (90 dagar)"})]}),s.jsxs(V,{size:"sm",variant:"outline",onClick:()=>d.mutate(7),disabled:d.isPending,children:[s.jsx(X,{className:`h-4 w-4 mr-2 ${d.isPending?"animate-spin":""}`}),"Hämta 7 dagar"]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[s.jsxs(t,{children:[s.jsxs(i,{className:"pb-2",children:[s.jsx(o,{children:"Klick (senaste 7d)"}),s.jsx(n,{className:"text-2xl",children:r.lastClicks.toLocaleString("sv-SE")})]}),s.jsx(x,{children:s.jsxs(Y,{variant:r.change>=0?"default":"destructive",children:[r.change>=0?"+":"",r.change.toFixed(1),"% vs föreg. vecka"]})})]}),s.jsx(t,{children:s.jsxs(i,{className:"pb-2",children:[s.jsx(o,{children:"Visningar (senaste 7d)"}),s.jsx(n,{className:"text-2xl",children:r.lastImpressions.toLocaleString("sv-SE")})]})}),s.jsx(t,{children:s.jsxs(i,{className:"pb-2",children:[s.jsx(o,{children:"Datapunkter lagrade"}),s.jsx(n,{className:"text-2xl",children:((g=e==null?void 0:e.length)!=null?g:0)+((j=a==null?void 0:a.length)!=null?j:0)})]})})]}),s.jsxs(t,{children:[s.jsx(i,{children:s.jsx(n,{children:"Webbsök — klick & visningar"})}),s.jsx(x,{children:A?s.jsx(N,{className:"h-[300px] w-full"}):((p=e==null?void 0:e.length)!=null?p:0)===0?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:'Inga snapshots ännu. Klicka "Hämta 7 dagar" för att starta insamlingen.'}):s.jsx(b,{width:"100%",height:300,children:s.jsxs(I,{data:e,children:[s.jsx(C,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),s.jsx(L,{dataKey:"data_date",tickFormatter:w,stroke:"hsl(var(--muted-foreground))"}),s.jsx(m,{yAxisId:"left",stroke:"hsl(var(--primary))"}),s.jsx(m,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))"}),s.jsx(K,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))"}}),s.jsx(S,{}),s.jsx(l,{yAxisId:"left",type:"monotone",dataKey:"clicks",stroke:"hsl(var(--primary))",name:"Klick",strokeWidth:2,dot:!1}),s.jsx(l,{yAxisId:"right",type:"monotone",dataKey:"impressions",stroke:"hsl(var(--muted-foreground))",name:"Visningar",strokeWidth:1,dot:!1})]})})})]}),s.jsxs(t,{children:[s.jsxs(i,{children:[s.jsx(n,{children:"Bildsök — klick & visningar"}),s.jsx(o,{children:"Trafik från Google Bildsök"})]}),s.jsx(x,{children:B?s.jsx(N,{className:"h-[250px] w-full"}):((k=a==null?void 0:a.length)!=null?k:0)===0?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"Ingen bildsök-data ännu."}):s.jsx(b,{width:"100%",height:250,children:s.jsxs(I,{data:a,children:[s.jsx(C,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),s.jsx(L,{dataKey:"data_date",tickFormatter:w,stroke:"hsl(var(--muted-foreground))"}),s.jsx(m,{stroke:"hsl(var(--accent-foreground))"}),s.jsx(K,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))"}}),s.jsx(S,{}),s.jsx(l,{type:"monotone",dataKey:"clicks",stroke:"hsl(var(--accent-foreground))",name:"Klick",strokeWidth:2,dot:!1}),s.jsx(l,{type:"monotone",dataKey:"impressions",stroke:"hsl(var(--muted-foreground))",name:"Visningar",strokeWidth:1,dot:!1})]})})})]})]})};export{ns 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.