PageSourceSearch

https://lesvacances.co.kr/assets/SharedItemsPage-DaVLiAvA.js

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

1import{r as f,j as t,B as x,J as B,w as E}from"./index-BIjT-aNh.js";import{A as M,a as F,b as L,c as O,d as $,e as U,f as H,g as J,h as P}from"./alert-dialog-CmeDGxnw.js";import{u as R,s as V}from"./mockData-CE6CR3UX.js";import{b as X,a as _,T as W,g as q}from"./badgeUtils-CN-uXx26.js";import{fetchShareHistory as G}from"./myAccountService-CSYRfJ8q.js";import{u as K}from"./useMuseumStatus-BqE2wotn.js";import{A as Q}from"./arrow-left-DvZnGT50.js";import{T as Y}from"./trash-2-CfrWiq-B.js";import{S as Z}from"./search-x-BNs_DB6R.js";import"./star-C67ZY9-m.js";import"./download-DFkQk4FP.js";import"./firebaseAuth-BbFzaUYv.js";import"./index.esm-dObGBr4t.js";function ee(a){const n=a.trim();if(!n)return"";const o=n.match(/^([\d,.\s]+)([^\d,.\s]+)$/);return o?`${o[2]}${o[1].trim()}`:n}function te(a){const n=a.pricing||a.productData?.pricing||a.hotelData?.pricing,o=n?.lowest||n?.ratePerNight?.lowest;if(o)return ee(String(o))||void 0}function se(a,n){const o=a.type||"";if(o.includes("museum")){const d=n(a);return{statusLabel:d.label||void 0,statusColor:d.color||void 0}}return o==="hotel"?{statusLabel:a.zone||a.district||a.productData?.zone||a.productData?.district||a.hotelData?.zone||a.hotelData?.district||void 0,hotelPriceText:te(a)}:{}}function xe({onPageChange:a,previousPage:n}){const o=K(),[d,b]=f.useState("all"),[p,T]=f.useState("date-desc"),[v,j]=f.useState([]);f.useEffect(()=>{(async()=>{let s=[];try{s=(await G()).map(l=>({id:l.itemId||l.id,type:l.type||"",sharedType:l.sharedType||l.type||"",title:l.title||"",image:l.thumbnail||l.image||"",sharedUrl:l.sharedUrl||"",sharedVia:l.sharedVia||"",sharedAt:l.sharedAt?.toDate?.()?.toISOString?.()||l.sharedAt||new Date().toISOString(),cityCode:l.cityCode||"",cityName:l.cityName||"",...l})),console.log("☁️ [SharedItemsPage] Firestore에서",s.length,"개 로드")}catch(c){console.warn("⚠️ [SharedItemsPage] Firestore 로드 실패:",c)}let r=[];try{r=JSON.parse(localStorage.getItem("sharedItems")||"[]")}catch{}const i=new Map;s.forEach(c=>i.set(c.id,c)),r.forEach(c=>{if(!i.has(c.id))i.set(c.id,c);else{const l=i.get(c.id);i.set(c.id,{...c,...l})}});const y=50;let h=Array.from(i.values());h.length>y&&(h=[...h].sort((c,l)=>new Date(l.sharedAt).getTime()-new Date(c.sharedAt).getTime()).slice(0,y)),localStorage.setItem("sharedItems",JSON.stringify(h)),j(h)})()},[]);const{isEditMode:g,data:S,handleItemSelect:w,handleSelectAll:N,handleDeleteSelected:D,toggleEditMode:A,isItemSelected:I,selectedCount:m,hasSelectedItems:k,isAllSelected:C}=R(v,{deleteMessage:"선택한 항목을 삭제하시겠습니까?",deleteSuccessMessage:"개의 항목이 삭제되었습니다.",onDataChange:e=>{j(e),localStorage.setItem("sharedItems",JSON.stringify(e))}}),u=[...S.filter(e=>d==="all"?!0:d==="vacances-collection"?e.sharedType==="바캉스컬렉션":d==="museum-map"?e.sharedType==="박물관맵":d==="itinerary"?e.sharedType==="여행일정":d==="guidebook"?e.sharedType==="가이드북":d==="travel-product"?e.sharedType==="여행상품":d==="flight"?e.sharedType==="항공편":d==="hotel"?e.sharedType==="호텔":d==="photo"?e.sharedType==="사진":d==="other"?e.sharedType==="기타":!0)].sort((e,s)=>{if(p==="date-desc"){const r=new Date(e.sharedAt);return new Date(s.sharedAt).getTime()-r.getTime()}else if(p==="date-asc"){const r=new Date(e.sharedAt),i=new Date(s.sharedAt);return r.getTime()-i.getTime()}else if(p==="city-asc"){const r=e.city||"",i=s.city||"";return r.localeCompare(i,"ko")}return 0}),z=e=>{if(g)return;let s=e.type;const r=e.id?.toString();if(!s&&e.sharedType&&(e.sharedType==="박물관맵"?s="museum":e.sharedType==="바캉스컬렉션"?s="city":e.sharedType==="작품"?s="artwork":e.sharedType==="여행일정"?s="schedule":e.sharedType==="국가"?s="country":e.sharedType==="도시"?s="city":e.sharedType==="가이드북"?s="guidebook":e.sharedType==="쥬디 매거진"?s="magazine":e.sharedType==="여행상품"?s="product":e.sharedType==="호텔"?s="hotel":e.sharedType==="PDF"&&(s="pdf")),!s&&e.category&&(e.category.includes("박물관")||e.category==="박물관맵"?s="museum":e.category.includes("도시")||e.category==="바캉스컬렉션"?s="city":e.category==="작품"&&(s="artwork")),!s||!r){console.warn("카드 클릭: type 또는 id가 없습니다",e);return}if(s==="pdf"){const i=e.pdfUrl||e.sharedUrl;i?a("pdf-viewer",void 0,{pdfUrl:i,title:e.title||"PDF",pdfMeta:{docId:r,title:e.title||"PDF",thumbnail:e.image||"",cityName:e.location||e.city||"",category:e.category||"PDF"}}):console.warn("PDF URL이 없습니다",e)}else s==="museum"||s==="museum-pdf"?a("museum-detail",r):s==="city"||s==="city-pdf"?a("city-detail",r):s==="artwork"?a("artwork-detail",r):s==="guidebook"||s==="vacances-collection"?a("my-guidebook-detail",r):s==="schedule"?E.info("여행일정 상세 페이지는 준비 중입니다"):s==="hotel"?a("hotel-detail",r,{item:e.hotelData||{name:e.title,images:e.image?[e.image]:[],rating:e.rating||5,location:e.location||"",reviewCount:e.downloads||e.views||0},hotelName:e.title,image:e.image}):s==="flight"?a("flights"):s==="country"?a("country-detail",r):s==="travel-plan"?a("trip-detail",r,{source:"my-account"}):s==="magazine"?a("magazine-detail",r):s==="product"?a("travel-product-detail",void 0,{productData:e.productData||e,backPage:"shared-items"}):console.warn("알 수 없는 카드 타입:",s)};return t.jsxs("div",{className:"min-h-screen page-bg",children:[t.jsx("div",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:t.jsxs("div",{className:"flex items-center justify-between p-4",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx(x,{variant:"ghost",size:"sm",className:"p-0 mr-3",onClick:()=>a(n||"account"),children:t.jsx(Q,{className:"w-5 h-5"})}),t.jsx("h1",{className:"text-xl flex-1 text-center",children:"공유내역"})]}),t.jsx(x,{variant:"ghost",size:"sm",className:"text-gray-500 text-sm p-0 hover:text-gray-700 transition-colors",onClick:A,children:g?"완료":"편집"})]})}),t.jsxs("div",{className:"max-w-7xl mx-auto",children:[t.jsxs("div",{className:"bg-white",children:[t.jsx("div",{className:"flex overflow-x-auto scrollbar-hide px-4 py-3",children:V.map(e=>t.jsx("button",{onClick:()=>b(e.id),className:`whitespace-nowrap px-4 py-2 rounded-full text-sm transition-colors mr-2 ${d===e.id?"bg-blue-500 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:e.label},e.id))}),t.jsx("div",{className:"px-4 py-2 border border-gray-200 rounded-lg bg-gray-50 mb-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{className:"text-sm text-gray-600",children:["총 ",u.length,"개의 공유내역"]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-gray-500",children:"정렬:"}),t.jsxs("select",{value:p,onChange:e=>T(e.target.value),className:"text-[16px] border border-gray-300 rounded px-2 py-1 bg-white",children:[t.jsx("option",{value:"date-desc",children:"최신순"}),t.jsx("option",{value:"date-asc",children:"오래된순"}),t.jsx("option",{value:"city-asc",children:"도시순"})]})]})]})})]}),g&&t.jsxs("div",{className:"flex justify-between items-center px-4 py-3 bg-blue-50 border-t border-blue-100",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(B,{checked:C(u),onCheckedChange:()=>N(u),className:"data-[state=checked]:bg-blue-500 data-[state=checked]:border-blue-500"}),t.jsxs("span",{className:"text-sm text-gray-700",children:["전체 선택 (",m,"/",u.length,")"]})]}),t.jsxs(M,{children:[t.jsx(F,{asChild:!0,children:t.jsxs(x,{variant:"destructive",size:"sm",disabled:!k,className:"text-sm",children:[t.jsx(Y,{className:"w-4 h-4 mr-1"}),"삭제 (",m,")"]})}),t.jsxs(L,{children:[t.jsxs(O,{children:[t.jsx($,{children:"선택한 항목을 삭제하시겠습니까?"}),t.jsxs(U,{children:["선택한 ",m,"개의 항목이 공유내역에서 영구적으로 삭제됩니다. 이 작업은 되돌릴 수 없습니다."]})]}
1),t.jsxs(H,{children:[t.jsx(J,{children:"취소"}),t.jsx(P,{onClick:D,className:"bg-red-500 hover:bg-red-600",children:"삭제"})]})]})]})]}),u.length===0?t.jsx("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:t.jsxs("div",{className:"text-center max-w-md",children:[t.jsx("div",{className:"mb-4",children:t.jsx(Z,{className:"w-16 h-16 mx-auto text-gray-300"})}),t.jsx("h3",{className:"text-lg mb-2 text-gray-700",children:"검색 결과가 없습니다"}),t.jsxs("p",{className:"text-sm text-gray-500 mb-6",children:["선택하신 필터에 해당하는 공유받은 항목이 없습니다.",t.jsx("br",{}),"다른 필터를 선택해 보세요."]}),t.jsx(x,{onClick:()=>b("all"),className:"bg-blue-500 hover:bg-blue-600 text-white",children:"전체 보기"})]})}):t.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:u.map((e,s)=>{const r=e.type||X(e.sharedType),i=se({...e,type:r},o),y=e.sharedType||_(r),h=q();return t.jsx(W,{image:e.image,title:e.title,badge:void 0,rating:e.rating,stars:e.stars,location:r==="hotel"?void 0:e.location||e.city||"",typeBadge:y,typeBadgeStyle:h,statusLabel:i.statusLabel,statusColor:i.statusColor,priceText:i.hotelPriceText,onClick:()=>z(e),isEditMode:g,isSelected:I(e.id),onCheckboxChange:c=>w(e.id,c),fullWidth:!0},e.id?`${r}-${e.id}`:`shared-item-${s}`)})})]})]})}export{xe as SharedItemsPage};

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.