-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnews.9244c19f650188c2a728.js
1 lines (1 loc) · 4.06 KB
/
news.9244c19f650188c2a728.js
1
(this.webpackChunkRuDEX3_light=this.webpackChunkRuDEX3_light||[]).push([[697],{97889:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>_});var n=s(67294),a=s(112),r=s.n(a),l=s(82167),i=s(95125),c=s(58074),o=s.n(c),d=s(52531),u=s(13973),m=(s(39014),s(89449)),h=s(774);const p={textAlign:"right"},E={textAlign:"left"},g={height:"2rem"},w={padding:"0.5rem 1rem"},L={padding:"0.85rem 1rem"},y={...E,...w},b={...p,...w},D={...E,...L},k={...p,...L},f={...y,width:"180px"},v=()=>n.createElement("p",null,n.createElement(o(),{content:"news.errors.fetch"})),N=({data:e,locale:t,url:s,isLink:a=!1})=>n.createElement("a",{href:"ru"==t?`https://golos.id${s}`:`https://steemit.com${s}`,rel:"noreferrer noopener",target:"_blank",style:{display:"block"},className:a?"external-link":"primary-text"},u.Z.sanitize(e)),x=({data:e,width:t,locale:s})=>n.createElement("table",{className:"table table-hover dashboard-table",style:{fontSize:"0.85rem"}},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{style:k},"#"),n.createElement("th",{style:D},n.createElement(o(),{component:"span",content:"explorer.block.date"})),n.createElement("th",{style:D},n.createElement(o(),{component:"span",content:"news.subject"})),n.createElement("th",{style:D},n.createElement(o(),{component:"span",content:"news.author"})))),n.createElement("tbody",null,e.map(((e,a)=>{const l=e.parentAuthor?e.parentAuthor:e.author;let i=r().localize(new Date(e.created));const c=6*e.title.length>t-450?`${e.title.slice(0,Math.floor(t-450)/6)}...`:e.title;return n.createElement("tr",{key:`${e.title.slice(0,10)}${a}`},n.createElement("td",{style:b},n.createElement(N,{data:a+1,locale:s,url:e.url})),n.createElement("td",{style:f},n.createElement(N,{data:i,locale:s,url:e.url})),n.createElement("td",{style:y},n.createElement(N,{data:c,locale:s,url:e.url,isLink:!0})),n.createElement("td",{style:y},n.createElement(N,{data:l,locale:s,url:e.url})))}))),n.createElement("thead",null,n.createElement("tr",{style:g},n.createElement("th",{style:b}),n.createElement("th",{style:y}),n.createElement("th",{style:y}),n.createElement("th",{style:y}))));class S extends n.Component{constructor(e){super(e),this.state={isLoading:!0,isWrong:!1,discussions:[],width:1200,currentLocale:this.props.currentLocale},this.updateDimensions=this.updateDimensions.bind(this),this.orderDiscussions=this.orderDiscussions.bind(this)}updateDimensions(){this.setState({width:window.innerWidth})}orderDiscussions(e){const t=e.sort(((e,t)=>new Date(t.created)-new Date(e.created)));this.setState({discussions:t,isLoading:!1})}componentDidMount(){this.updateDimensions(),window.addEventListener("resize",this.updateDimensions),this.processUpdateNews(this.state.currentLocale)}processUpdateNews(e,t=!1){if(!1!==t&&"ru"!==e&&"ru"!==t)return!1;this.setState({isLoading:!0});let s=!1;"ru"==e?(s=i.api,i.config.set("websocket","wss://api.golos.id/ws"),this.setState({currentLocale:e})):s=l.api,s.getDiscussionsByBlog(function(e){let t={select_authors:["rudex"],tag:"rudex",limit:20};return"ru"==e&&(t.filter_tag_masks=["fm-"]),t}(e)).then((t=>{this.setState({isLoading:!0,currentLocale:e,discussions:t}),this.orderDiscussions(t)})).catch((()=>{this.setState({isLoading:!1,isWrong:!0})}))}componentWillUnmount(){window.removeEventListener("resize",this.updateDimensions)}UNSAFE_componentWillReceiveProps(e,t){e.currentLocale!==this.props.currentLocale&&t.discussions!==this.state.discussions&&this.processUpdateNews(e.currentLocale,this.props.currentLocale)}render(){const{isLoading:e,isWrong:t,discussions:s,width:a,currentLocale:l}=this.state;return n.createElement("div",{className:"grid-block page-layout"},e?n.createElement(d.Z,{loadingText:r().translate("footer.loading")}):n.createElement("div",{className:"grid-block vertical"},n.createElement("div",{className:"account-tabs"},n.createElement("div",{className:"tab-content"},n.createElement("div",{className:"grid-block vertical"},t&&n.createElement(v,null),!t&&!e&&n.createElement(x,{width:a,data:s,locale:l}))))))}}const _=S=(0,m.$)(S,{listenTo:()=>[h.Z],getProps:()=>({currentLocale:h.Z.getState().currentLocale})})},36240:()=>{},34169:()=>{},18391:()=>{}}]);