-
Notifications
You must be signed in to change notification settings - Fork 0
/
p___id__index.async.js
1 lines (1 loc) · 10.1 KB
/
p___id__index.async.js
1
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[2],{"6S3V":function(e,t,a){"use strict";a.r(t);a("Telt");var n=a("Tckk"),l=(a("Mwp2"),a("VXEj")),r=(a("i5XK"),a("jq9l")),i=(a("cWXX"),a("/ezw")),o=(a("+L6B"),a("2/Rp")),s=(a("y8nQ"),a("Vl3Y")),c=(a("5Dmo"),a("3S7+")),m=(a("Pwec"),a("CtXQ")),d=(a("miYZ"),a("tsqr")),h=(a("5NDa"),a("5rEg")),u=a("q1tI"),p=a.n(u),g=a("/MKj"),v=a("wd/R"),E=a.n(v),y=a("PMTl"),f=a.n(y);class _ extends p.a.Component{constructor(){super(...arguments),this.scrollToAnchor=(e=>{if(e){var t=document.getElementById(e);t&&t.scrollIntoView()}})}render(){var e=this.props.data,t=void 0===e?[]:e;return p.a.createElement("ul",{className:f.a.catelog},t.map((e,t)=>p.a.createElement("li",{onClick:()=>this.scrollToAnchor(e.id),className:f.a["level-".concat(e.level)],key:"title-".concat(t)},p.a.createElement("a",null,e.id))))}}var k,b,C,L=_,I=a("XlMv"),x=a("i+bE"),w=a.n(x),T=h["a"].TextArea,N=(k=Object(g["c"])(e=>{var t=e.home,a=e.user,n=e.loading;return{home:t,user:a,submitting:n.effects["home/createComment"],detailLoading:n.effects["home/getIssueDetail"],commentLoading:n.effects["home/getCommentList"]}}),k((C=class extends u["Component"]{constructor(e){super(e),this.state={content:"",comment:"",detail:"",commentList:[],headings:[],action:null},this.article=null,this.getHeadings=(()=>{var e=this.article.querySelectorAll(".heading");if(e&&0!==Array.from(e).length){var t=Array.from(e).map(e=>({title:e.innerText,id:e.id,level:Number(e.dataset.level),offsetTop:e.offsetTop}));this.setState({headings:t})}}),this.handleSubmit=(()=>{var e=this.props.dispatch,t=this.state.comment;t&&e({type:"home/createComment",payload:{id:this.id,value:t}}).then(e=>{e&&this.setState({comment:""})})}),this.handleChange=(e=>{this.setState({comment:e.target.value})}),this.formatTime=(e=>{return p.a.createElement("span",null,"\u53d1\u8868\u4e8e",p.a.createElement("span",null,E()(e).fromNow()))}),this.handleReaction=((e,t)=>{var a=this.props,n=a.dispatch,l=a.user.userInfo,r=void 0===l?{}:l,i=r.isLogin;i?(this.setState({action:"liked"}),n({type:"home/createReaction",payload:{commentId:e.id,issueId:this.id,type:t}})):d["a"].info("\u8bf7\u5148\u4f7f\u7528github\u8d26\u53f7\u767b\u5f55\uff01")}),this.handleReply=(e=>{var t=this.props.user.userInfo.isLogin;if(t){var a=this.state.comment,n=e.body,l=n.split("\n");l.unshift("@".concat(e.user.login)),l=l.map(e=>"> ".concat(e)),l.push(""),l.push(""),a&&l.unshift(""),this.setState({comment:l.join("\n")},()=>{this.commentText.focus()})}else d["a"].info("\u8bf7\u5148\u4f7f\u7528github\u8d26\u53f7\u767b\u5f55\uff01")}),this.createReactionForIssue=(()=>{var e=this.props,t=e.dispatch,a=e.user.userInfo,n=void 0===a?{}:a,l=n.isLogin;l?t({type:"home/createReactionForIssue",payload:{id:this.id}}):d["a"].info("\u8bf7\u5148\u4f7f\u7528github\u8d26\u53f7\u767b\u5f55\uff01")}),this.formatAction=(e=>{var t=e.reactions,a=void 0===t?{}:t;return[p.a.createElement("span",{key:"comment-basic-like"},p.a.createElement(c["a"],{title:"+1"},p.a.createElement(m["a"],{type:"like",onClick:()=>this.handleReaction(e,"+1")})),p.a.createElement("span",{style:{paddingLeft:8,cursor:"auto"}},a["+1"])),p.a.createElement("span",{key:' key="comment-basic-dislike"'},p.a.createElement(c["a"],{title:"-1"},p.a.createElement(m["a"],{type:"dislike",onClick:()=>this.handleReaction(e,"-1")})),p.a.createElement("span",{style:{paddingLeft:8,cursor:"auto"}},a["-1"])),p.a.createElement("span",{key:' key="comment-basic-heart"'},p.a.createElement(c["a"],{title:"Heart"},p.a.createElement(m["a"],{type:"heart",onClick:()=>this.handleReaction(e,"heart")})),p.a.createElement("span",{style:{paddingLeft:8,cursor:"auto"}},a["heart"])),p.a.createElement("span",{key:' key="comment-basic-rocket"'},p.a.createElement(c["a"],{title:"Rocket"},p.a.createElement(m["a"],{type:"rocket",onClick:()=>this.handleReaction(e,"rocket")})),p.a.createElement("span",{style:{paddingLeft:8,cursor:"auto"}},a["rocket"])),p.a.createElement("span",{key:' key="comment-basic-laugh"'},p.a.createElement(c["a"],{title:"Laugh"},p.a.createElement(m["a"],{type:"smile",onClick:()=>this.handleReaction(e,"laugh")})),p.a.createElement("span",{style:{paddingLeft:8,cursor:"auto"}},a["laugh"])),p.a.createElement("span",{key:' key="comment-basic-confused"'},p.a.createElement(c["a"],{title:"Confused"},p.a.createElement(m["a"],{type:"frown",onClick:()=>this.handleReaction(e,"confused")})),p.a.createElement("span",{style:{paddingLeft:8,cursor:"auto"}},a["confused"])),p.a.createElement("span",{key:' key="comment-basic-eyes"'},p.a.createElement(c["a"],{title:"Eyes"},p.a.createElement(m["a"],{type:"eye",onClick:()=>this.handleReaction(e,"eyes")})),p.a.createElement("span",{style:{paddingLeft:8,cursor:"auto"}},a["eyes"])),p.a.createElement("span",{key:"comment-basic-reply-to",onClick:()=>this.handleReply(e)},"\u56de\u590d")]}),this.renderEditor=((e,t,a,n)=>p.a.createElement("div",null,p.a.createElement(s["a"].Item,null,p.a.createElement(T,{ref:e=>this.commentText=e,rows:4,onChange:e,value:n})),p.a.createElement(s["a"].Item,null,p.a.createElement(o["a"],{htmlType:"submit",loading:a,onClick:t,type:"primary",id:"commentContainer"},"\u6dfb\u52a0\u8bc4\u8bba")))),this.id="",this.commentText=null}componentDidMount(){var e=this.props,t=e.match.params.id,a=e.user.userInfo.isLogin,n=e.dispatch,l=e.location.query,r=void 0===l?{}:l;this.id=t,n({type:"home/getIssueDetail",payload:{id:t}}).then(()=>{if(r){var e=null;a?"like"===r.scroll&&(e=document.getElementById("likesContainer")):e=document.getElementById("loginContainer"),e&&e.scrollIntoView({block:"start",behavior:"smooth"}),this.getHeadings()}}),n({type:"home/getCommentList",payload:{id:t}}).then(()=>{if(r){var e=null;a?"comment"===r.scroll&&(e=document.getElementById("commentContainer")):e=document.getElementById("loginContainer"),e&&e.scrollIntoView({block:"start",behavior:"smooth"})}}),n({type:"home/listReactionForAnIssue",payload:{id:t}})}render(){var e=this.state,t=e.comment,a=e.headings,s=void 0===a?[]:a,c=this.props,d=c.home,h=d.commentList,u=void 0===h?[]:h,g=d.issueDetail,v=g.body,E=void 0===v?"":v,y=g.title,f=void 0===y?"":y,_=d.likes,k=void 0===_?[]:_,b=c.user.userInfo,C=void 0===b?{}:b,x=c.submitting,T=void 0!==x&&x,N=c.detailLoading,R=void 0!==N&&N,S=c.commentLoading,j=void 0!==S&&S,q=!!C.isLogin;return p.a.createElement("div",{className:w.a.detail,ref:e=>this.article=e},p.a.createElement(i["a"],{loading:R,active:!0},p.a.createElement("h1",null,f),p.a.createElement(L,{data:s}),p.a.createElement(I["a"],{dataSource:E}),p.a.createElement("div",{className:w.a.append,id:"likesContainer"},p.a.createElement(m["a"],{type:"like",theme:"twoTone",twoToneColor:"#eb2f96",onClick:this.createReactionForIssue}),p.a.createElement("span",{className:w.a.number},k.length))),p.a.createElement(i["a"],{loading:j,active:!0,avatar:!0},p.a.createElement(l["a"],{className:"comment-list",header:p.a.createElement("div",{className:w.a["comment-header"]},p.a.createElement("span",null,"\u5171 ",p.a.createElement("b",null,u.length)," \u6761\u56de\u590d"),q?null:p.a.createElement("div",{className:w.a.loginWrap,id:"loginContainer"},p.a.createElement(o["a"],{type:"primary",onClick:()=>{window.location.href="https://github.com/login/oauth/authorize?client_id=Iv1.4b7099aca41da4cf&redirect_uri=https://naluduo.vip"}},"github\u767b\u5f55"))),itemLayout:"horizontal",dataSource:u,renderItem:e=>p.a.createElement("li",null,p.a.createElement(r["a"],{actions:this.formatAction(e),author:e.author_association,avatar:e.user.avatar_url||"https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png",content:p.a.createElement(I["a"],{dataSource:e.body}),datetime:this.formatTime(e.updated_at)}))}),q?p.a.createElement(r["a"],{avatar:p.a.createElement(n["a"],{src:C.avatar_url?C.avatar_url:"https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png",alt:"Use photo"}),content:this.renderEditor(this.handleChange,this.handleSubmit,T,t)}):null),p.a.createElement("div",{className:w.a.footer},p.a.createElement("b",null,"\xa92021-current naluduo. All rights reserved.")))}},b=C))||b);t["default"]=N},PMTl:function(e,t,a){e.exports={catelog:"catelog___185_X",active:"active___2I7ej","level-1":"level-1___1FM7J","level-2":"level-2___2MMvi","level-3":"level-3___3MyIk","level-4":"level-4___pT1u_","level-5":"level-5___1XRsr","level-6":"level-6___3KH0G"}},XlMv:function(e,t,a){"use strict";var n=a("q1tI"),l=a.n(n),r=a("IujW"),i=a.n(r),o=(a("17x9"),a("oSia")),s=a("S14d"),c=a("dUOs"),m=a("Cuvq"),d=a("DqFP"),h=a("3W8J"),u=a("3cQg"),p=a("lxyc"),g=a("XDC1"),v=a("Dxtr");class E extends n["PureComponent"]{componentWillMount(){o["a"].registerLanguage("jsx",c["a"]),o["a"].registerLanguage("javascript",m["a"]),o["a"].registerLanguage("sass",d["a"]),o["a"].registerLanguage("scss",h["a"]),o["a"].registerLanguage("less",u["a"]),o["a"].registerLanguage("css",p["a"]),o["a"].registerLanguage("java",g["a"]),o["a"].registerLanguage("typescript",v["a"])}render(){var e=this.props,t=e.language,a=e.value;return l.a.createElement("figure",{className:"highlight"},l.a.createElement(o["a"],{language:t,style:s["a"]},a))}}E.defaultProps={language:null};var y=E,f=a("p0pE"),_=a.n(f),k=a("Y/ft"),b=a.n(k),C={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6"};function L(e){var t=e.level,a=e.index,n=e.children,r=b()(e,["level","index","children"]),i=_()({},r,{className:"heading heading-".concat(t),"data-level":a});return l.a.createElement(C[t]||C.h1,i,n)}var I=L;class x extends n["PureComponent"]{constructor(){super(...arguments),this.renderHtml=(()=>{var e=this.props,t=e.level,a=e.children;if(a&&a.length>0){var n=a[0].props.value;return l.a.createElement(I,{level:"h".concat(t),index:t,id:n},l.a.createElement("span",{className:"title"},a),l.a.createElement("a",{href:"#".concat(n),className:"link"},"#"))}return l.a.createElement(l.a.Fragment,null,a)})}render(){return l.a.createElement(l.a.Fragment,null,this.renderHtml())}}var w=x;a("5MvH"),a("qxIa"),t["a"]=(e=>{var t=e.dataSource;return l.a.createElement(i.a,{escapeHtml:!1,renderers:{code:y,heading:w},className:"markdown-body",source:t})})},"i+bE":function(e,t,a){e.exports={detail:"detail___xbiEq",append:"append___2tMhN",number:"number___33hlN","comment-header":"comment-header___Ztxq6",loginWrap:"loginWrap___3hoCU",footer:"footer___A6ldz",anchor:"anchor___tYV87"}},qxIa:function(e,t,a){e.exports={"markdown-body":"markdown-body___3ieAj"}}}]);