Files
boc/backups/2026-07-12-1023/landvex-prod/assets/CreateMission-8331plbz.js
T

22 lines
26 KiB
JavaScript
Raw Normal View History

import{o as U,r,j as e,x as h,ag as p,ah as j,ak as N,y as g,A as ye,v as M,q as D,L as Z,X as ze,I as T,z as E,a as Be,u as $e,p as He,n as Ge,ai as K,B as Ne,T as Ye,s as c,aR as Q,M as Ke,al as X,C as Qe,S as Xe,aj as We,w as P}from"./index-oAPVDf-r.js";import{A as Ze}from"./index-B-MEeiYV.js";import{U as Je}from"./upload-LLBu8Q_P.js";import{B as es}from"./badge-Qwi4CUXx.js";import{R as W,a as S}from"./radio-group-CcrlZGTP.js";import{S as ss,a as as,b as rs,c as ts,d as is}from"./select-Bi-TzF3J.js";import{A as ve}from"./arrow-left-m6EiMbb-.js";import{I as ns}from"./info-BT66tWy0.js";import{R as cs}from"./repeat-wK6OxTxo.js";import{C as ls}from"./calendar-Bof-SGwp.js";import{G as os}from"./gift-lxeNwCUB.js";import{M as ds}from"./megaphone-CztbyYca.js";import"./index-DGH-oZ97.js";import"./circle-030W8joh.js";import"./chevron-down-QDDHZwZg.js";import"./check-CG8zylH4.js";/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ms=U("BadgePercent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const us=U("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const be=U("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xs=U("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),hs=({goodExamples:s,onGoodExamplesChange:v})=>{const b=r.useRef(null),f=t=>{if(!t)return;const o=Array.from(t).map(l=>({id:crypto.randomUUID(),file:l,previewUrl:URL.createObjectURL(l),type:"good",caption:""}));v([...s,...o])},i=t=>{const o=s.filter(l=>l.id!==t);v(o)},d=(t,o)=>{const l=s.map(x=>x.id===t?{...x,caption:o}:x);v(l)};return e.jsxs(h,{className:"glass-card",children:[e.jsxs(p,{children:[e.jsxs(j,{className:"flex items-center gap-2",children:[e.jsx(be,{className:"w-5 h-5"}),"Example Images"]}),e.jsx(N,{children:"Upload images showing the photographer what good photos look like"})]}),e.jsx(g,{className:"space-y-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{className:"w-4 h-4 text-success"}),e.jsx("span",{className:"text-sm font-medium",children:"Good examples"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",s.length,")"]})]}),e.jsxs(M,{type:"button",variant:"outline",size:"sm",onClick:()=>{var t;return(t=b.current)==null?void 0:t.click()},className:"gap-1",children:[e.jsx(be,{className:"w-3 h-3"}),"Add"]}),e.jsx("input",{ref:b,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:t=>f(t.target.files)})]}),e.jsx(Ze,{children:s.length>0&&e.jsx(D.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"grid grid-cols-2 gap-3",children:s.map(t=>e.jsxs(D.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},className:"relative rounded-lg overflow-hidden border-2 border-success/30",children:[e.jsxs("div",{className:"aspect-[4/3] relative",children:[e.jsx("img",{src:t.previewUrl,alt:t.caption||"Example image",className:"w-full h-full object-cover"}),t.uploading&&e.jsx("div",{className:"absolute inset-0 bg-background/80 flex items-center justify-center",children:e.jsx(Z,{className:"w-6 h-6 animate-spin text-primary"})}),e.jsx(M,{type:"button",variant:"destructive",size:"icon",className:"absolute top-1 right-1 w-6 h-6",onClick:()=>i(t.id),children:e.jsx(ze,{className:"w-3 h-3"})})]}),e.jsx("div",{className:"p-2 bg-background",children:e.jsx(T,{placeholder:"Caption...",value:t.caption,onChange:o=>d(t.id,o.target.value),className:"h-8 text-xs"})})]},t.id))})}),s.length===0&&e.jsxs("div",{onClick:()=>{var t;return(t=b.current)==null?void 0:t.click()},className:"border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors hover:border-primary/50 border-success/20",children:[e.jsx(Je,{className:"w-8 h-8 mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to upload good examples"})]})]})})]})},ps=async(s,v,b)=>{const f=[...v.map((i,d)=>({...i,orderIndex:d})),...b.map((i,d)=>({...i,orderIndex:d}))];for(const i of f)if(i.file)try{const d=i.file.name.split(".").pop(),t=`${s}/${i.type}/${crypto.randomUUID()}.${d}`,{error:o}=await E.storage.from("mission-examples").upload(t,i.file,{cacheControl:"3600",upsert:!1});if(o){console.error("Upload error:",o);continue}const{data:{publicUrl:l}}=E.storage.from("mission-examples").getPublicUrl(t),{error:x}=await E.from("mission_example_images").insert({mission_id:s,image_url:l,image_type:i.type,caption:i.caption||null,order_index:i.orderIndex});x&&console.error("Database error:",x)}catch(d){console.error("Failed to upload image:",d)}return!0},qs=()=>{var he,pe,je,ge;const{t:s}=Be(),v=[{value:"once",label:s("createMission.frequencyOnce"),description:s("createMission.frequencyOnceDesc")},{value:"daily",label:s("createMission.frequencyDaily"),description:s("createMission.frequencyDailyDesc")},{value:"weekly",label:s("createMission.frequencyWeekly"),description:s("createMission.frequencyWeekly