import React from 'react'
import styles from './renders.less'
import { SearchCard } from 'components'
import * as antd from 'antd'
import * as ycore from 'ycore'
import * as Icons from '@ant-design/icons'
import Icon from '@ant-design/icons'
import { MediaPlayer, PostCard } from 'components'
const VerifiedBadge = () => (
)
export class __priPost extends React.Component {
renderContent(payload) {
const { id, postText, postFile_full, post_time, publisher } = payload
if (!postFile_full) {
return (
)
}
return (
{postFile_full ?
: null}
{postText ? (
{' '}
{' '}
) : null}
)
}
render() {
const payload = this.props.payload
if (!payload) {
return This post not exists!!!
}
const { id, postText, postFile_full, post_time, publisher } = payload
return (
{publisher.username}{' '}
{ycore.booleanFix(publisher.verified) ? (
) : null}
{' '}
{post_time} {ycore.IsThisUser.dev() ? `| #${id}` : null}{' '}
{this.renderContent(payload)}
)
}
}
export class __secComments extends React.Component {
state = {
comment_data: this.props.payload,
raw_comment: '',
loading: false,
}
handleDeleteComment(id) {
ycore.yconsole.log(`Removing Comment with id => ${id}`)
ycore.comty_post_comment.delete(
(err, res) => {
if (err) {
return false
}
return this.reloadComments()
},
{ comment_id: id }
)
}
handleNewComment() {
const { raw_comment } = this.state
const { post_id } = this.props
if (raw_comment) {
const payload = { post_id: post_id, raw_text: raw_comment }
ycore.comty_post_comment.new((err, res) => {
if (err) {
ycore.notify.error('This action could not be performed.', err)
}
this.setState({ raw_comment: '' })
return this.reloadComments()
}, payload)
}
return false
}
renderComment = a => {
const { id, time, Orginaltext, publisher } = a
const CommentMenu = (
this.handleDeleteComment(id)}
>
Delete
)
return (
@{publisher.username}{' '}
{ycore.booleanFix(publisher.verified) ? (
) : null}
e.preventDefault()}
className={styles.comment_user_ago}
>
{ycore.time.stmToAgo(time)}
)
}
HandleCommentInput = e => {
const { value } = e.target
this.setState({ raw_comment: value })
}
reloadComments() {
try {
this.setState({ loading: true })
const payload = { post_id: this.props.post_id }
ycore.comty_post.get((err, res) => {
const post_comments = JSON.parse(res)['post_comments']
this.setState({ comment_data: post_comments, loading: false })
}, payload)
} catch (error) {
return false
}
}
render() {
const { comment_data, loading } = this.state
return (
Comments ({comment_data.length})
{loading ? (
) : (
this.renderComment(item)}
/>
)}
this.handleNewComment()}
placeholder="Write a comment..."
allowClear
onChange={this.HandleCommentInput}
/>
)
}
}
export class __priSearch extends React.Component {
renderResult = source => {
try {
const Empty = (
)
// TO DO: Settings serach & Post Search
const usersParsed = JSON.parse(source)['users']
const groupsParsed = JSON.parse(source)['groups']
const pagesParsed = JSON.parse(source)['pages']
const users = () => {
if (usersParsed.length >= 1) {
ycore.yconsole.log('Users => ', usersParsed)
return this.EntryComponent('Users', usersParsed)
}
}
const groups = () => {
if (groupsParsed.length >= 1) {
ycore.yconsole.log('Groups => ', groupsParsed)
return this.EntryComponent('Groups', groupsParsed)
}
}
const pages = () => {
if (pagesParsed.length >= 1) {
ycore.yconsole.log('Pages => ', pagesParsed)
return this.EntryComponent('Pages', pagesParsed)
}
}
if (
!usersParsed.length >= 1 &&
!groupsParsed.length >= 1 &&
!pagesParsed.length >= 1
) {
return Empty
}
return [users(), groups(), pages()]
} catch (error) {
return (
Render Error
)
}
}
EntryComponent = (t, source) => {
try {
return (
{ycore.router.go(`@${item.username}`)}}>
@{item.username}
{ycore.booleanFix(item.verified) ? (
) : null}
}
/>
)
} catch (error) {
return (
Render Error
)
}
}
render(){
return(
{this.renderResult(this.props.payload)}
)
}
}
export class __trendings extends React.PureComponent {
render(){
if (!this.props.data) return false
return(
Trending now
(
#{item.tag}
{item.trend_use_num} Posts
)}
/>
)
}
}
export class __pro extends React.PureComponent {
render(){
return(
Go Pro!
Sabias que la frase de kintxi, se hace la que no me conoze se hizo mientras estaba borracho
Start now
)
}
}