PageSourceSearch

https://lesvacances.co.kr/assets/MyGuidebooksPage-B-u2WAQ-.js

js lesvacances.co.kr collected 2026-10-03 01:24:25 UTC 9,678 bytes, 1 lines download raw bytes

1import{r as n,j as e,B as x,J as v,I as M,w as k,ak as L,A as P,p as T}from"./index-BIjT-aNh.js";import{A as E,a as z,b as F,c as B,d as O,e as U,f as W,g as K,h as R}from"./alert-dialog-CmeDGxnw.js";import{u as _,m as $}from"./mockData-CE6CR3UX.js";import{fetchMyGuidebooks as H,softDeleteItem as J,SUB_COLLECTIONS as X}from"./myAccountService-CSYRfJ8q.js";import{A as Y}from"./arrow-left-DvZnGT50.js";import{T as q}from"./trash-2-CfrWiq-B.js";import{S as Q}from"./search-x-BNs_DB6R.js";import"./firebaseAuth-BbFzaUYv.js";import"./index.esm-dObGBr4t.js";function ce({onPageChange:g,previousPage:V}){const[o,b]=n.useState("all"),[c,N]=n.useState("date-desc"),[p,h]=n.useState([]),[Z,j]=n.useState(!1);n.useEffect(()=>{const s=async()=>{j(!0);try{const a=(await H()).map(t=>{const m=t.createdAt?.toDate?.()?.toISOString?.()||(typeof t.createdAt=="string"?t.createdAt:"")||"";return{id:t.id||t.itemId||"",itemId:t.itemId||t.id||"",type:t.type||"guidebook",title:t.title||"",city:t.cityName||"",cityName:t.cityName||"",cityCode:t.cityCode||"",country:t.country||"",image:t.thumbnail||"",thumbnail:t.thumbnail||"",destination:t.cityName||"",days:t.days||0,startDate:t.startDate||"",endDate:t.endD
1ate||"",description:t.description||"",status:t.isPublic?"공개":"비공개",isPublic:!!t.isPublic,pages:t.pages||0,tourInfo:t.tourInfo||[],memos:t.memos||{},theme:t.theme||"",createdAt:m}});console.log("☁️ [MyGuidebooksPage] Firestore에서",a.length,"개 로드"),h(a)}catch(l){console.error("❌ [MyGuidebooksPage] Firestore 로드 실패:",l),h([]),k.error("가이드북을 불러오지 못했습니다.")}finally{j(!1)}};s();const r=()=>{s()};return window.addEventListener("guidebooksUpdated",r),()=>{window.removeEventListener("guidebooksUpdated",r)}},[]);const{isEditMode:d,data:f,handleItemSelect:w,handleSelectAll:A,handleDeleteSelected:D,toggleEditMode:C,isItemSelected:S,selectedCount:u,hasSelectedItems:G,isAllSelected:I}=_(p,{deleteMessage:"선택한 가이드북을 삭제하시겠습니까?",deleteSuccessMessage:"개의 가이드북이 삭제되었습니다.",onDataChange:async s=>{const r=p.filter(a=>!s.find(t=>t.id===a.id)),l=[];for(const a of r)try{if(!await J(X.MY_GUIDEBOOKS,a.id)){l.push(a.id);continue}if(a.isPublic||a.status==="공개")try{await L(P(T,"publicGuidebooks",a.id)),console.log("✅ [MyGuidebooksPage] publicGuidebooks 삭제:",a.id)}catch(m){console.warn("⚠️ [MyGuidebooksPage] publicGuidebooks 삭제 실패:",a.id,m)}}catch(t){console.error("❌ [MyGuidebooksPage] Firestore 삭제 실패:",a.id,t),l.push(a.id)}if(l.length>0){k.error(`${l.length}개 가이드북 삭제에 실패했습니다.`);const a=[...s,...r.filter(t=>l.includes(t.id))];h(a);return}h(s),console.log("✅ [MyGuidebooksPage] 삭제 완료:",r.length,"개")}}),y=f.filter(s=>o==="all"?!0:o==="public"?s.status==="공개":o==="private"?s.status==="비공개":!0);console.log("🔍 [MyGuidebooksPage] 필터링 후:",{activeTab:o,dataLength:f.length,filteredLength:y.length});const i=[...y].sort((s,r)=>{if(c==="date-desc"){const l=new Date(s.createdAt);return new Date(r.createdAt).getTime()-l.getTime()}else if(c==="date-asc"){const l=new Date(s.createdAt),a=new Date(r.createdAt);return l.getTime()-a.getTime()}else if(c==="city-asc")return s.city.localeCompare(r.city,"ko-KR");return 0});return console.log("🔍 [MyGuidebooksPage] 정렬 후:",{sortOption:c,sortedLength:i.length}),e.jsxs("div",{className:"min-h-screen page-bg",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("div",{className:"flex items-center",children:e.jsx(x,{variant:"ghost",size:"sm",className:"p-0",onClick:()=>g("account",void 0,{scrollSection:"my-guidebooks"}),children:e.jsx(Y,{className:"w-5 h-5"})})}),e.jsx(x,{variant:"ghost",size:"sm",className:"text-gray-500 text-sm p-0 hover:text-gray-700 transition-colors",onClick:C,children:d?"완료":"편집"})]})}),e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"bg-white",children:[e.jsx("div",{className:"flex overflow-x-auto scrollbar-hide px-4 py-3",children:$.map(s=>e.jsx("button",{onClick:()=>b(s.id),className:`whitespace-nowrap px-4 py-2 rounded-full text-sm transition-colors mr-2 ${o===s.id?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:s.label},s.id))}),e.jsx("div",{className:"px-4 py-2 border border-gray-200 rounded-lg bg-gray-50 mb-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-gray-600",children:["총 ",i.length,"개의 가이드북"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"정렬:"}),e.jsxs("select",{value:c,onChange:s=>N(s.target.value),className:"text-[16px] border border-gray-300 rounded px-2 py-1 bg-white",children:[e.jsx("option",{value:"date-desc",children:"생성일순"}),e.jsx("option",{value:"date-asc",children:"오래된순"}),e.jsx("option",{value:"city-asc",children:"도시순"})]})]})]})})]}),d&&e.jsxs("div",{className:"flex justify-between items-center px-4 py-3 bg-blue-50 border-t border-blue-100",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(v,{checked:I(i),onCheckedChange:()=>A(i),className:"data-[state=checked]:bg-blue-500 data-[state=checked]:border-blue-500"}),e.jsxs("span",{className:"text-sm text-gray-700",children:["전체 선택 (",u,"/",i.length,")"]})]}),e.jsxs(E,{children:[e.jsx(z,{asChild:!0,children:e.jsxs(x,{variant:"destructive",size:"sm",disabled:!G,className:"text-sm",children:[e.jsx(q,{className:"w-4 h-4 mr-1"}),"삭제 (",u,")"]})}),e.jsxs(F,{children:[e.jsxs(B,{children:[e.jsx(O,{children:"선택한 가이드북을 삭제하시겠습니까?"}),e.jsxs(U,{children:["선택한 ",u,"개의 가이드북이 영구적으로 삭제됩니다. 이 작업은 되돌릴 수 없습니다."]})]}),e.jsxs(W,{children:[e.jsx(K,{children:"취소"}),e.jsx(R,{onClick:D,className:"bg-red-500 hover:bg-red-600",children:"삭제"})]})]})]})]}),i.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:e.jsxs("div",{className:"text-center max-w-md",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Q,{className:"w-16 h-16 mx-auto text-gray-300"})}),e.jsx("h3",{className:"text-lg mb-2 text-gray-700",children:o==="all"?"가이드북이 없습니다":"검색 ê²°ê
1³¼ê°€ 없습니다"}),e.jsx("p",{className:"text-sm text-gray-500 mb-6",children:o==="all"?e.jsxs(e.Fragment,{children:["자동여행일정을 생성하면 가이드북이 자동으로 생성됩니다.",e.jsx("br",{}),"홈페이지에서 여행 일정을 만들어보세요!"]}):e.jsxs(e.Fragment,{children:["선택하신 필터에 해당하는 가이드북이 없습니다.",e.jsx("br",{}),"다른 필터를 선택해 보세요."]})}),e.jsx(x,{onClick:()=>o==="all"?g("home"):b("all"),className:"bg-blue-500 hover:bg-blue-600 text-white",children:o==="all"?"여행 일정 만들기":"전체 보기"})]})}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-7 gap-3 px-4 py-4",children:i.map(s=>e.jsx("div",{className:"bg-white rounded-lg overflow-hidden shadow-lg hover:shadow-xl transition-all duration-300 hover:scale-105 group cursor-pointer w-full min-w-0",onClick:()=>{console.log("🔍 [MyGuidebooksPage] 카드 클릭:",{isEditMode:d,itemId:s.id,item:s}),d||(console.log("🔍 [MyGuidebooksPage] 상세 페이지로 이동:",s.id),g("my-guidebook-detail",String(s.id||"")))},children:e.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden",children:[e.jsx(M,{src:s.image,alt:s.title,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-300"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent z-[1]"}),d&&e.jsx("div",{className:"absolute top-2 left-2 z-20",onClick:r=>r.stopPropagation(),children:e.jsx(v,{checked:S(s.id),onCheckedChange:r=>w(s.id,r===!0),className:"bg-white shadow-lg data-[state=checked]:bg-blue-500 data-[state=checked]:border-blue-500"})}),!d&&e.jsxs("div",{className:"absolute top-3 left-3 z-20 flex items-center gap-1.5",children:[e.jsx("div",{className:"bg-white rounded-full px-3 py-1",children:e.jsx("span",{className:"text-blue-600 text-sm font-semibold",children:"내 가이드북"})}),s.version>1&&e.jsx("div",{className:"bg-purple-600 text-white rounded-full px-2 py-0.5",children:e.jsxs("span",{className:"text-xs font-bold",children:["v",s.version]})})]}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-4 z-10",children:[e.jsx("h3",{className:"text-white text-base mb-2 line-clamp-1 font-medium",children:s.title}),s.startDate&&s.endDate&&e.jsxs("div",{className:"text-xs text-white/90 mb-2",children:[s.startDate.replace(/-/g,".")," ~ ",s.endDate.replace(/-/g,".")]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/90",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),e.jsx("span",{children:s.city||s.destination})]}),s.days&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"|"}),e.jsxs("span",{children:[s.days,"일"]})]})]})]})]})},s.id))})]})]})}export{ce as MyGuidebooksPage};

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.