PageSourceSearch

https://myhablo.com/assets/ManageExplorePages-NjZPa-0J.js

js myhablo.com collected 2026-10-05 20:36:53 UTC 11,711 bytes, 127 lines download raw bytes

1import{q as e,a,d as i,m as t,g as n,j as s,i as l}from"./vendors-QhIvPYIJ.js";import{I as r,ad as o,gZ as d,a6 as c,g_ as p,gM as g,a0 as h,e as m,gN as x,ac as u,G as v,ao as f,w as j,g as b,Y as y,Z as P,J as D,ag as w,R as C}from"./common-BFmtb6S9.js";import{F as O}from"./ManageExplorePages-CE-JosAR.js";import{B as k,f as F,F as N,I as S,q as T,T as $,M as V,j as E,a as I,C as M,D as z}from"./antd-ui-dX6zKduJ.js";import"./vendor-BULTH10r.js";import"./mux-BjcC3at3.js";import"./stream-chat-C5SZPXo1.js";import"./animations-BPm1vIJm.js";import"./draft-js-_oHZAwb8.js";import"./OrganisationEventAttendVerify-BfGWK0mI.js";function A({onCancel:e,type:l,pageData:o,destinationsPagesTree:v,updateDestinationsPagesTree:f}){var j,b,y;const P=a.useRef(null),D=a.useRef(null),{t:w}=i(),[C]=N.useForm(),[I,M]=a.useState(!!o&&"Public"===o.status),[z,A]=a.useState((null==(j=null==o?void 0:o.hostOrganisations)?void 0:j.map(({id:e,image:a,name:i})=>({id:e,image:a,name:i})))??[]),[_,K]=a.useState(void 0),[X]=t(d),[ee]=t(c),[ae]=t(p),[ie,te]=a.useState(void 0),{data:ne}=n(g,{skip:void 0===ie,errorPolicy:"ignore",variables:{searchText:ie}}),{data:se}=n(O,{errorPolicy:"ignore",variables:{sortBy:"name",sortOrder:h.Ascending,filter:{}}});a.useEffect(()=>{var e;if(o){C.setFields([{name:"explorePageName",value:o.name},{name:"parentPageName",value:o&&o.path&&o.path.length?o.path[o.path.length-1]:"no-parent"},{name:"hostOrganisations",value:null==(e=null==o?void 0:o.hostOrganisations)?void 0:e.map(({id:e})=>e)}]);const a=w("Destinations"),i=o;i.name.length<40?i.name:i.name.substr(0,40);const t=`${i.pathDetail.reduce((e,a)=>`${e} > ${a.name.length<40?a.name:a.name.substr(0,40)+"..."}`,a)}`;K(t)}},[]);const le=(e,a)=>null==e?void 0:e.find(e=>e.id===a||le(e.children,a));return s.jsx(B,{children:s.jsx(J,{children:s.jsxs(N,{name:"new-explore-page",form:C,onFinish:async()=>{var a;const i=C.getFieldValue("parentPageName"),t=le(v,i);if("Create"===l){const e=await X({variables:{destinationPageData:{name:C.getFieldValue("explorePageName"),status:I?"Public":"Private",categories:[],hostOrganisationIds:C.getFieldValue("hostOrganisations"),image:"",path:"no-parent"===i?[]:[...t&&t.path||[],i]}}});e.data.createDestinationPage&&f(a=>a&&[...a,e.data.createDestinationPage])}else if(o){const e=await ee({variables:{destinationPageData:{id:o.id,name:C.getFieldValue("explorePageName"),status:I?"Public":"Private",hostOrganisationIds:C.getFieldValue("hostOrganisations"),path:"no-parent"===i?[]:[...t&&t.path||[],i]}}});(null==(a=null==e?void 0:e.data)?void 0:a.updateDestinationPage)?f(a=>a&&a.map(a=>a.id===e.data.updateDestinationPage.id?e.data.updateDestinationPage:a)):E.error(w("You can't set child destination page as a parent destination for parent destination page itself"))}e(!1)},labelCol:{span:24},wrapperCol:{span:24},size:"middle",className:"custom-responsive-form",children:[s.jsx(N.Item,{name:"explorePageName",label:w("Explore Page name"),rules:[{required:!0,message:w("Please fill out explore page name")}],initialValue:"",children:s.jsx(S,{placeholder:w("e.g. Las Vegas"),maxLength:50})}),s.jsxs(N.Item,{name:"parentPageName",label:w("Parent page"),initialValue:"no-parent",children:[s.jsx(Y,{icon:m.search,color:"var(--color-darkerblue)",size:14}),s.jsxs(G,{ref:D,showSearch:!0,value:_,placeholder:w("Add a parent page..."),onChange:(e,a)=>{C.setFields([{name:"parentPageName",value:a.value}]),K(a.id),D&&D.current.blur()},filterOption:(e,a)=>null==a?void 0:a.id.toLowerCase().includes(e.toLowerCase()),children:[null==(b=null==se?void 0:se.searchDestinationPages)?void 0:b.records.map((e,a)=>{const i=w("Destinations"),t=e.name.length<40?e.name:e.name.substr(0,40)+"...",n=`${e.pathDetail.reduce((e,a)=>`${e} > ${a.name.length<40?a.name:a.name.substr(0,40)+"..."}`,i)} > ${t}`;return s.jsx(F.Option,{value:e.id,id:n,"data-cy":`input-destpage-${e.id}`,children:s.jsx(Z,{children:s.jsx("div",{children:n})})},e.id)}),s.jsx(F.Option,{value:"no-parent",id:"Destinations","data-cy":"input-destpage-destination",children:s.jsx(Z,{children:s.jsx("div",{children:"Destinations"})})},"Destinations")]})]}),s.jsxs(N.Item,{name:"hostOrganisations",label:w("Host Organisations"),initialValue:[],children:[s.jsx(Y,{icon:m.search,color:"var(--color-darkerblue)",size:14}),s.jsx(H,{ref:P,mode:"multiple",defaultValue:z.map(e=>JSON.stringify({id:e.id,name:e.name,image:e.image})),placeholder:w("Add a new Host Organisation..."),onChange:(e,a)=>{C.setFields([{name:"hostOrganisations",value:e.map(e=>JSON.parse(e).id)}]),A(e.map(e=>JSON.parse(e))),P&&P.current.blur()},onSearch:e=>te(e.length>=2?e:void 0),onBlur:()=>te(void 0),children:null==(y=null==ne?void 0:ne.organisations)?void 0:y.records.map(({id:e,name:a,image:i,location:t},n)=>z.find(a=>a.id===e)?null:s.jsx(F.Option,{value:JSON.stringify({id:e,name:a,image:i}),"data-cy":`input-organisation-${e}`,children:s.jsxs(Z,{children:[s.jsx(x,{children:s.jsx(u,{id:i,width:20})}),s.jsx("div",{children:a})]})},i??n))})]}),s.jsx(Q,{children:null==z?void 0:z.map(({id:e,name:a,image:i},t)=>s.jsxs(U,{type:l,children:[s.jsx(W,{children:s.jsx(u,{id:i,width:35})}),s.jsx("div",{children:a}),s.jsx(r,{size:12,icon:m.close,color:"var(--color-darkerblue)",style:{cursor:"pointer"},onClick:()=>{A(z.filter(a=>a.id!==e)),C.setFields([{name:"hostOrganisations",value:C.getFieldValue("hostOrganisations").filter(a=>a!==e)}])}})]},t))}),s.jsxs(q,{children:[s.jsx(T,{checked:!I,onChange:({target:e})=>e.checked&&M(!I),children:s.jsx($.Text,{children:w("Unlisted")})}),s.jsx(T,{checked:I,onChange:({target:e})=>e.checked&&M(!I),children:s.jsx($.Text,{children:w("Public")})})]}),s.jsxs(L,{children:["Edit"===l&&s.jsx(R,{type:"ghost",style:{borderColor:"var(--color-border)"},onClick:async()=>{V.confirm({title:w("Remove explore page"),content:w("Are you sure you wish to remove this explore page?"),cancelText:w("Cancel"),okText:w("Remove"),okButtonProps:{danger:!0},onOk:async()=>{(await ae({variables:{id:null==o?void 0:o.id}})).data.removeDestinationPage.success?f(e=>e&&e.filter(e=>e.id!==(null==o?void 0:o.id))):E.error("All linked/child pages must be deleted first before this page can be removed.")}})},children:"Delete"}),s.jsx(k,{type:"ghost",style:{borderColor:"var(--color-border)"},onClick:e,children:"Cancel"}),s.jsx(k,{type:"primary",htmlType:"submit",children:"Save"})]})]})})})}const B=e.div``,L=e.div`
2  display: flex;
3  justify-content: flex-end;
4  & button {
5    width: 142px;
6    height: 48px;
7    margin-left: 16px;
8  }
9`,R=e(k)`
10  margin-right: auto;
11  margin-left: 0 !important;
12`,J=e.div`
13  max-width: 520px;
14`,q=e.div`
15  margin: 30px 0 50px 0;
16`,H=e(F)`
17  & .ant-select-selection-overflow {
18    position: absolute;
19    bottom: -60px;
20    height: 48px;
21    & > div > span {
22      height: 48px;
23      display: flex;
24      align-items: center;
25      font-weight: 700;
26      font-size: 16px;
27      padding: 0 16px;
28      display: none;
29    }
30  }
31  & .ant-select-selection-overflow-item-suffix {
32    position: absolute;
33    top: -46px;
34    left: 34px;
35  }
36  & .ant-select-selection-search {
37    min-width: 400px;
38  }
39  & .ant-select-selection-placeholder {
40    margin-left: 34px;
41  }
42`,G=e(F)`
43  & .ant-select-selection-overflow {
44    position: absolute;
45    bottom: -60px;
46    height: 48px;
47    & > div > span {
48      height: 48px;
49      display: flex;
50      align-items: center;
51      font-weight: 700;
52      font-size: 16px;
53      padding: 0 16px;
54      display: none;
55    }
56  }
57  & .ant-select-selection-overflow-item-suffix {
58    position: absolute;
59    top: -46px;
60    left: 34px;
61  }
62  & .ant-select-selection-search {
63    min-width: 400px;
64    margin-left: 34px;
65  }
66  & .ant-select-selection-placeholder {
67    margin-left: 34px;
68  }
69  & .ant-select-selection-item {
70    margin-left: 34px;
71  }
72`,Y=e(r)`
73  position: absolute;
74  z-index: 100;
75  top: 14px;
76  left: 14px;
77`,Z=e.div`
78  display: flex;
79  align-items: center;
80  gap: 20px;
81`,Q=e.div`
82  display: flex;
83  flex-wrap: wrap;
84  gap: 20px;
85  font-weight: 700;
86`,U=e.div`
87  display: flex;
88  column-gap: 10px;
89  align-items: center;
90  padding: 6px 15px 6px 10px;
91  background-color: ${({type:e})=>"Create"===e?"#f2f2f2":"#fff"};
92  font-weight: 700;
93  border-radius: ${o};
94`,W=e.div`
95  width: 35px;
96  height: 35px;
97  & > div {
98    border-radius: 100px;
99  }
100`;function _(e){var t,r,o;const{t:d}=i(),c=l(),[p,g]=a.useState(!1),[x,u]=a.useState(""),[D,F]=a.useState(null),[N,T]=a.useState(!1),{data:V,fetchMore:E}=n(O,{variables:{first:5,sortBy:"name",sortOrder:h.Ascending,filter:{searchText:x}},fetchPolicy:"network-only"}),[z,B]=a.useState([]);a.useEffect(()=>{var e;B((null==(e=null==V?void 0:V.searchDestinationPages)?void 0:e.records)??[])},[null==(t=null==V?void 0:V.searchDestinationPages)?void 0:t.records]);const L=({explorePages:e,destinationName:a})=>s.jsx(s.Fragment,{children:e&&(null==e?void 0:e.length)>0&&(null==e?void 0:e.map(e=>{var i;const t=e.name.length<40?e.name:e.name.substr(0,40)+"...",n=`${e.pathDetail.reduce((e,a)=>`${e} > ${a.name.length<40?a.name:a.name.substr(0,40)+"..."}`,a)} > ${t}`;return"explore-home"===e.id?null:s.jsxs(s.Fragment,{children:[(null==D?void 0:D.id)===e.id?s.jsxs(X,{children:[s.jsxs(ne,{children:[s.jsxs("span",{children:[d("Manage"),":"]}),s.jsx(ae,{children:n})]}),s.jsx(A,{type:"Edit",onCancel:()=>F(null),pageData:e,destinationsPagesTree:z,updateDestinationsPagesTree:B})]}):s.jsx(s.Fragment,{children:s.jsxs(K,{children:[s.jsx(ae,{children:n}),s.jsx(ie,{type:"ghost",icon:m.link,onClick:()=>{c.push(w(C.exploreDestination,{destinationId:e.vanityId}))},children:d("Go to Page")}),s.jsx(ie,{type:"ghost",icon:m.settings,onClick:()=>{u(""),F(e)},children:d("Manage")})]},e.id)}),s.jsx(te,{},"divider"+e.id),(null==(i=null==e?void 0:e.children)?void 0:i.length)>0&&s.jsx(L,{explorePages:e.children,destinationName:n})]})}))});return s.jsxs(I,{gutter:v,children:[s.jsx(M,{span:6,children:s.jsx(f,{...e})}),s.jsx(M,{span:18,children:s.jsxs(j,{style:{minHeight:"300px"},children:[s.jsx($.Title,{level:3,style:{marginBottom:b},children:d("Create a New Explore Page")}),p&&z?s.jsx(A,{type:"Create",onCancel:()=>g(!1),destinationsPagesTree:z,updateDestinationsPagesTree:B}):s.jsxs(s.Fragment,{children:[s.jsx(k,{type:"primary",onClick:()=>{u(""),g(!0)},children:d("+ New")}),s.jsx(te,{}),s.jsx(se,{level:3,style:{},children:d("Manage Existing Explore Pages ")}),s.jsxs(ee,{children:[s.jsxs($.Text,{style:{fontWeight:"800"},children:[d("Search"),s.jsx("span",{style:{color:"#FF1414"},children:"*"})]}),s.jsx(S,{maxLength:50,onChange:e=>u(e.target.value)})]}),z&&s.jsx(L,{explorePages:z,destinationName:d("Destinations")}),!N&&V&&(null==(r=null==V?void 0:V.searchDestinationPages)?void 0:r.records.length)<(null==(o=null==V?void 0:V.searchDestinationPages)?void 0:o.totalCount)&&s.jsx(y,{children:s.jsx(P,{onClick:()=>{var e;T(!0);const a=null==(e=null==V?void 0:V.searchDestinationPages)?void 0:e.records;a&&E({variables:{first:50,after:a[a.length-1].id},updateQuery:(e,{fetchMoreResult:a,variables:i})=>(T(!1),a?{searchDestinationPages:{...e.searchDestinationPages,records:[...e.searchDestinationPages.records,...a.searchDestinationPages.records]}}:e)})},children:"Load more"})})]})]})})]})}const K=e.div`
101  display: flex;
102  justify-content: flex-end;
103  align-items: center;
104`,X=e.div`
105  padding: 24px;
106  background-color: rgba(30, 103, 143, 0.05);
107  border-radius: ${o};
108  margin-bottom: 16px;
109`,ee=e.div`
110  margin-bottom: 40px;
111  max-width: 350px;
112`,ae=e.div`
113  margin-right: auto;
114  font-weight: 700;
115`,ie=e(D)`
116  color: var(--color-primary);
117  margin-left: 10px;
118`,te=e(z)`
119  color: #f2f2f2;
120`,ne=e.div`
121  margin-bottom: 26px;
122  display: flex;
123  gap: 5px;
124`,se=e($.Title)`
125  margin-bottom: ${b};
126  margin-top: 34px;
127`;export{_ as ManageExplorePages};

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.