forked from bombastictranz/DuneQueryRepo
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelevant-10fd0e68273b117a.js.download
2 lines (2 loc) · 3.75 KB
/
relevant-10fd0e68273b117a.js.download
1
2
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1236],{12898:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/discover/content/relevant",function(){return n(24920)}])},24920:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return N}});var r=n(85893),a=n(31821),i=n(97683),s=n(77251),c=n(59480),l=n(16434),u=n(48390),o=n(49728),d=n(20982),f=n(45186),v=n(32613),h=n(78528),x=n(10295),p=n(84937);let j=["relevance","created-at","updated-at"];function y(e){let{sortByState:t}=e;function n(e){switch(e){case"created-at":return"Date created";case"updated-at":return"Date updated";default:return"Relevance"}}return(0,r.jsx)("li",{children:(0,r.jsx)(f.f,{position:"below-align-left-full-width",content:e=>{let{close:a}=e;return(0,r.jsx)(v.s_,{children:(0,r.jsx)(v.$0,{children:j.map(e=>(0,r.jsx)(v.FB,{active:t.value===e,href:t.getUrl(e),shallow:!0,onOpen:a,children:(0,r.jsx)(v.xv,{children:n(e)})},e))})})},children:(0,r.jsxs)(s.V1,{color:"gray",children:[(0,r.jsx)(s.xv,{children:n(t.value)}),(0,r.jsx)(h.IconChevronDown,{})]})})})}var g=n(37588),w=n(39736),_=n(82729),C=n(67294),k=n(39137),b=n(57831);function R(){let e=(0,_._)(["\n query DiscoverContentRelevant(\n $filters: SearchRelevantContentFiltersInput!\n $pagination: PaginationInput!\n $orderBy: [OrderByInput!]\n ) {\n searchRelevantContent(\n filters: $filters\n pagination: $pagination\n orderBy: $orderBy\n ) {\n ...FContentData\n }\n }\n"]);return R=function(){return e},e}function m(e){return e.searchRelevantContent}function B(e){return m(e).edges.map(e=>e.node)}function D(e){e.data&&e.variables&&e.fetchMore({variables:{...e.variables,pagination:{first:e.variables.pagination.first,after:m(e.data).pageInfo.endCursor}}})}(0,k.Z)(R());var $=n(37186),S=n(11163),E=n(61575),F=n(25506);function I(){let e=(0,S.useRouter)(),t=o.eJ();return(0,C.useEffect)(()=>{e.isReady&&!(0,E.HH)(t.value)&&e.replace("/discover/content/trending",void 0,{shallow:!0})},[e.isReady,t.value]),(0,r.jsx)(M,{searchStringState:{value:t.value}})}function M(e){let t=(0,b.kP)(),{searchStringState:n}=e,f=u.eJ(),v=d.eJ(),h=function(){let[e,t,n]=(0,x.s)({key:"sort-by",defaultValue:"relevance",validValues:j});return{value:e,setState:t,getUrl:n}}(),_=function(e){let{session:t,sessionLoading:n}=(0,C.useContext)(b.B3);return(0,p.Alc)({skip:n||""===e.filters.searchQuery.query,context:{session:t},variables:e})}({filters:{content:u.Je(f.value),searchQuery:o.R7(n.value),privacy:t?d.Je(v.value):void 0},orderBy:function(e){switch(e){case"created-at":return[{key:"createdAt",direction:p.eQH.Desc}];case"updated-at":return[{key:"updatedAt",direction:p.eQH.Desc}];default:return[{key:"relevance",direction:p.eQH.Desc}]}}(h.value),pagination:{first:20}}),{trackResultClick:k}=(0,$.V)({orderBy:"N/A",states:{searchStringState:n,typeFilterState:f,publicnessFilterState:v}}),R=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.i,{category:"Content"}),(0,r.jsx)(l.l,{feed:"Most relevant"}),(0,r.jsxs)(s.$0,{title:"Show",children:[(0,r.jsx)(u.h7,{typeFilterState:f}),t&&(0,r.jsx)(d.h7,{publicnessFilterState:v})]}),(0,r.jsx)(s.$0,{title:"Sort by",children:(0,r.jsx)(y,{sortByState:h})})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.yG,{title:"Most relevant | Content"}),(0,r.jsxs)(i.T3,{children:[(0,r.jsx)(i.h4,{renderDiscoverMobileMenu:()=>R}),(0,r.jsxs)(i.or,{children:[(0,r.jsx)(s.im,{children:R}),(0,r.jsx)(g.Z,{renderItems:e=>(0,r.jsx)(w.A,{items:e,trackResultClick:k}),result:_,getItems:B,fetchMore:D,renderEmpty:()=>(0,r.jsx)(F.u,{})})]})]})]})}function N(){return(0,r.jsx)(I,{})}}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[9225,3318,8110,3295,777,6746,5675,1444,9002,9938,9694,2741,9736,8020,9774,2888,179],function(){return t(73611),t(12898)}),_N_E=e.O()}]);
//# sourceMappingURL=relevant-10fd0e68273b117a.js.map