forked from AkkomaGang/akkoma
2 lines
No EOL
6.7 KiB
JavaScript
2 lines
No EOL
6.7 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[69],{844:function(t,e,a){"use strict";a.r(e),a.d(e,"default",(function(){return S}));var n,s=a(0),o=a(2),i=(a(9),a(6),a(8)),c=a(1),r=a(1148),l=a.n(r),u=a(3),d=a.n(u),h=a(15),g=a(1059),p=a(760),m=a(758),b=a(7),f=a(307),O=a.n(f),j=a(1176);var v,_=Object(b.f)({placeholder:{id:"hashtag.column_settings.select.placeholder",defaultMessage:"Enter hashtags…"},noOptions:{id:"hashtag.column_settings.select.no_options_message",defaultMessage:"No suggestions found"}}),M=Object(b.g)(n=function(t){Object(i.a)(a,t);var e;e=a;function a(){for(var e,a=arguments.length,n=new Array(a),s=0;s<a;s++)n[s]=arguments[s];return e=t.call.apply(t,[this].concat(n))||this,Object(c.a)(Object(o.a)(e),"state",{open:e.hasTags()}),Object(c.a)(Object(o.a)(e),"onSelect",(function(t){return function(a){return e.props.onChange(["tags",t],a)}})),Object(c.a)(Object(o.a)(e),"onToggle",(function(){e.state.open&&e.hasTags()&&e.props.onChange("tags",{}),e.setState({open:!e.state.open})})),Object(c.a)(Object(o.a)(e),"noOptionsMessage",(function(){return e.props.intl.formatMessage(_.noOptions)})),e}var n=a.prototype;return n.hasTags=function(){var t=this;return["all","any","none"].map((function(e){return t.tags(e).length>0})).includes(!0)},n.tags=function(t){var e=this.props.settings.getIn(["tags",t])||[];return e.toJSON?e.toJSON():e},n.modeSelect=function(t){return Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)("span",{className:"column-settings__section"},void 0,this.modeLabel(t)),Object(s.a)(j.a,{isMulti:!0,autoFocus:!0,value:this.tags(t),onChange:this.onSelect(t),loadOptions:this.props.onLoad,className:"column-select__container",classNamePrefix:"column-select",name:"tags",placeholder:this.props.intl.formatMessage(_.placeholder),noOptionsMessage:this.noOptionsMessage}))},n.modeLabel=function(t){switch(t){case"any":return Object(s.a)(b.b,{id:"hashtag.column_settings.tag_mode.any",defaultMessage:"Any of these"});case"all":return Object(s.a)(b.b,{id:"hashtag.column_settings.tag_mode.all",defaultMessage:"All of these"});case"none":return Object(s.a)(b.b,{id:"hashtag.column_settings.tag_mode.none",defaultMessage:"None of these"});default:return""}},n.render=function(){return Object(s.a)("div",{},void 0,Object(s.a)("div",{className:"column-settings__row"},void 0,Object(s.a)("div",{className:"setting-toggle"},void 0,Object(s.a)(O.a,{id:"hashtag.column_settings.tag_toggle",onChange:this.onToggle,checked:this.state.open}),Object(s.a)("span",{className:"setting-toggle__label"},void 0,Object(s.a)(b.b,{id:"hashtag.column_settings.tag_toggle",defaultMessage:"Include additional tags in this column"})))),this.state.open&&Object(s.a)("div",{className:"column-settings__hashtags"},void 0,this.modeSelect("any"),this.modeSelect("all"),this.modeSelect("none")))},a}(d.a.PureComponent))||n,y=a(252),w=a(13),I=Object(h.connect)((function(t,e){var a=e.columnId,n=t.getIn(["settings","columns"]),s=n.findIndex((function(t){return t.get("uuid")===a}));return a&&s>=0?{settings:n.get(s).get("params")}:{}}),(function(t,e){var a=e.columnId;return{onChange:function(e,n){t(Object(y.f)(a,e,n))},onLoad:function(t){return Object(w.a)().get("/api/v2/search",{params:{q:t,type:"hashtags"}}).then((function(t){return(t.data.hashtags||[]).map((function(t){return{value:t.name,label:"#"+t.name}}))}))}}}))(M),C=a(34),N=a(765);var S=Object(h.connect)((function(t,e){return{hasUnread:t.getIn(["timelines","hashtag:"+e.params.id,"unread"])>0}}))(v=function(t){Object(i.a)(a,t);var e;e=a;function a(){for(var e,a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return e=t.call.apply(t,[this].concat(n))||this,Object(c.a)(Object(o.a)(e),"disconnects",[]),Object(c.a)(Object(o.a)(e),"handlePin",(function(){var t=e.props,a=t.columnId,n=t.dispatch;n(a?Object(y.h)(a):Object(y.e)("HASHTAG",{id:e.props.params.id}))})),Object(c.a)(Object(o.a)(e),"title",(function(){var t=[e.props.params.id];return e.additionalFor("any")&&t.push(" ",Object(s.a)(b.b,{id:"hashtag.column_header.tag_mode.any",values:{additional:e.additionalFor("any")},defaultMessage:"or {additional}"},"any")),e.additionalFor("all")&&t.push(" ",Object(s.a)(b.b,{id:"hashtag.column_header.tag_mode.all",values:{additional:e.additionalFor("all")},defaultMessage:"and {additional}"},"all")),e.additionalFor("none")&&t.push(" ",Object(s.a)(b.b,{id:"hashtag.column_header.tag_mode.none",values:{additional:e.additionalFor("none")},defaultMessage:"without {additional}"},"none")),t})),Object(c.a)(Object(o.a)(e),"additionalFor",(function(t){var a=e.props.params.tags;return a&&(a[t]||[]).length>0?a[t].map((function(t){return t.value})).join("/"):""})),Object(c.a)(Object(o.a)(e),"handleMove",(function(t){var a=e.props,n=a.columnId;(0,a.dispatch)(Object(y.g)(n,t))})),Object(c.a)(Object(o.a)(e),"handleHeaderClick",(function(){e.column.scrollTop()})),Object(c.a)(Object(o.a)(e),"setRef",(function(t){e.column=t})),Object(c.a)(Object(o.a)(e),"handleLoadMore",(function(t){var a=e.props.params,n=a.id,s=a.tags;e.props.dispatch(Object(C.t)(n,{maxId:t,tags:s}))})),e}var n=a.prototype;return n._subscribe=function(t,e,a){var n=this;void 0===a&&(a={});var s=(a.any||[]).map((function(t){return t.value})),o=(a.all||[]).map((function(t){return t.value})),i=(a.none||[]).map((function(t){return t.value}));[e].concat(s).map((function(a){n.disconnects.push(t(Object(N.c)(e,a,(function(t){var e=t.tags.map((function(t){return t.name}));return o.filter((function(t){return e.includes(t)})).length===o.length&&0===i.filter((function(t){return e.includes(t)})).length}))))}))},n._unsubscribe=function(){this.disconnects.map((function(t){return t()})),this.disconnects=[]},n.componentDidMount=function(){var t=this.props.dispatch,e=this.props.params,a=e.id,n=e.tags;this._subscribe(t,a,n),t(Object(C.t)(a,{tags:n}))},n.componentWillReceiveProps=function(t){var e=this.props,a=e.dispatch,n=e.params,s=t.params,o=s.id,i=s.tags;o===n.id&&l()(i,n.tags)||(this._unsubscribe(),this._subscribe(a,o,i),this.props.dispatch(Object(C.k)("hashtag:"+o)),this.props.dispatch(Object(C.t)(o,{tags:i})))},n.componentWillUnmount=function(){this._unsubscribe()},n.render=function(){var t=this.props,e=t.hasUnread,a=t.columnId,n=t.multiColumn,o=this.props.params.id,i=!!a;return d.a.createElement(p.a,{ref:this.setRef,name:"hashtag",label:"#"+o},Object(s.a)(m.a,{icon:"hashtag",active:e,title:this.title(),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:i,multiColumn:n,showBackButton:!0,bindToDocument:!n},void 0,a&&Object(s.a)(I,{columnId:a})),Object(s.a)(g.a,{trackScroll:!i,scrollKey:"hashtag_timeline-"+a,timelineId:"hashtag:"+o,onLoadMore:this.handleLoadMore,emptyMessage:Object(s.a)(b.b,{id:"empty_column.hashtag",defaultMessage:"There is nothing in this hashtag yet."}),bindToDocument:!n}))},a}(d.a.PureComponent))||v}}]);
|
|
//# sourceMappingURL=hashtag_timeline.js.map
|