File indexing completed on 2025-01-26 05:27:59

0001 import React, { Component } from 'react';
0002 import TimeAgo from 'react-timeago';
0003 import TextTruncate from 'react-text-truncate';
0004 class ProductGit extends React.Component {
0005   constructor(props){
0006         super(props);
0007     this.gitBaseUrl='https://opencode.net/';
0008   }
0009   render(){
0010 
0011       const userDisplay =(
0012         <span className="cm-userinfo">
0013           <img src={this.props.product.user_avatar_url}/>
0014           <span className="username">
0015             <a href={this.gitBaseUrl+this.props.product.namespace.path}>
0016             {this.props.product.namespace.name}
0017             </a>
0018           </span>
0019         </span>
0020       );
0021       const productInfoDisplay = (
0022         <div className="product-info">
0023           <span className="product-info-title"><a href={this.props.product.web_url} >{this.props.product.name}</a></span>
0024           <span className="product-info-desc">
0025 
0026           <TextTruncate
0027                 line={3}
0028                 truncateText="…"
0029                 text={this.props.product.description}
0030 
0031             />
0032           </span>
0033           <span className="product-info-date">{this.props.product.timeago}</span>
0034         </div>
0035       );
0036 
0037       let imageProject;
0038       if(this.props.product.avatar_url)
0039       {
0040         imageProject =(
0041           <figure>
0042             <img className="productimg" src={this.props.product.avatar_url} />
0043           </figure>
0044         );
0045       }else {
0046         imageProject =(
0047           <figure>
0048             <div className="defaultProjectAvatar">{this.props.product.name.substr(0,1)}</div>
0049           </figure>
0050         );
0051       }
0052 
0053     return (
0054       <div className="productrow row cm-content">
0055         <div className="col-lg-2">
0056           <a href={this.props.product.web_url} >
0057           {imageProject}
0058           </a>
0059         </div>
0060         <div className="col-lg-7">
0061           {productInfoDisplay}
0062         </div>
0063         <div className="col-lg-3">
0064             {userDisplay}
0065         </div>
0066       </div>
0067     )
0068   }
0069 }
0070 
0071 export default ProductGit;