2 lines
5.7 KiB
JavaScript
Executable File
2 lines
5.7 KiB
JavaScript
Executable File
"use strict";(("undefined"!=typeof self?self:global).webpackChunkopen=("undefined"!=typeof self?self:global).webpackChunkopen||[]).push([[7553],{82620:(e,t,a)=>{a.r(t),a.d(t,{default:()=>X});var r=a(59496),l=a(61740),n=a(89605),o=a(21586),s=a(28680),i=a(50346),c=a(3802),u=a(4270),d=a(13655),g=a(91703),m=a(45911),f=a(23627),h=a(77312),y=a(18840),p=a(66806),x=a(53417),k=a(29939),j=a(9877),b=a(48271),D=a(9284),F=a(16201),C=a(46843),E=a(46164),I=a(82538),S=a(48607),T=a(96170),w=a(78690),P=a(8930),v=a(24256),L=a(38440),A=a(4637);const R=r.memo((({tracklistDomRef:e})=>{const{spec:t,logger:a}=(0,T.fU)(P.createDesktopSearchBarEventFactory,{}),l=(0,r.useCallback)((()=>{a.logInteraction(t.filterFieldFactory().keyStrokeFilter())}),[a,t]),n=(0,r.useCallback)((()=>{a.logInteraction(t.filterFieldFactory().hitClearFilter())}),[a,t]),o=(0,r.useCallback)((()=>{a.logInteraction(t.sortButtonFactory().hitSort())}),[a,t]);return(0,A.jsxs)("div",{className:y.Z.searchBoxContainer,children:[(0,A.jsx)(r.Suspense,{fallback:null,children:(0,A.jsx)(v.K,{placeholder:c.ag.get("playlist.search_in_playlist"),clearOnEscapeInElementRef:e,onFilter:l,onClear:n})}),(0,A.jsx)(L.l,{columns:k.P0,onSort:o})]})}));var U=a(12107),O=a(80964),_=a(82108),B=a(28853),N=a(9102),Q=a(72102),M=a(36472),z=a(79041),G=a(9637),H=a(79923);const $=18e5;const q=r.lazy((()=>Promise.all([a.e(1814),a.e(6639),a.e(682)]).then(a.bind(a,86639)))),K=[x.QD.INDEX,x.QD.TITLE,x.QD.ALBUM,x.QD.ADDED_AT,x.QD.DURATION],V="your_library",W=({data:e,canFilter:t,canSort:a})=>{const{uri:l,name:i,totalLength:b}=e.metadata,E=(0,r.useRef)(null),P=b>0,v=b>0,L=(0,F.Y5)("#5038a0"),{filter:_}=(0,r.useContext)(p.fo),{sortState:N,setSortState:Q}=(0,r.useContext)(k.Gb),{spec:M,logger:z}=(0,T.fU)(s.createDesktopLikedSongsEventFactory,{data:{uri:l}}),G=r.useMemo((()=>M.headerFactory()),[M]),H=r.useMemo((()=>M.tracklistFactory()),[M]);(0,r.useEffect)((()=>{null===N.column&&Q({column:x.QD.ADDED_AT,order:x.kn.DESC})}),[N,Q]);const $=(0,n.ur)(),q=(0,n.TH)(),W="POP"!==$?new URLSearchParams(q.search).get("uri"):null,{isPlaying:Z,togglePlay:X,usePlayContextItem:Y,isActive:J}=(0,S.n)((0,C.I)(l,(0,w.w)(N),_),{featureIdentifier:V,referrerIdentifier:"your_library"}),ee=()=>{const e=(0,O.aK)({isPlaying:Z,isActive:J,spec:M.actionBarFactory().playButtonFactory(),logger:z,uri:l});X({loggingParams:e})},te=(0,r.useCallback)(((e,t)=>{const a=M.actionBarFactory().downloadButtonFactory();t===I.mc.ADD?z.logInteraction(a.hitDownload({itemToDownload:l})):t===I.mc.REMOVE?z.logInteraction(a.hitRemoveDownload({itemToRemoveFromDownloads:l})):t===I.mc.NO_PERMISSION&&z.logInteraction(a.hitUiReveal())}),[z,M,l]);return(0,A.jsxs)("section",{role:"presentation",className:y.Z.playlist,"data-testid":"playlist-page",children:[(0,A.jsx)(g.$,{children:c.ag.get("playlist.page-title",i)}),(0,A.jsx)(D.s,{metadata:e.metadata,isPlaying:Z,togglePlay:ee,backgroundColor:L,specLikedSongs:G}),(0,A.jsx)(u.o,{backgroundColor:L,children:(0,A.jsxs)(u.F,{children:[v?(0,A.jsx)(h.$,{onClick:ee,isPlaying:Z,size:"lg",uri:l,ariaPauseLabel:c.ag.get("playlist.a11y.pause",i),ariaPlayLabel:c.ag.get("playlist.a11y.play",i)}):null,e.metadata.totalLength>0&&(0,A.jsx)(B.v,{uri:l,renderEnabled:()=>(0,A.jsx)(j.v,{uri:l})}),(0,A.jsx)(d.o,{uri:l,canDownload:P,isFollowing:!0,onFollow:()=>{},size:d.q.md,onClick:te}),t&&a&&(0,A.jsx)(T.Nh,{spec:M.actionBarFactory(),children:(0,A.jsx)(R,{tracklistDomRef:E})})]})}),(0,A.jsx)("div",{className:"contentSpacing",children:b>0?(0,A.jsx)(r.Suspense,{fallback:(0,A.jsx)(f.h,{hasError:!1,errorMessage:c.ag.get("error.request-collection-tracks-failure")}),children:(0,A.jsx)(T.Nh,{spec:H,children:(0,A.jsx)(U.p,{nrTracks:b,columns:K,collectionUri:l,scrollToUri:W,usePlayContextItem:Y,outerDomRef:E,spec:H,initialItems:e.contents.items})})}):(0,A.jsx)(m.u,{message:c.ag.get("collection.empty-page.songs-subtitle"),title:c.ag.get("collection.empty-page.songs-title"),linkTo:"/search",linkTitle:c.ag.get("collection.empty-page.songs-cta"),renderInline:!0,children:(0,A.jsx)(o.F,{"aria-hidden":"true"})})})]})},Z=r.memo((function({user:e,uri:t}){const{filter:a}=(0,r.useContext)(p.fo),{sortState:n}=(0,r.useContext)(k.Gb),o=function(e,t,a){const l=(0,r.useContext)(E.H),n=(0,N.useQueryClient)(),o=(0,Q.jP)((()=>["useLikedSongs",e,a]),[e,a]),{data:s}=(0,N.useQuery)(o(),(()=>l.getTracks(a)),{cacheTime:$,keepPreviousData:!0,refetchOnWindowFocus:!1}),i=(0,r.useCallback)((()=>{n.invalidateQueries(o())}),[n,o]);(0,z.b)(M.EW.UPDATE,i);const c=(0,H.I2)(t.id);return c&&s?{metadata:{uri:e,name:c.name,images:c.images,totalLength:s?.totalLength,unfilteredTotalLength:s.unfilteredTotalLength,owner:(0,G.V)(t)},contents:s}:null}(t,e,{offset:0,limit:25,sort:(0,w.w)(n),filter:a}),s=(0,r.useContext)(E.H).getCapabilities(),i=(0,l.v9)(_.n5),{isEnhanced:u}=(0,b.U)(`spotify:user:${i}:collection`);if(o){const e=(0,A.jsx)(W,{data:o,canFilter:s.canFilterTracksAndEpisodes&&o.metadata.unfilteredTotalLength>0,canSort:s.canSortTracksAndEpisodes&&o.metadata.unfilteredTotalLength>0});return(0,A.jsx)(B.v,{uri:o.metadata.uri,renderEnabled:()=>u?(0,A.jsx)(r.Suspense,{fallback:null,children:(0,A.jsx)(k.kz,{uri:o.metadata.uri,children:(0,A.jsx)(q,{metadata:{...o.metadata,collaborators:{count:1,items:[{isOwner:!0,user:o.metadata.owner,tracksAdded:o.metadata.totalLength}]}},capabilities:s,featureIdentifier:V})})}):e,renderDisabled:()=>e})}return(0,A.jsx)(f.h,{hasError:!1,errorMessage:c.ag.get("error.not_found.title.playlist"),loadOffline:s.canModifyOffline})})),X=()=>{const{user:e}=(0,l.v9)(_.Gg);if(null===e)return null;const t=(0,i.wG)(e.id).toURI();return(0,A.jsx)(k.kz,{uri:t,children:(0,A.jsx)(p.hz,{uri:t,children:(0,A.jsx)(Z,{uri:t,user:e})})})}},9284:(e,t,a)=>{a.d(t,{s:()=>r.s});var r=a(41987)}}]);
|
|
//# sourceMappingURL=xpui-routes-collection-songs.js.map
|