PageSourceSearch

https://skrotahusvagn.lovable.app/assets/ExplodedViewsContentEditor-B1VTvWlm.js

js skrotahusvagn.lovable.app collected 2026-10-03 03:48:58 UTC 7,122 bytes, 1 lines download raw bytes

1var J=Object.defineProperty,M=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var Q=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var F=(a,l,c)=>l in a?J(a,l,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[l]=c,o=(a,l)=>{for(var c in l||(l={}))Q.call(l,c)&&F(a,c,l[c]);if(k)for(var c of k(l))U.call(l,c)&&F(a,c,l[c]);return a},d=(a,l)=>M(a,H(l));import{r as p,j as e}from"./react-vendor-zBl7e66q.js";import{h as V,j as Y,k as D,B as G,i as $,L as n,I as u,T as j,J as A,c as b}from"./index-DDJP99TE.js";import{A as z,a as C,b as S,c as w}from"./accordion-B4Dic8o5.js";import{u as P,D as W}from"./useExplodedViewsContent-CTx6Jfgi.js";import{a as X}from"./query-CqHJrFw1.js";import{L as Z,aR as ee}from"./icons-ddqYUsFI.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";const T=["fridge","window","rooflight","awning","heater","stove","mover"],te={fridge:"Kylskåp",window:"Fönster",rooflight:"Takluckor",awning:"Markiser",heater:"Värmesystem",stove:"Spis & Kök",mover:"Mover"},pe=()=>{const{data:a,isLoading:l}=P(),c=X(),[B,L]=p.useState(!1),[_,y]=p.useState({title:"",description:""}),[g,v]=p.useState({title:"",subtitle:"",badge_text:"",sub_badge:""}),[h,O]=p.useState({}),[N,E]=p.useState([]),[m,q]=p.useState({title:"",content:"",faq:""});p.useEffect(()=>{if(!a)return;y(a.meta),v(a.hero);const t={};for(const s of T){const i=a.categories[s];t[s]={title:i.title,description:i.description,alt:i.alt,brands:i.brands.join(", "),image_url:i.image_url||""}}O(t),E(a.steps.map(s=>({title:s.title,description:s.description}))),q({title:a.seo.title,content:a.seo.content,faq:JSON.stringify(a.seo.faq,null,2)})},[a]);const K=async()=>{if(!(a!=null&&a.pageId)){A.error("Ingen sida hittad i databasen");return}L(!0);try{await b.from("pages").update({title:_.title,meta_description:_.description}).eq("id",a.pageId),a.sectionIds.hero&&await b.from("page_sections").update({title:g.title,content:g.subtitle,settings:{badge_text:g.badge_text,sub_badge:g.sub_badge}}).eq("id",a.sectionIds.hero);for(const t of T){const s=a.sectionIds[`category-${t}`];if(s&&h[t]){const i=h[t],r=W.categories[t];await b.from("page_sections").update({title:i.title,content:i.description,settings:{alt:i.alt,brands:i.brands.split(",").map(I=>I.trim()).filter(Boolean),path:r.path,image_url:i.image_url}}).eq("id",s)}}if(a.sectionIds.steps&&await b.from("page_sections").update({settings:{items:N}}).eq("id",a.sectionIds.steps),a.sectionIds["seo-content"]){let t=[];try{t=JSON.parse(m.faq)}catch(s){t=[]}await b.from("page_sections").update({title:m.title,content:m.content,settings:{faq:t}}).eq("id",a.sectionIds["seo-content"])}c.invalidateQueries({queryKey:["exploded-views-content"]}),A.success("Innehållet har sparats")}catch(t){console.error(t),A.error("Kunde inte spara")}finally{L(!1)}};if(l)return e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto my-8"});const f=(t,s,i)=>{O(r=>d(o({},r),{[t]:d(o({},r[t]),{[s]:i})}))};return e.jsxs(V,{children:[e.jsxs(Y,{className:"flex flex-row items-center justify-between",children:[e.jsx(D,{children:"Sidinnehåll – Sprängskisser"}),e.jsxs(G,{onClick:K,disabled:B,children:[B?e.jsx(Z,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ee,{className:"mr-2 h-4 w-4"}),"Spara alla ändringar"]})]}),e.jsx($,{children:e.jsxs(z,{type:"multiple",defaultValue:["meta","hero"],className:"space-y-2",children:[e.jsxs(C,{value:"meta",children:[e.jsx(S,{children:"SEO-metadata (title & description)"}),e.jsxs(w,{className:"space-y-3 pt-2",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Sidtitel (title-tag)"}),e.jsx(u,{value:_.title,onChange:t=>y(s=>d(o({},s),{title:t.target.value}))})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Meta description"}),e.jsx(j,{value:_.description,onChange:t=>y(s=>d(o({},s),{description:t.target.value})),rows:2})]})]})]}),e.jsxs(C,{value:"hero",children:[e.jsx(S,{children:"Hero-sektion"}),e.jsxs(w,{className:"space-y-3 pt-2",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Rubrik (H1)"}),e.jsx(u,{value:g.title,onChange:t=>v(s=>d(o({},s),{title:t.target.value}))})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Undertext"}),e.jsx(j,{value:g.subtitle,onChange:t=>v(s=>d(o({},s),{subtitle:t.target.value})),rows:2})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Badge-text"}),e.jsx(u,{value:g.badge_text,onChange:t=>v(s=>d(o({},s),{badge_text:t.target.value}))})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Under-badge"}),e.jsx(u,{value:g.sub_badge,onChange:t=>v(s=>d(o({},s),{sub_badge:t.target.value}))})]})]})]})]}),T.map(t=>{var s,i,r,I,R;return e.jsxs(C,{value:`cat-${t}`,children:[e.jsxs(S,{children:["Kategori: ",te[t]]}),e.jsxs(w,{className:"space-y-3 pt-2",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Titel"}),e.jsx(u,{value:((s=h[t])==null?void 0:s.title)||"",onChange:x=>f(t,"title",x.target.value)})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Beskrivning"}),e.jsx(j,{value:((i=h[t])==null?void 0:i.description)||"",onChange:x=>f(t,"description",x.target.value),rows:2})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Bild-URL (lämna tomt för standardbild)"}),e.jsx(u,{value:((r=h[t])==null?void 0:r.image_url)||"",onChange:x=>f(t,"image_url",x.target.value),placeholder:"https://img.skrotahusvagn.com/..."})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Alt-text"}),e.jsx(u,{value:((I=h[t])==null?void 0:I.alt)||"",onChange:x=>f(t,"alt",x.target.value)})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Märken (kommaseparerade)"}),e.jsx(u,{value:((R=h[t])==null?void 0:R.brands)||"",onChange:x=>f(t,"brands",x.target.value)})]})]})]},t)}),e.jsxs(C,{value:"steps",children:[e.jsx(S,{children:"Steg-sektion"}),e.jsx(w,{className:"space-y-4 pt-2",children:N.map((t,s)=>e.jsxs("div",{className:"space-y-2 p-3 rounded-lg bg-muted/30 border",children:[e.jsxs(n,{className:"font-semibold",children:["Steg ",s+1]}),e.jsx(u,{value:t.title,onChange:i=>
1{const r=[...N];r[s]=d(o({},r[s]),{title:i.target.value}),E(r)},placeholder:"Titel"}),e.jsx(j,{value:t.description,onChange:i=>{const r=[...N];r[s]=d(o({},r[s]),{description:i.target.value}),E(r)},rows:2,placeholder:"Beskrivning"})]},s))})]}),e.jsxs(C,{value:"seo",children:[e.jsx(S,{children:"SEO-brödtext & FAQ"}),e.jsxs(w,{className:"space-y-3 pt-2",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Rubrik"}),e.jsx(u,{value:m.title,onChange:t=>q(s=>d(o({},s),{title:t.target.value}))})]}),e.jsxs("div",{children:[e.jsx(n,{children:"Brödtext"}),e.jsx(j,{value:m.content,onChange:t=>q(s=>d(o({},s),{content:t.target.value})),rows:6})]}),e.jsxs("div",{children:[e.jsx(n,{children:"FAQ (JSON-format)"}),e.jsx(j,{value:m.faq,onChange:t=>q(s=>d(o({},s),{faq:t.target.value})),rows:8,className:"font-mono text-xs"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Format: [","{",'"q": "Fråga?", "a": "Svar"',"}","]"]})]})]})]})]})})]})};export{pe 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.