PageSourceSearch

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

js lesvacances.co.kr collected 2026-09-25 11:26:31 UTC 10,029 bytes, 1 lines download raw bytes

1import{r as x,j as t,B as m,E,t as M}from"./index-DJGi9kSq.js";import{A as B,a as F,b as L,c as H,d as O,e as $,f as U,g as _,h as J}from"./alert-dialog-BgWBrxVt.js";import{u as P,s as R}from"./mockData-B_m9JJnd.js";import{b as V,a as X,T as W,g as Y}from"./badgeUtils-lLmdYQi3.js";import{fetchShareHistory as q}from"./myAccountService-C8qNArhK.js";import{d as v,u as G,t as K}from"./timezone-gB5KezTq.js";import{A as Q}from"./arrow-left-CXrnAMCI.js";import{T as Z}from"./trash-2-Djw3Bhgq.js";import{S as ee}from"./search-x-B-93jBpO.js";import"./star-DYHkTPu0.js";import"./download-B9mjCMeE.js";import"./firebaseAuth-D21EO0Hc.js";import"./index.esm-BQEAOfp1.js";v.extend(G);v.extend(K);const te=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function se(r,i){if(!r||!i)return{label:"",color:""};try{const a=v().tz(i),n=r[te[a.day()]];if(!n)return{label:"",color:""};if(n.isClosed===!0||n.isClosed==="true")return{label:"휴무일",color:"text-red-500"};const h=a.hour()*60+a.minute(),[b,T]=(n.openTime||"00:00").split(":").map(Number),[g,p]=(n.closeTime||"00:00").split(":").map(Number);return h>=b*60+T&&h<g*60+p?{label:"영업중",color:"text-green-600"}:{label:"영업종료",color:"text-red-500"}}catch{return{label:"",color:""}}}function re(r){const i=r.trim();if(!i)return"";const a=i.match(/^([\d,.\s]+)([^\d,.\s]+)$/);return a?`${a[2]}${a[1].trim()}`:i}function ae(r){const i=r.pricing||r.productData?.pricing||r.hotelData?.pricing,a=i?.lowest||i?.ratePerNight?.lowest;if(a)return re(String(a))||void 0}function le(r){const i=r.type||"";if(i.includes("museum")){const a=se(r.operatingHours,r.cityTimezone);return{statusLabel:a.label||void 0,statusColor:a.color||void 0}}return i==="hotel"?{statusLabel:r.zone||r.district||r.productData?.zone||r.productData?.district||r.hotelData?.zone||r.hotelData?.district||void 0,hotelPriceText:ae(r)}:{}}function Te({onPageChange:r,previousPage:i}){const[a,n]=x.useState("all"),[h,b]=x.useState("date-desc"),[T,g]=x.useState([]);x.useEffect(()=>{(async()=>{let s=[];try{s=(await q()).map(o=>({id:o.itemId||o.id,type:o.type||"",sharedType:o.sharedType||o.type||"",title:o.title||"",image:o.thumbnail||o.image||"",sharedUrl:o.sharedUrl||"",sharedVia:o.sharedVia||"",sharedAt:o.sharedAt?.toDate?.()?.toISOString?.()||o.sharedAt||new Date().toISOString(),cityCode:o.cityCode||"",cityName:o.cityName||"",...o})),console.log("☁️ [SharedItemsPage] Firestore에서",s.length,"개 로드")}catch(d){console.warn("⚠️ [SharedItemsPage] Firestore 로드 실패:",d)}let l=[];try{l=JSON.parse(localStorage.getItem("sharedItems")||"[]")}catch{}const c=new Map;s.forEach(d=>c.set(d.id,d)),l.forEach(d=>{if(!c.has(d.id))c.set(d.id,d);else{const o=c.get(d.id);c.set(d.id,{...d,...o})}});const f=50;let u=Array.from(c.values());u.length>f&&(u=[...u].sort((d,o)=>new Date(o.sharedAt).getTime()-new Date(d.sharedAt).getTime()).slice(0,f)),localStorage.setItem("sharedItems",JSON.stringify(u)),g(u)})()},[]);const{isEditMode:p,data:N,handleItemSelect:S,handleSelectAll:w,handleDeleteSelected:D,toggleEditMode:A,isItemSelected:I,selectedCount:j,hasSelectedItems:k,isAllSelected:C}=P(T,{deleteMessage:"선택한 항목을 삭제하시겠습니까?",deleteSuccessMessage:"개의 항목이 삭제되었습니다.",onDataChange:e=>{g(e),localStorage.setItem("sharedItems",JSON.stringify(e))}}),y=[...N.filter(e=>a==="all"?!0:a==="vacances-collection"?e.sharedType==="바캉스컬렉션":a==="museum-map"?e.sharedType==="박물관맵":a==="itinerary"?e.sharedType==="여행일정":a==="guidebook"?e.sharedType==="가이드북":a==="travel-product"?e.sharedType==="여행상품":a==="flight"?e.sharedType==="항공편":a==="hotel"?e.sharedType==="호텔":a==="photo"?e.sharedType==="사진":a==="other"?e.sharedType==="기타":!0)].sort((e,s)=>{if(h==="date-desc"){const l=new Date(e.sharedAt);return new Date(s.sharedAt).getTime()-l.getTime()}else if(h==="date-asc"){const l=new Date(e.sharedAt),c=new Date(s.sharedAt);return l.getTime()-c.getTime()}else if(h==="city-asc"){const l=e.city||"",c=s.city||"";return l.localeCompare(c,"ko")}return 0}),z=e=>{if(p)return;let s=e.type;const l=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||!l){console.warn("카드 클릭: type 또는 id가 없습니다",e);return}if(s==="pdf"){const c=e.pdfUrl||e.sharedUrl;c?r("pdf-viewer",void 0,{pdfUrl:c,title:e.title||"PDF",pdfMeta:{docId:l,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"?r("museum-detail",l):s==="city"||s==="city-pdf"?r("city-detail",l):s==="artwork"?r("artwork-detail",l):s==="guidebook"||s==="vacances-collection"?r("my-guidebook-detail",l):s==="schedule"?M.info("여행일정 상세 페이지는 준비 중입니다"):s==="hotel"?r("hotel-detail",l,{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"?r("flights"):s==="country"?r("country-detail",l):s==="travel-plan"?r("trip-detail",l,{source:"my-account"}):s==="magazine"?r("magazine-detail",l):s==="product"?r("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(m,{variant:"ghost",size:"sm",className:"p-0 mr-3",onClick:()=>r(i||"account"),children:t.jsx(Q,{className:"w-5 h-5"})}),t.jsx("h1",{className:"text-xl flex-1 text-center",children:"공유내역"})]}),t.jsx(m,{variant:"ghost",size:"sm",className:"text-gray-500 text-sm p-0 hover:text-gray-700 transition-colors",onClick:A,children:p?"완료":"편집"})]})}),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:R.map(e=>t.jsx("button",{onClick:()=>n(e.id),className:`whitespace-nowrap px-4 py-2 rounded-full text-sm transition-colors mr-2 ${a===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:["총 ",y.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:h,onChange:e=>b(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:"도시순"})]})]})]})})]}),p&&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(E,{checked:C(y),onCheckedChange:()=>w(y),className:"data-[state=checked]:bg-blue-500 data-[state=checked]:border-blue-500"}),t.jsxs("span",{className:"text-sm text-gray-700",children:["전체 선택 (",j,"/",y.length,")"]})]}),t.jsxs(B,{children:[t.jsx(F,{asChild:!0,children:t.jsxs(m,{variant:"destructive",size:"sm",disabled:!k,className:"text-sm",children:[t.jsx(Z,{className:"w-4 h-4 mr-1"}),"삭제 (",j,")"]})}
1),t.jsxs(L,{children:[t.jsxs(H,{children:[t.jsx(O,{children:"선택한 항목을 삭제하시겠습니까?"}),t.jsxs($,{children:["선택한 ",j,"개의 항목이 공유내역에서 영구적으로 삭제됩니다. 이 작업은 되돌릴 수 없습니다."]})]}),t.jsxs(U,{children:[t.jsx(_,{children:"취소"}),t.jsx(J,{onClick:D,className:"bg-red-500 hover:bg-red-600",children:"삭제"})]})]})]})]}),y.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(ee,{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(m,{onClick:()=>n("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:y.map((e,s)=>{const l=e.type||V(e.sharedType),c=le({...e,type:l}),f=e.sharedType||X(l),u=Y();return t.jsx(W,{image:e.image,title:e.title,badge:void 0,rating:e.rating,stars:e.stars,location:l==="hotel"?void 0:e.location||e.city||"",typeBadge:f,typeBadgeStyle:u,statusLabel:c.statusLabel,statusColor:c.statusColor,priceText:c.hotelPriceText,onClick:()=>z(e),isEditMode:p,isSelected:I(e.id),onCheckboxChange:d=>S(e.id,d),fullWidth:!0},e.id?`${l}-${e.id}`:`shared-item-${s}`)})})]})]})}export{Te 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.