Files
ambersplace.net/cohost-archive/static/preact-components-pages-artist-alley-owner-manage-listings.eb878587ac2878d2a1ed.js

2 lines
9.1 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[3633],{70575:function(e,t,l){l.d(t,{H:function(){return n},h:function(){return r}});var a=l(94159);const n=a.createContext({adultFilterMode:"hide",isAdult:!1,categories:new Set,setAdultFilterMode:()=>{},categoryMatch:"any",setCategoryMatch:()=>{},sortOrder:"random",setSortOrder:()=>{}}),r=()=>(0,a.useContext)(n)},26225:function(e,t,l){l.d(t,{l:function(){return w}});var a=l(37111),n=l(76051),r=l(12093),s=l(94159),c=l(98074),o=l(62745),i=l(50196),m=l(46975),d=l(47071),u=l(51540),p=l(70575),g=l(55875),f=l(2403),E=l(96332),v=l(93410),b=l(44144);const h=({attachment:e})=>{const t=(0,o.Q)(),[l,a]=(0,s.useState)(t.gifsStartPaused?e.previewURL:e.fileURL),[n,r]=(0,s.useState)(!t.gifsStartPaused),c=(0,i.T)(l,300,1.2);return s.createElement("div",{className:"group relative"},s.createElement("img",{src:c(1),srcSet:`\n ${c(1)} 1x,\n ${c(2)} 2x,\n ${c(3)} 3x,\n `,alt:e.altText,className:"co-border aspect-[300/250] w-full border-b object-cover"}),e.previewURL!==e.fileURL&&s.createElement(d.I,{isPlaying:n,showPlay:e.previewURL!==e.fileURL,extraClasses:"absolute bottom-3 right-3 w-12",onPlay:()=>{r(!0),a(e.fileURL)},onPause:()=>{r(!1),a(e.previewURL)}}))},x=({listing:e})=>{const t=(0,s.useContext)(b.j);return s.createElement(g.v,{as:"div",className:"relative h-6"},s.createElement(g.v.Button,{className:"co-action-button cursor-pointer text-sm font-bold hover:underline"},s.createElement(E.Z,{className:"h-6 w-6 transition-transform ui-open:rotate-90"})),s.createElement(g.v.Items,{className:"co-meatball-items absolute right-0 top-8 z-30 flex min-w-max flex-col divide-y rounded-lg p-3 focus:!outline-none"},s.createElement(g.v.Item,null,s.createElement(v.X,{disabled:!1,onClick:()=>{t.send({type:"START_REPORT",artistAlleyListingId:e.id})},ItemIcon:f.Z,text:"report"}))))},w=({listing:e,project:t})=>{const l=(0,s.useMemo)((()=>(0,a.Ml)(e.body,new Date,{disableEmbeds:!0,externalLinksInNewTab:!0,hasCohostPlus:!1,renderingContext:"artistAlley"})),[e.body]),n=(0,c.rA)();return s.createElement("div",{"data-theme":n.current,className:"co-themed-box co-artist-alley-listing flex w-full flex-col rounded-lg border"},s.createElement("div",{className:"co-border flex flex-row items-center gap-2 border-b px-2 py-3"},s.createElement(u.t,{project:t,className:"h-8"}),s.createElement("a",{href:r.ZP.public.project.mainAppProfile({projectHandle:t.handle}).toString()},"@",t.handle),s.createElement("div",{className:"flex-1"}," "),e.adultContent?s.createElement("span",{className:"co-18-plus rounded-lg p-1 text-xs "},"18+"):null,s.createElement(x,{listing:e})),e.attachment&&s.createElement(h,{attachment:e.attachment}),s.createElement("div",{className:"co-prose prose p-2"},l),s.createElement("div",{className:"mx-2 my-3"},s.createElement(m.k,{as:"a",buttonColor:"",buttonSize:"regular",href:e.cta.link,extraClasses:"co-cta-button",target:"_blank"},e.cta.text)),e.categories.length>0&&s.createElement(N,{tags:e.categories}))},N=({tags:e})=>{const{categories:t}=(0,p.h)(),l=e.filter((e=>""!=e));return l.length?s.createElement("div",{className:"w-full max-w-full p-3"},s.createElement("div",{className:n.tw`co-tags relative w-full overflow-y-hidden break-words leading-none`},s.createElement("div",null,l.map((e=>s.createElement("button",{key:e,className:"mr-2 inline-block text-sm hover:underline "+(t.has(e)?"font-bold":""),onClick:()=>{t.has(e)?t.delete(e):t.add(e)}},"#",e)))))):null}},31389:function(e,t,l){l.r(t),l.d(t,{ArtistAlleyOwnerListingsPage:function(){return b},default:function(){return h}});var a=l(71860),n=l(8227),r=l(94159),s=l(20616),c=l(26225),o=l(84879),i=r.forwardRef((function({title:e,titleId:t,...l},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm.75-13a.75.75 0 00-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 000-1.5h-3.25V5z",clipRule:"evenodd"}))})),m=r.forwardRef((function({title:e,titleId:t,...l},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"}))})),d=r.forwardRef((function({title:e,titleId:t,...l},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z",clipRule:"evenodd"}))})),u=r.forwardRef((function({title:e,titleId:t,...l},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},l),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM8.94 6.94a.75.75 0 11-1.061-1.061 3 3 0 112.871 5.026v.345a.75.75 0 01-1.5 0v-.5c0-.72.57-1.172 1.081-1.287A1.5 1.5 0 108.94 6.94zM10 15a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}))}));const p=({status:e})=>{const t="expired"===e?i:"approved"===e?m:"rejected"===e?d:u;return r.createElement("span",{className:"block max-w-max rounded-lg px-3 py-2 "+("expired"===e?"bg-gray-300 text-notBlack":"approved"===e?"bg-green-600 text-notWhite contrast-more:bg-green-700":"pending"===e?"bg-longan text-notBlack":"bg-red-600 text-notWhite contrast-more:bg-red-700")},r.createElement(t,{className:"mr-2 inline-block h-4 w-4"}),e)},g=({listing:e,project:t})=>{const l="approved"===e.status&&new Date(e.expiresAt)<new Date?"expired":e.status;return r.createElement("div",{className:"flex w-full min-w-0 flex-row flex-wrap justify-between gap-4 "},r.createElement("div",{className:"flex-shrink space-y-3"},r.createElement(p,{status:l}),r.createElement("div",null,r.createElement("ul",{className:"space-y-3"},r.createElement("li",null,r.createElement("span",{className:"font-bold"},"purchase date:")," ",o.ou.fromISO(e.createdAt).toLocaleString(o.ou.DATETIME_FULL)),r.createElement("li",null,r.createElement("span",{className:"font-bold"},"weeks purchased:")," ",e.numWeeks),"approved"===e.status&&r.createElement("li",null,r.createElement("span",{className:"font-bold"},"end date:")," ",o.ou.fromISO(e.expiresAt).toLocaleString(o.ou.DATETIME_FULL)),e.receiptUrl&&r.createElement("li",null,r.createElement("a",{href:e.receiptUrl,rel:"noopener",target:"_blank",className:"font-bold underline"},"view receipt")),e.notes&&r.createElement("li",null,r.createElement("span",{className:"font-bold"},"submission notes:"),r.createElement("br",null),r.createElement("div",{className:"co-prose prose mt-2"},r.createElement("blockquote",null,e.notes))),e.rejectReason&&r.createElement("li",null,r.createElement("span",{className:"font-bold"},"rejection reason:"),r.createElement("br",null),r.createElement("div",{className:"co-prose prose mt-2"},r.createElement("blockquote",null,e.rejectReason)))))),r.createElement("div",{className:"w-full max-w-[300px] basis-[300px]"},r.createElement(c.l,{listing:e,project:t})))};var f=l(49750),E=l(46975),v=l(98074);const b=()=>{(0,n.if)();const[{pages:e},{hasNextPage:t,fetchNextPage:l,isFetching:c}]=a.S.artistAlley.getOwnerListings.useSuspenseInfiniteQuery({},{getNextPageParam:e=>e.nextCursor,refetchOnMount:!1,refetchOnWindowFocus:!1}),o=(0,r.useMemo)((()=>e.flatMap((e=>e.listings))??[]),[e]),i=(0,r.useMemo)((()=>{const t=new Map;return e.forEach((e=>{Object.values(e.relevantProjects).forEach((e=>{t.set(e.projectId,e)}))})),t}),[e]),m=(0,r.useMemo)((()=>o.map((e=>{const t=i.get(e.projectId);if(t)return{listing:e,project:t}})).filter(f.$)),[o,i]),d=(0,v.rA)();return r.createElement("main",{className:"w-full pt-16"},r.createElement("div",{className:"container mx-auto grid grid-cols-1 gap-16 lg:grid-cols-4"},r.createElement(s.w3,null),r.createElement("section",{className:" col-span-1 flex flex-col gap-12 lg:col-span-2"},r.createElement("div",{className:"co-themed-box co-settings rounded-lg p-3","data-theme":d.current},r.createElement("h1",{className:"co-settings-header"},"manage your listings"),r.createElement("hr",{className:"mt-6"}),r.createElement("div",{className:"my-6 flex flex-col space-y-3"},m?.map((e=>r.createElement(r.Fragment,{key:e.listing.id},r.createElement(g,{listing:e.listing,project:e.project}),r.createElement("hr",null))))),r.createElement(E.k,{as:"button",buttonColor:"theme-sensitive-1",buttonSize:"regular",disabled:c||!t,onClick:()=>l()},c?"loading...":t?"load more":"no more listings")))))};var h=b}}]);
//# sourceMappingURL=preact-components-pages-artist-alley-owner-manage-listings.eb878587ac2878d2a1ed.js.map