pixelfed/public/js/dms-ojtjadoml.js
2022-05-18 03:11:39 -06:00

1 line
8.7 KiB
JavaScript
Vendored

"use strict";(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[888],{3247:(t,e,a)=>{a.r(e),a.d(e,{default:()=>o});var s=a(42755),i=a(88231),n=a(33795),r=a(78423);const o={components:{drawer:s.default,sidebar:i.default,intersect:r.default,"dm-placeholder":n.default},data:function(){return{isLoaded:!1,profile:void 0,canLoadMore:!0,threadsLoaded:!1,composeLoading:!1,threads:[],tabIndex:0,tabs:["inbox","sent","requests"],page:1,ids:[],isIntersecting:!1}},mounted:function(){this.profile=window._sharedData.user,this.isLoaded=!0,this.fetchThreads()},methods:{fetchThreads:function(){var t=this;axios.get("/api/v1/conversations",{params:{scope:this.tabs[this.tabIndex]}}).then((function(e){var a=e.data.filter((function(t){return t&&t.hasOwnProperty("last_status")&&t.last_status})),s=a.map((function(t){return t.accounts[0].id}));t.ids=s,t.threads=a,t.threadsLoaded=!0,t.page++}))},timeago:function(t){return App.util.format.timeAgo(t)},enterIntersect:function(){var t=this;this.isIntersecting||(this.isIntersecting=!0,axios.get("/api/v1/conversations",{params:{scope:this.tabs[this.tabIndex],page:this.page}}).then((function(e){if(e.data.filter((function(t){return t&&t.hasOwnProperty("last_status")&&t.last_status})).forEach((function(e){-1==t.ids.indexOf(e.accounts[0].id)&&(t.ids.push(e.accounts[0].id),t.threads.push(e))})),!e.data.length||e.data.length<5)return t.canLoadMore=!1,void(t.isIntersecting=!1);t.page++,t.isIntersecting=!1})))},toggleTab:function(t){event.currentTarget.blur(),this.threadsLoaded=!1,this.page=1,this.tabIndex=t,this.fetchThreads()},threadSummary:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50;if("photo"==t.pf_type){var a=this.profile.id==t.account.id,s='<div class="'+(a?"text-muted":"text-primary")+' border px-2 py-1 mt-1 rounded" style="font-size:11px;width: fit-content"><i class="far fa-image mr-1"></i> <span>';return(s+=a?"Sent a photo":"Received a photo")+"</span></div>"}if("video"==t.pf_type){var i=this.profile.id==t.account.id,n='<div class="'+(i?"text-muted":"text-primary")+' border px-2 py-1 mt-1 rounded" style="font-size:11px;width: fit-content"><i class="far fa-video mr-1"></i> <span>';return(n+=i?"Sent a video":"Received a video")+"</span></div>"}var r="";this.profile.id==t.account.id&&(r+='<i class="far fa-reply-all fa-flip-both"></i> ');var o=t.content,d=o.replace(/(<([^>]+)>)/gi,"");return d.length>e?r+d.slice(0,e)+"...":r+d},openCompose:function(){this.$refs.compose.show()},composeSearch:function(t){if(t.length<1)return[];return axios.post("/api/direct/lookup",{q:t}).then((function(t){return t.data}))},getTagResultValue:function(t){return t.local?"@"+t.name:t.name},onTagSubmitLocation:function(t){this.composeLoading=!0,window.location.href="/i/web/direct/thread/"+t.id},closeCompose:function(){this.$refs.compose.hide()}}}},56585:(t,e,a)=>{a.r(e),a.d(e,{default:()=>n});var s=a(23645),i=a.n(s)()((function(t){return t[1]}));i.push([t.id,".dms-page-component[data-v-77b89521]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif}.dms-page-component .dm-thread-summary[data-v-77b89521]{font-size:12px;line-height:12px;margin-bottom:0}.dms-page-component .dm-display-name[data-v-77b89521]{font-size:16px}",""]);const n=i},19385:(t,e,a)=>{a.r(e),a.d(e,{default:()=>o});var s=a(93379),i=a.n(s),n=a(56585),r={insert:"head",singleton:!1};i()(n.default,r);const o=n.default.locals||{}},59502:(t,e,a)=>{a.r(e),a.d(e,{default:()=>r});var s=a(52888),i=a(18211),n={};for(const t in i)"default"!==t&&(n[t]=()=>i[t]);a.d(e,n);a(57972);const r=(0,a(51900).default)(i.default,s.render,s.staticRenderFns,!1,null,"77b89521",null).exports},33795:(t,e,a)=>{a.r(e),a.d(e,{default:()=>i});var s=a(56622);const i=(0,a(51900).default)({},s.render,s.staticRenderFns,!1,null,null,null).exports},18211:(t,e,a)=>{a.r(e),a.d(e,{default:()=>n});var s=a(3247),i={};for(const t in s)"default"!==t&&(i[t]=()=>s[t]);a.d(e,i);const n=s.default},57972:(t,e,a)=>{a.r(e);var s=a(19385),i={};for(const t in s)"default"!==t&&(i[t]=()=>s[t]);a.d(e,i)},52888:(t,e,a)=>{a.r(e);var s=a(38871),i={};for(const t in s)"default"!==t&&(i[t]=()=>s[t]);a.d(e,i)},56622:(t,e,a)=>{a.r(e);var s=a(8580),i={};for(const t in s)"default"!==t&&(i[t]=()=>s[t]);a.d(e,i)},38871:(t,e,a)=>{a.r(e),a.d(e,{render:()=>s,staticRenderFns:()=>i});var s=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"dms-page-component"},[t.isLoaded?a("div",{staticClass:"container-fluid mt-3"},[a("div",{staticClass:"row"},[a("div",{staticClass:"col-md-3 d-md-block"},[a("sidebar",{attrs:{user:t.profile}})],1),t._v(" "),a("div",{staticClass:"col-md-5 offset-md-1 mb-5 order-2 order-md-1"},[a("h1",{staticClass:"font-weight-bold mb-4"},[t._v("Direct Messages")]),t._v(" "),t.threadsLoaded?a("div",[t._l(t.threads,(function(e,s){return a("div",{staticClass:"card shadow-sm mb-1",staticStyle:{"border-radius":"15px"}},[a("div",{staticClass:"card-body p-3"},[a("div",{staticClass:"media"},[a("img",{staticClass:"shadow-sm mr-3",staticStyle:{"border-radius":"15px"},attrs:{src:e.accounts[0].avatar,width:"45",height:"45",onerror:"this.onerror=null;this.src='/storage/avatars/default.png?v=0';"}}),t._v(" "),a("div",{staticClass:"media-body"},[a("div",{staticClass:"d-flex justify-content-between align-items-start mb-1"},[a("p",{staticClass:"dm-display-name font-weight-bold mb-0"},[t._v("@"+t._s(e.accounts[0].acct))]),t._v(" "),a("p",{staticClass:"font-weight-bold small text-muted mb-0"},[t._v(t._s(t.timeago(e.last_status.created_at))+" ago")])]),t._v(" "),a("p",{staticClass:"dm-thread-summary text-muted mr-4",domProps:{innerHTML:t._s(t.threadSummary(e.last_status))}})]),t._v(" "),a("router-link",{staticClass:"btn btn-link stretched-link align-self-center mr-n3",attrs:{to:"/i/web/direct/thread/"+e.accounts[0].id}},[a("i",{staticClass:"fal fa-chevron-right fa-lg text-lighter"})])],1)])])})),t._v(" "),t.threads&&t.threads.length?t._e():a("div",{staticClass:"row justify-content-center"},[t._m(0)]),t._v(" "),t.canLoadMore?a("div",[a("intersect",{on:{enter:t.enterIntersect}},[a("dm-placeholder")],1)],1):t._e()],2):a("div",[a("dm-placeholder")],1)]),t._v(" "),a("div",{staticClass:"col-md-3 d-md-block order-1 order-md-2 mb-4"},[a("button",{staticClass:"btn btn-dark shadow-sm font-weight-bold btn-block",on:{click:t.openCompose}},[a("i",{staticClass:"far fa-envelope mr-1"}),t._v(" Compose")]),t._v(" "),a("hr"),t._v(" "),a("div",{staticClass:"d-flex d-md-block"},t._l(t.tabs,(function(e,s){return a("button",{staticClass:"btn shadow-sm font-weight-bold btn-block text-capitalize mt-0 mt-md-2 mx-1 mx-md-0",class:[s===t.tabIndex?"btn-primary":"btn-light"],on:{click:function(e){return t.toggleTab(s)}}},[t._v("\n\t\t\t\t\t\t\t"+t._s(t.$t("directMessages."+e))+"\n\t\t\t\t\t")])})),0)])]),t._v(" "),a("drawer")],1):a("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"calc(100vh - 58px)"}},[a("b-spinner")],1),t._v(" "),a("b-modal",{ref:"compose",attrs:{"hide-header":"","hide-footer":"",centered:"",rounded:"",size:"md"}},[a("div",{staticClass:"card shadow-none mt-4"},[a("div",{staticClass:"card-body d-flex align-items-center justify-content-between flex-column",staticStyle:{"min-height":"50vh"}},[a("h3",{staticClass:"font-weight-bold"},[t._v("New Direct Message")]),t._v(" "),a("div",[a("p",{staticClass:"mb-0 font-weight-bold"},[t._v("Select Recipient")]),t._v(" "),a("autocomplete",{ref:"autocomplete",attrs:{search:t.composeSearch,disabled:t.composeLoading,placeholder:"@dansup","aria-label":"Search usernames","get-result-value":t.getTagResultValue},on:{submit:t.onTagSubmitLocation}}),t._v(" "),a("p",{staticClass:"small text-muted"},[t._v("Search by username, or webfinger (@dansup@pixelfed.social)")]),t._v(" "),a("div",{staticStyle:{width:"300px"}})],1),t._v(" "),a("div",[a("button",{staticClass:"btn btn-outline-dark rounded-pill font-weight-bold px-5 py-1",on:{click:t.closeCompose}},[t._v("Cancel")])])])])])],1)},i=[function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"col-12 text-center"},[a("img",{staticClass:"img-fluid",staticStyle:{opacity:"0.6"},attrs:{src:"/img/illustrations/dk-nature-man-monochrome.svg"}}),t._v(" "),a("p",{staticClass:"lead text-muted font-weight-bold"},[t._v("Your inbox is empty")])])}]},8580:(t,e,a)=>{a.r(e),a.d(e,{render:()=>s,staticRenderFns:()=>i});var s=function(){var t=this,e=t.$createElement;t._self._c;return t._m(0)},i=[function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"ph-item border-0 shadow-sm p-1",staticStyle:{"border-radius":"15px","margin-bottom":"1rem"}},[a("div",{staticClass:"ph-col-12"},[a("div",{staticClass:"ph-row align-items-center mt-0"},[a("div",{staticClass:"ph-avatar mr-3 d-flex",staticStyle:{"min-width":"40px",width:"40px!important",height:"40px!important","border-radius":"15px"}}),t._v(" "),a("div",{staticClass:"ph-col-6 big"})])])])}]}}]);