PageSourceSearch

https://fitnessprofi.lovable.app/assets/QuickAdd-Bt6_ZCDy.js

js fitnessprofi.lovable.app collected 2026-10-03 03:31:55 UTC 5,886 bytes, 6 lines download raw bytes

1import{c as $,u as A,d as G,a as H,r as u,j as e,X as w,s as p}from"./index-DfbPMtFZ.js";import{B as h,I as C,C as V}from"./Combination-DdoM_vzj.js";import{T as R}from"./textarea-B6myJTMQ.js";import{L as c}from"./label-BPIIdxfs.js";import{S as F,a as S,b as z,c as k,d as E}from"./select-BpTHHfDC.js";import{s as I}from"./sanitize-DeERsSn4.js";import"./index-BdQq_4o_.js";import"./index-DL1OQS8_.js";import"./chevron-down-B7uBTmvX.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const U=$("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]),ee=()=>{const g=A(),{user:o}=G(),{toast:i}=H(),[x,d]=u.useState(!1),[r,f]=u.useState([]),m=u.useRef(null),[s,l]=u.useState({title:"",price:"",category:"",size:"",condition:"gebraucht",description:""}),L=["Hanteln & Gewichte","Kraftstationen","Cardiogeräte","Yoga & Pilates","Crossfit","Kampfsport","Zubehör"],q=["S","M","L","XL","Einheitsgröße"],B=async t=>{const a=t.target.files;if(!(!a||!o)){d(!0);try{const n=Array.from(a).map(async v=>{var N;const K=((N=v.name.split(".").pop())==null?void 0:N.toLowerCase())||"jpg",b=`${o.id}/${Date.now()}.${K}`,{error:y}=await p.storage.from("listing-images").upload(b,v);if(y)throw y;const{data:{publicUrl:P}}=p.storage.from("listing-images").getPublicUrl(b);return P}),j=await Promise.all(n);f([...r,...j]),i({title:"Fotos hochgeladen",description:`${j.length} Foto(s) hinzugefügt`})}catch(n){console.error("Error uploading images:",n),i({title:"Fehler",description:"Fehler beim Hochladen der Fotos",variant:"destructive"})}finally{d(!1),m.current&&(m.current.value="")}}},T=t=>{f(r.filter((a,n)=>n!==t))},D=async t=>{if(t.preventDefault(),!o){i({title:"Nicht angemeldet",description:"Bitte melden Sie sich an",variant:"destructive"});return}if(r.length===0){i({title:"Kein Foto",description:"Bitte fügen Sie mindestens ein Foto hinzu",variant:"destructive"});return}d(!0);try{const{error:a}=await p.from("listings").insert({user_id:o.id,title:I(s.title),description:I(s.description),price:parseFloat(s.price),category:s.category,size:s.size,condition:s.condition,images:r,status:"active",quantity:1});if(a)throw a;i({title:"Erfolgreich!",description:"Angebot erstellt"}),g("/dashboard")}catch(a){console.error("Error creating listing:",a),i({title:"Fehler",description:"Fehler beim Erstellen",variant:"destructive"})}finally{d(!1)}};return e.jsxs("div",{className:"min-h-screen bg-background pb-20",children:[e.jsx("div",{className:"sticky top-0 z-10 bg-primary text-primary-foreground p-4 shadow-md",children:e.jsxs("div",{className:"flex items-center justify-between max-w-md mx-auto",children:[e.jsx(h,{variant:"ghost",size:"icon",onClick:()=>g(-1),className:"text-primary-foreground hover:bg-primary-foreground/20",children:e.jsx(w,{className:"w-6 h-6"})}),e.jsx("h1",{className:"text-lg font-bold",children:"Schnell Einstellen"}),e.jsx("div",{className:"w-10"})]})}),e.jsxs("form",{onSubmit:D,className:"max-w-md mx-auto p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{ref:m,type:"file",accept:"image/*",capture:"environment",multiple:!0,onChange:B,className:"hidden"}),e.jsx(h,{type:"button",onClick:()=>{var t;return(t=m.current)==null?void 0:t.click()},className:"w-full h-32 bg-accent/10 hover:bg-accent/20 border-2 border-dashed border-accent",variant:"outline",disabled:x,children:e.jsxs("div",{className:"text-center",children:[e.jsx(U,{className:"w-12 h-12 mx-auto mb-2 text-accent"}),e.jsx("p",{className:"text-sm font-medium",children:"Foto aufnehmen"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[r.length," Foto(s)"]})]})}),r.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:r.map((t,a)=>e.jsxs("div",{className:"relative aspect-square",children:[e.jsx("img",{src:t,alt:`Foto ${a+1}`,className:"w-full h-full object-cover rounded-lg"}),e.jsx(h,{type:"button",variant:"destructive",size:"icon",className:"absolute -top-2 -right-2 w-6 h-6 rounded-full",onClick:()=>T(a),children:e.jsx(w,{className:"w-4 h-4"})})]},a))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"title",children:"Titel *"}),e.jsx(C,{id:"title",value:s.title,onChange:t=>l({...s,title:t.target.value}),placeholder:"z.B. Hantelbank inkl. Gewichte",required:!0,className:"text-base"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"price",children:"Preis (€) *"}),e.jsx(C,{id:"price",type:"number",step:"0.01",value:s.price,onChange:t=>l({...s,price:t.target.value}),placeholder:"0.00",required:!0,className:"text-base"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{children:"Kategorie *"}),e.jsxs(F,{value:s.category,onValueChange:t=>l({...s,category:t}),required:!0,children:[e.jsx(S,{className:"text-base",children:e.jsx(z,{placeholder:"Kategorie wählen"})}),e.jsx(k,{children:L.map(t=>e.jsx(E,{value:t,children:t},t))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{children:"Größe *"}),e.jsxs(F,{value:s.size,onValueChange:t=>l({...s,size:t}),required:!0,children:[e.jsx(S,{className:"text-base",children:e.jsx(z,{placeholder:"Größe wählen"})}),e.jsx(k,{children:q.map(t=>e.jsx(E,{value:t,children:t},t))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"description",children:"Beschreibung (optional)"}),e.jsx(R,{id:"description",value:s.description,onChange:t=>l({...s,description:t.target.value}),placeholder:"Weitere Details...",rows:3,className:"text-base resize-none"})]}),e.jsxs(h,{type:"submit",className:"w-full h-14 text-lg font-semibold",disabled:x||r.length===0,children:[e.jsx(V,{className:"w-5 h-5 mr-2"}),"Jetzt einstellen"]})]})]})};export{ee 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.