PageSourceSearch

https://fitnessprofi.lovable.app/assets/ListingDetail-g1HyFZ6f.js

js fitnessprofi.lovable.app collected 2026-10-03 03:31:36 UTC 7,879 bytes, 1 lines download raw bytes

1import{k as S,u as $,a as D,d as L,r as l,j as e,s as f}from"./index-DfbPMtFZ.js";import{H as F,B as E,e as I,F as B}from"./Footer-DkkU8vMF.js";import{B as c}from"./Combination-DdoM_vzj.js";import{C as o,b as m,c as x,d as z,a as u}from"./card-DN9U93Ar.js";import{S as T}from"./SEOHead-CT9CEd2t.js";import{L as A}from"./LikeButton-hgR9MF0H.js";import{U as H}from"./UserProfileCard-CEg7RsTs.js";import{c as P,b as V}from"./seoData-Zu0mqGag.js";import{A as M}from"./arrow-left-CSjVKsEU.js";import{C as j,S as R,T as U,R as Z,D as q}from"./tag-_WCX-uBx.js";import{M as G}from"./map-pin-BpPyR111.js";import{C as K}from"./calendar-AeHpRayc.js";import"./shield-gTmsYmaS.js";import"./useSocial-8SE6rbm7.js";import"./avatar-BJUSXNbd.js";import"./user-minus-BXoCHMTn.js";import"./dialog-CUfzLZNo.js";import"./textarea-B6myJTMQ.js";import"./label-BPIIdxfs.js";import"./select-BpTHHfDC.js";import"./index-BdQq_4o_.js";import"./index-DL1OQS8_.js";import"./chevron-down-B7uBTmvX.js";import"./useSecurity-BIHYjOoC.js";const je=()=>{var p;const{id:d}=S(),r=$(),{toast:n}=D(),{user:i}=L(),[s,N]=l.useState(null),[v,b]=l.useState(!0),[h,w]=l.useState(0);l.useEffect(()=>{(async()=>{if(d)try{const{data:t,error:g}=await f.rpc("get_listing_with_location",{listing_id:d}).maybeSingle();if(g){console.error("Error fetching listing:",g),n({title:"Fehler",description:"Inserat konnte nicht geladen werden.",variant:"destructive"}),r("/dashboard");return}if(!t){n({title:"Nicht gefunden",description:"Das Inserat wurde nicht gefunden.",variant:"destructive"}),r("/dashboard");return}N(t),k(t.id)}catch(t){console.error("Error fetching listing:",t),n({title:"Fehler",description:"Ein Fehler ist aufgetreten.",variant:"destructive"}),r("/")}finally{b(!1)}})()},[d,r,n]);const k=async a=>{try{await f.functions.invoke("track-listing-view",{body:{listing_id:a}})}catch(t){console.log("Could not track view:",t)}},y=async()=>{const a=window.location.href;if(navigator.share)try{await navigator.share({title:s==null?void 0:s.title,text:`Schau dir dieses Fitness-Gerät an: ${s==null?void 0:s.title}`,url:a})}catch(t){console.log("Error sharing:",t)}else navigator.clipboard.writeText(a),n({title:"Link kopiert!",description:"Der Link wurde in die Zwischenablage kopiert."})};if(v)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"Lade Inserat..."})]})});if(!s)return null;const C=[{name:"Home",url:"/"},{name:"Suchen",url:"/search"},{name:s.title,url:`/listing/${s.id}`}],_=[P(s),V(C)];return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(T,{title:`${s.title} - €${s.price} - Fitnessprofi`,description:`${s.description.substring(0,150)}... Jetzt auf Fitnessprofi kaufen!`,keywords:`${s.title}, ${s.category}, fitnessgerät kaufen, ${s.condition||"gebraucht"}`,structuredData:_,canonicalUrl:`https://fitnessprofi.at/listing/${s.id}`,ogImage:(p=s.images)==null?void 0:p[0],ogType:"product"}),e.jsx(F,{}),e.jsxs("main",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-6",children:e.jsxs(c,{variant:"ghost",onClick:()=>r("/dashboard"),className:"mb-4",children:[e.jsx(M,{className:"w-4 h-4 mr-2"}),"Zurück zum Dashboard"]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsx("div",{className:"space-y-4",children:s.images&&s.images.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted",children:e.jsx("img",{src:s.images[h],alt:s.title,className:"w-full h-full object-cover"})}),s.images.length>1&&e.jsx("div",{className:"flex space-x-2 overflow-x-auto pb-2",children:s.images.map((a,t)=>e.jsx("button",{onClick:()=>w(t),className:`flex-shrink-0 w-20 h-20 rounded-md overflow-hidden border-2 ${t===h?"border-primary":"border-transparent"}`,children:e.jsx("img",{src:a,alt:`${s.title} ${t+1}`,className:"w-full h-full object-cover"})},t))})]}):e.jsx("div",{className:"aspect-square rounded-lg bg-muted flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(j,{className:"w-12 h-12 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-muted-foreground",children:"Keine Bilder verfügbar"})]})})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(o,{children:[e.jsx(m,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(x,{className:"text-2xl",children:s.title}),e.jsxs(z,{className:"text-xl font-semibold text-primary mt-1",children:["€",s.price.toFixed(2),s.shipping_price&&s.shipping_price>0&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground ml-2",children:["+ €",s.shipping_price.toFixed(2)," Versand"]}),(!s.shipping_price||s.shipping_price===0)&&e.jsx("span",{className:"text-sm font-normal text-green-600 ml-2",children:"Versandkostenfrei"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(A,{listingId:s.id}),e.jsx(c,{variant:"outline",size:"icon",onClick:y,children:e.jsx(R,{className:"w-4 h-4"})}),e.jsx(E,{variant:s.status==="active"?"default":"secondary",children:s.status==="active"?"Aktiv":"Verkauft"})]})]})}),e.jsx(u,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(U,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Kategorie:"}),e.jsx("span",{className:"text-sm font-medium",children:s.category})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Z,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Größe:"}),e.jsx("span",{className:"text-sm font-medium",children:s.size})]}),s.condition&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(j,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Zustand:"}),e.jsx("span",{className:"text-sm font-medium",children:s.condition})]}),(s.display_location||s.location)&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(G,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Standort:"}),e.jsx("span",{className:"text-sm font-medium",children:s.display_location||s.location})]}),e.jsxs("div",{className:"flex items-center space-x-2 col-span-2",children:[e.jsx(K,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Erstellt:"}),e.jsx("span",{className:"text-sm font-medium",children:new Date(s.created_at).toLocaleDateString("de-DE")})]})]})})]}),e.jsxs(o,{children:[e.jsx(m,{children:e.jsx(x,{children:"Beschreibung"})}),e.jsx(u,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})})]}),s.user_id&&s.user_id!==(i==null?void 0:i.id)&&e.jsxs(o,{children:[e.jsx(m,{children:e.jsx(x,{children:"Verkäufer"})}),e.jsx(u,{children:e.jsx(H,{userId:s.user_id})})]}),i&&s.user_id===i.id?e.jsx("div",{className:"flex space-x-4",children:e.jsx(c,{onClick:()=>r(`/edit-listing/${s.id}`),className:"flex-1",children:"Bearbeiten"})}):e.jsxs("div",{className:"flex flex-col space-y-3",children:[e.jsxs(c,{onClick:()=>
1{if(!i){r("/auth");return}r("/messages")},className:"w-full",size:"lg",children:[e.jsx(I,{className:"w-4 h-4 mr-2"}),"Nachricht senden"]}),e.jsxs(c,{onClick:()=>r(`/buy/${s.id}`),variant:"outline",className:"w-full",size:"lg",children:[e.jsx(q,{className:"w-4 h-4 mr-2"}),"Preisvorschlag machen"]})]})]})]})]}),e.jsx(B,{})]})};export{je 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.