Files
ambersplace.net/cohost-archive/static/client-preact-components-pages-project-page-view.63cef228fcf81849ae53.js

2 lines
12 KiB
JavaScript
Raw 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([[7125],{11876:function(e,t,n){n.r(t);var a=n(18196),r=n(12093),o=n(94159),l=n(90275),i=n(92831),c=n(31009),s=n(60553),p=n(35409);const m=e=>{const[t,n]=(0,i.v)("hideReplies",(!1).toString()),m="true"===t,[d,u]=(0,i.v)("hideShares",(!1).toString()),g="true"===d,[h,f]=(0,i.v)("hideAsks",(!1).toString()),E="true"===h;return o.createElement(o.Fragment,null,o.createElement(l.ql,{title:`@${e.project.handle}`},o.createElement("link",{rel:"alternate",title:`@${e.project.handle} on cohost`,type:"application/feed+json",href:r.ZP.public.project.rss.publicJson({projectHandle:e.project.handle}).toString()}),o.createElement("link",{rel:"alternate",title:`@${e.project.handle} on cohost`,type:"application/atom+xml",href:r.ZP.public.project.rss.publicAtom({projectHandle:e.project.handle}).toString()})),o.createElement("div",{className:"container mx-auto flex flex-grow flex-col"},o.createElement(a.Z,e,o.createElement(c.b4,{project:e.project}),o.createElement(s.Z,{hideReplies:m,hideShares:g,hideAsks:E,setHideReplies:e=>n(e.toString()),setHideShares:e=>u(e.toString()),setHideAsks:e=>f(e.toString())}),o.createElement(p.Z,{handle:e.project.handle,viewingOnProjectPage:!0,pinnedPostsAtTop:!0,hideReplies:m,hideShares:g,hideAsks:E,startingPageNumber:e.startingPageNumber}))))};t.default=m,m.displayName="project-page-view"},31009:function(e,t,n){n.d(t,{b4:function(){return s},vv:function(){return p},w_:function(){return c}});var a=n(22233),r=n(12093),o=n(85771),l=n(94159),i=n(90275);const c=({viewModel:e})=>{const t=(0,l.useMemo)((()=>e.transparentShareOfPostId?e.shareTree.find((t=>t.postId===e.transparentShareOfPostId))??e:e),[e]),n=(0,l.useMemo)((()=>(0,o.Jp)(t.blocks)),[t.blocks]),c=`${t.postingProject.displayName?t.postingProject.displayName:`@${t.postingProject.handle}`} on cohost`;return l.createElement(i.ql,null,l.createElement("meta",{property:"og:site_name",content:c}),t.headline?l.createElement("meta",{property:"og:title",content:t.headline}):l.createElement("meta",{property:"og:title",content:c}),l.createElement("meta",{property:"og:description",content:(0,a.BS)(t,{myPost:!1,skipHeadline:!0})}),l.createElement("meta",{property:"og:type",content:"article"}),l.createElement("meta",{property:"article:published_time",content:t.publishedAt}),l.createElement("meta",{property:"article:author",content:r.ZP.public.project.mainAppProfile({projectHandle:t.postingProject.handle}).toString()}),l.createElement("meta",{property:"og:url",content:e.singlePostPageUrl.toString()}),l.createElement("link",{href:e.singlePostPageUrl.toString(),rel:"alternate",type:"application/activity+json"}),t.tags.map((e=>l.createElement("meta",{property:"article:tag",content:e,key:e}))),t.effectiveAdultContent||0!==t.cws.length?null:n.map((e=>{switch(e.attachment.kind){case"image":return l.createElement("meta",{key:e.attachment.attachmentId,property:"og:image",content:e.attachment.fileURL});case"audio":return l.createElement("meta",{key:e.attachment.attachmentId,property:"og:audio",content:e.attachment.fileURL})}})),n.length?l.createElement("meta",{property:"twitter:card",content:"summary_large_image"}):function({props:{children:e}},t){return l.Children.toArray(e).filter(l.isValidElement).map(((e,n)=>(0,l.cloneElement)(e,{key:`${t}-${n}`})))}(l.createElement(l.Fragment,null,l.createElement("meta",{property:"og:image",content:t.postingProject.avatarURL}),l.createElement("meta",{property:"og:image:alt",content:t.postingProject.handle}),l.createElement("meta",{property:"og:image:width",content:"128"}),l.createElement("meta",{property:"og:image:height",content:"128"}),l.createElement("meta",{property:"twitter:card",content:"summary"})),"avatar"))},s=({project:e})=>{const t=`${e.displayName?e.displayName:`@${e.handle}`} on cohost`;return l.createElement(i.ql,null,l.createElement("meta",{property:"og:site_name",content:"cohost"}),l.createElement("meta",{property:"og:title",content:t}),e.dek?l.createElement("meta",{property:"og:description",content:e.dek}):null,l.createElement("meta",{property:"og:type",content:"profile"}),e.displayName?l.createElement("meta",{property:"profile:first_name",content:e.displayName}):null,l.createElement("meta",{property:"profile:username",content:e.handle}),l.createElement("meta",{property:"og:url",content:r.ZP.public.project.mainAppProfile({projectHandle:e.handle}).toString()}),l.createElement("meta",{property:"og:image",content:e.avatarURL}),l.createElement("meta",{property:"og:image:alt",content:e.handle}),l.createElement("meta",{property:"og:image:width",content:"128"}),l.createElement("meta",{property:"og:image:height",content:"128"}),l.createElement("meta",{property:"twitter:card",content:"summary"}))},p=({tagName:e})=>l.createElement(i.ql,null,l.createElement("meta",{property:"og:site_name",content:"cohost"}),l.createElement("meta",{property:"og:title",content:`#${e} on cohost`}),l.createElement("meta",{property:"og:description",content:`read more posts about #${e} on cohost`}),l.createElement("meta",{property:"og:type",content:"website"}),l.createElement("meta",{property:"og:url",content:r.ZP.public.tags({tagSlug:e}).toString()}),l.createElement("meta",{property:"twitter:card",content:"summary"}))},46196:function(e,t,n){n.d(t,{A:function(){return s},Z:function(){return p}});var a=n(94159),r=a.forwardRef((function({title:e,titleId:t,...n},r){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"}))})),o=n(65443),l=n.n(o),i=n(88658);const c=l()("h-8","pr-3","fill-secondary","text-notWhite","cohost-shadow-light","dark:cohost-shadow-dark","dark:text-notBlack"),s=({backLink:e,forwardLink:t,condensed:n=!1,backOnClick:o,forwardOnClick:l})=>a.createElement("div",{className:"mb-12 flex flex-row gap-x-6"},n?null:a.createElement("span",{className:"hidden w-16 lg:block"}," "),e?a.createElement("a",{href:e,onClick:o},a.createElement(i.OZ,{className:`${c} scale-x-[-1]`},a.createElement(r,null))):null,a.createElement("span",{className:"flex-grow"}," "),t?a.createElement("a",{href:t,onClick:l},a.createElement(i.OZ,{className:c},a.createElement(r,null))):null);var p=s},60553:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(94159),r=n(86058);const o=e=>{const[t,n]=(0,a.useState)(e.initial??!1),o="py-2 px-2 text-cherry-700 md:px-3",l="rounded-lg bg-cherry-500 py-2 px-2 text-notWhite md:px-3 font-bold";return a.createElement(r.r.Group,null,a.createElement(r.r.Label,{className:"sr-only"},e.onLabel),a.createElement(r.r,{checked:t,onChange:t=>{n(t),e.onChange(t)},className:"inline-flex w-fit items-center rounded-lg bg-cherry-300 text-base leading-none"},a.createElement("span",{className:t?o:l},e.offLabel),a.createElement("span",{className:t?l:o},e.onLabel)))};var l=e=>a.createElement("div",{className:"mt-4 flex flex-row gap-4"},a.createElement(o,{offLabel:"show shares",onLabel:"hide shares",onChange:t=>e.setHideShares(t),initial:e.hideShares}),a.createElement(o,{offLabel:"show replies",onLabel:"hide replies",onChange:t=>e.setHideReplies(t),initial:e.hideReplies}),a.createElement(o,{offLabel:"show asks",onLabel:"hide asks",onChange:t=>e.setHideAsks(t),initial:e.hideAsks}))},35409:function(e,t,n){n.d(t,{Z:function(){return p}});var a=n(71860),r=n(62745),o=n(92831),l=n(94159),i=n(33448),c=n(46479),s=n(46196);const p=({handle:e,pinnedPostsAtTop:t,hideReplies:n,hideShares:p,hideAsks:m,viewingOnProjectPage:d=!1,keepPreviousData:u=!0,startingPageNumber:g=0})=>{const h=(0,r.Q)(),[f,E]=(0,l.useTransition)(),[y,k]=(0,o.v)("page",g.toString()),v=parseInt(y??"0")||0,b=a.S.posts.profilePosts.useQuery({projectHandle:e,page:v,options:{pinnedPostsAtTop:t,hideReplies:n,hideShares:p,hideAsks:m,viewingOnProjectPage:d}},{suspense:!0,keepPreviousData:u}),P=(0,l.useMemo)((()=>null!==b.data?.pagination.nextPage&&void 0!==b.data?.pagination.nextPage),[b.data?.pagination.nextPage]),w=(0,l.useMemo)((()=>null!==b.data?.pagination.previousPage&&void 0!==b.data?.pagination.previousPage),[b.data?.pagination.previousPage]),S=(0,l.useCallback)((()=>{const e=b.data?.pagination.previousPage;null!=e&&E((()=>{k(e.toString())}))}),[b.data?.pagination.previousPage,k]),x=(0,l.useCallback)((()=>{const e=b.data?.pagination.nextPage;null!=e&&E((()=>{k(e.toString())}))}),[b.data?.pagination.nextPage,k]),j=(0,l.useMemo)((()=>{if(w)return()=>S()}),[w,S]),L=(0,l.useMemo)((()=>{if(w)return"#"}),[w]),C=(0,l.useMemo)((()=>{if(P)return()=>x()}),[P,x]),N=(0,l.useMemo)((()=>{if(P)return"#"}),[P]);return(0,l.useEffect)((()=>{k(g.toString())}),[e]),l.createElement("div",{className:"mt-4 flex w-fit flex-col gap-4"},b.data?.posts.map(((e,t)=>l.createElement(i.Z,{key:e.postId,initialVisible:t<4,stayRendered:!0},l.createElement(c.G,{viewModel:e,highlightedTags:[],condensed:!0,skipCollapse:!1,displayPrefs:h,commentThreads:void 0})))),l.createElement("div",{className:"max-w-prose"},l.createElement(s.Z,{condensed:!0,backOnClick:j,backLink:L,forwardLink:N,forwardOnClick:C})))}},92831:function(e,t,n){n.d(t,{v:function(){return r}});var a=n(60824);const r=(e,t)=>{const[n,r]=(0,a.lr)();return[n.get(e)??t,t=>{r((n=>(n.set(e,t),n)))}]}},86058:function(e,t,n){n.d(t,{r:function(){return x}});var a=n(94159),r=n(56018),o=n(17881),l=n(92302),i=n(29890),c=n(79211),s=n(76023),p=n(62450);let m=(0,a.createContext)(null);function d(){let e=(0,a.useContext)(m);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,d),e}return e}function u(){let[e,t]=(0,a.useState)([]);return[e.length>0?e.join(" "):void 0,(0,a.useMemo)((()=>function(e){let n=(0,p.z)((e=>(t((t=>[...t,e])),()=>t((t=>{let n=t.slice(),a=n.indexOf(e);return-1!==a&&n.splice(a,1),n}))))),r=(0,a.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return a.createElement(m.Provider,{value:r},e.children)}),[t])]}let g=(0,r.yV)((function(e,t){let n=(0,o.M)(),{id:a=`headlessui-label-${n}`,passive:l=!1,...i}=e,p=d(),m=(0,s.T)(t);(0,c.e)((()=>p.register(a)),[a,p.register]);let u={ref:m,...p.props,id:a};return l&&("onClick"in u&&(delete u.htmlFor,delete u.onClick),"onClick"in i&&delete i.onClick),(0,r.sY)({ourProps:u,theirProps:i,slot:p.slot||{},defaultTag:"label",name:p.name||"Label"})})),h=Object.assign(g,{});var f=n(48878),E=n(12929),y=n(56910),k=n(98009),v=n(55871),b=n(41452);let P=(0,a.createContext)(null);P.displayName="GroupContext";let w=a.Fragment,S=(0,r.yV)((function(e,t){let n=(0,o.M)(),{id:c=`headlessui-switch-${n}`,checked:m,defaultChecked:d=!1,onChange:u,name:g,value:h,form:f,...w}=e,S=(0,a.useContext)(P),x=(0,a.useRef)(null),j=(0,s.T)(x,t,null===S?null:S.setSwitch),[L,C]=(0,v.q)(m,u,d),N=(0,p.z)((()=>null==C?void 0:C(!L))),A=(0,p.z)((e=>{if((0,i.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),N()})),_=(0,p.z)((e=>{e.key===l.R.Space?(e.preventDefault(),N()):e.key===l.R.Enter&&(0,k.g)(e.currentTarget)})),O=(0,p.z)((e=>e.preventDefault())),M=(0,a.useMemo)((()=>({checked:L})),[L]),R={id:c,ref:j,role:"switch",type:(0,E.f)(e,x),tabIndex:0,"aria-checked":L,"aria-labelledby":null==S?void 0:S.labelledby,"aria-describedby":null==S?void 0:S.describedby,onClick:A,onKeyUp:_,onKeyPress:O},T=(0,b.G)();return(0,a.useEffect)((()=>{var e;let t=null==(e=x.current)?void 0:e.closest("form");t&&void 0!==d&&T.addEventListener(t,"reset",(()=>{C(d)}))}),[x,C]),a.createElement(a.Fragment,null,null!=g&&L&&a.createElement(y._,{features:y.A.Hidden,...(0,r.oA)({as:"input",type:"checkbox",hidden:!0,readOnly:!0,form:f,checked:L,name:g,value:h})}),(0,r.sY)({ourProps:R,theirProps:w,slot:M,defaultTag:"button",name:"Switch"}))})),x=Object.assign(S,{Group:function(e){var t;let[n,o]=(0,a.useState)(null),[l,i]=u(),[c,s]=(0,f.f)(),p=(0,a.useMemo)((()=>({switch:n,setSwitch:o,labelledby:l,describedby:c})),[n,o,l,c]),m=e;return a.createElement(s,{name:"Switch.Description"},a.createElement(i,{name:"Switch.Label",props:{htmlFor:null==(t=p.switch)?void 0:t.id,onClick(e){n&&("LABEL"===e.currentTarget.tagName&&e.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},a.createElement(P.Provider,{value:p},(0,r.sY)({ourProps:{},theirProps:m,defaultTag:w,name:"Switch.Group"}))))},Label:h,Description:f.d})}}]);
//# sourceMappingURL=client-preact-components-pages-project-page-view.63cef228fcf81849ae53.js.map