diff --git a/globals/endpoints.js b/globals/endpoints.js index 0ebc3ab6..7a3e9292 100755 --- a/globals/endpoints.js +++ b/globals/endpoints.js @@ -1,5 +1,6 @@ module.exports = { Endpoints: { + comments_actions: "https://api.ragestudio.net/RSA-COMTY/r/comments?access_token=", get_post_data: "https://api.ragestudio.net/RSA-COMTY/r/get-post-data?access_token=", get_user_tags: "https://api.ragestudio.net/RSA-COMTY/r/user_tags?access_token=", get_general_data: "https://api.ragestudio.net/RSA-COMTY/r/get-general-data?access_token=", diff --git a/package.json b/package.json index aafc5c12..9204122d 100755 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4", "title": "Comty™", "DevBuild": true, - "version": "0.2.23", + "version": "0.2.24", "description": "", "main": "app/main.js", "author": "RageStudio", @@ -20,7 +20,7 @@ "@lingui/react": "^2.9.1", "@material-ui/core": "^4.9.3", "@material-ui/icons": "^4.9.1", - "antd": "^4.0.2", + "antd": "^4.0.4", "axios": "^0.19.2", "babel-core": "7.0.0-bridge.0", "classnames": "^2.2.6", @@ -49,6 +49,7 @@ "react-sound": "^1.2.0", "react-virtualized": "^9.21.2", "store": "^2.0.12", + "timeago.js": "^4.0.2", "ts-cookies": "^1.0.0", "umi-plugin-datahub": "^4.1.0", "validator": "^12.2.0" diff --git a/src/@ycore/libs.js b/src/@ycore/libs.js index 42047ee9..1981f0bc 100755 --- a/src/@ycore/libs.js +++ b/src/@ycore/libs.js @@ -3,4 +3,6 @@ export * from './libs/comty_ng/pre.js'; export * from './libs/yulio_id/pre.js'; export * from './libs/ycore_styles/pre.js'; export * from './libs/ycore_sdcp/pre.js'; -export * from './libs/app_functions/pre.js' \ No newline at end of file +export * from './libs/app_functions/pre.js' + + diff --git a/src/@ycore/libs/app_functions/pre.js b/src/@ycore/libs/app_functions/pre.js index 46263819..98d43ba4 100644 --- a/src/@ycore/libs/app_functions/pre.js +++ b/src/@ycore/libs/app_functions/pre.js @@ -13,15 +13,11 @@ export const CheckThisApp = { } return false }, - } export const SecondarySwap = { - ext: ()=> { - SwapMode.ext() - }, - PostComments: (e) => { - SwapMode.PostComments(e) + close: () => { + SwapMode.close() }, openPost: (e) => { SwapMode.openPost(e) diff --git a/src/@ycore/libs/comty_ng/pre.js b/src/@ycore/libs/comty_ng/pre.js index 31fae58f..bf664d7f 100755 --- a/src/@ycore/libs/comty_ng/pre.js +++ b/src/@ycore/libs/comty_ng/pre.js @@ -34,7 +34,56 @@ export const IsThisPost = { } } +export const Post_Comments = { + delete: (callback, payload) => { + if (!payload) { + return false + } + const { comment_id } = payload + let formdata = new FormData(); + formdata.append("type", "delete"); + formdata.append("comment_id", comment_id); + + API_Call((err,res)=> { + return callback(err,res) + }, + ycore.endpoints.comments_actions, + formdata, + ) + } +} + +function API_Call(callback, endpoint, payload, options){ + if (!payload || !endpoint) { + return false + } + let payloadContainer = payload; + payloadContainer.append("server_key", ycore.yConfig.server_key); + const defaultOptions = { method: "POST", timeout: 0, processData: false } + const { method, timeout, processData } = options || defaultOptions + + const requestOptions = { + "url": `${endpoint}${ycore.handlerYIDT.__token()}`, + "method": method, + "timeout": timeout, + "data": payloadContainer, + "mimeType": "multipart/form-data", + "processData": processData, + "contentType": false + }; + + jquery.ajax(requestOptions) + .done(response => { + ycore.yconsole.log(response) + return callback(false, response) + }) + .fail(error => { + ycore.yconsole.log('error', error) + ycore.Alive_API.fail(error) + return callback(true, error) + }); +} export function GetGeneralData(callback){ let formdata = new FormData(); formdata.append("user_id", id); @@ -52,6 +101,7 @@ export function GetGeneralData(callback){ }) .catch(error => { console.log('error', error) + ycore.Alive_API.fail(error) return callback(true, error) }); } @@ -73,6 +123,7 @@ export function follow_user(id, callback) { return callback(false, response) }) .catch(error => { + ycore.Alive_API.fail(error) console.log('error', error) return callback(true, error) }); @@ -142,6 +193,7 @@ export function PublishPost(privacy, raw, file, callback){ }) .fail(error => { ycore.yconsole.log('error', error) + ycore.Alive_API.fail(error) return callback(true, error) }); } @@ -166,6 +218,7 @@ export function FindUser(key, callback){ }) .fail(function (response) { const exception = 'API Bad response'; + ycore.Alive_API.fail(response) return callback(exception, response); }) } @@ -190,29 +243,30 @@ export function SeachKeywords(key, callback){ }) .fail(function (response) { const exception = 'Request Failed'; + ycore.Alive_API.fail(response) return callback(exception, response); }) } export function ActionPost(type, id, value, callback){ - var formdata = new FormData(); - formdata.append("server_key", ycore.yConfig.server_key); if (!type || !id) { ycore.notifyError('[ActionPost] No type or id Provided !!!') return false } + var formdata = new FormData(); + formdata.append("server_key", ycore.yConfig.server_key); + formdata.append("post_id", id); switch (type) { case 'like': { formdata.append("action", "like"); - formdata.append("post_id", id); break } - case 'commet': + case 'comment': { if (!value) { return false } - formdata.append("action", "commet"); + formdata.append("action", "comment"); formdata.append("text", value) break } @@ -228,7 +282,6 @@ export function ActionPost(type, id, value, callback){ case 'delete': { formdata.append("action", "delete"); - formdata.append("post_id", id); break } default: @@ -250,6 +303,7 @@ export function ActionPost(type, id, value, callback){ return callback(null, response); }) .fail(function (response) { + ycore.Alive_API.fail(response) return callback(true, `[Server error] We couldnt ${type} this post`); }) } @@ -277,6 +331,7 @@ export function GetUserTags(id, callback){ }) .fail(function (response) { const exception = 'Request Failed'; + ycore.Alive_API.fail(response) return callback(exception, response); }) } @@ -313,6 +368,7 @@ export function GetPosts(userid, type, fkey, callback) { }) .fail(function (response) { const exception = 'Request Failed'; + ycore.Alive_API.fail(response) return callback(exception, response); }) } @@ -342,6 +398,7 @@ export function GetPostData(a, b, callback){ }) .fail(function (response) { const exception = 'Request Failed'; + ycore.Alive_API.fail(response) return callback(exception, response); }) } diff --git a/src/@ycore/libs/yulio_id/pre.js b/src/@ycore/libs/yulio_id/pre.js index 30e8e9b7..ad093839 100755 --- a/src/@ycore/libs/yulio_id/pre.js +++ b/src/@ycore/libs/yulio_id/pre.js @@ -11,6 +11,14 @@ var jwt = require("jsonwebtoken") export function userData(){ return ycore.handlerYIDT.get() } +export const Alive_API = { + fail: (a) => { + if (a){ + ycore.yconsole.log(a) + ycore.notify.error(a) + } + } +} function __API__User (payload, sdcp, callback){ const { UserID, UserToken } = payload @@ -167,6 +175,9 @@ export function LogoutCall(){ ycore.handlerYIDT.remove() ycore.router.push({pathname: '/login',}) }) + .fail((response) => { + ycore.Alive_API.fail(response) + }) } export function __AppSetup__(EncUsername, EncPassword, callback) { const prefix = '[Auth Server]:'; @@ -221,8 +232,9 @@ export function __AppSetup__(EncUsername, EncPassword, callback) { } return; }) - .fail(function (response) { + .fail(function (response) { const exception = new Error("Server failed response . . . :( "); + ycore.Alive_API.fail(response) return; }) } @@ -263,6 +275,7 @@ export function GetUserData (values, callback) { .fail( function (response) { ycore.yconsole.log(prefix, 'Server failure!', response) + ycore.Alive_API.fail(response) callback(true, response ) } ) diff --git a/src/@ycore/ycore_worker.js b/src/@ycore/ycore_worker.js index 6eb94176..14472816 100755 --- a/src/@ycore/ycore_worker.js +++ b/src/@ycore/ycore_worker.js @@ -5,12 +5,13 @@ * @licensed Pending... */ -import {ListSettings} from "../../globals/settings.js"; import {Endpoints} from "globals/endpoints.js"; import * as Icons from '@ant-design/icons'; import localforage from "localforage" +import { format } from 'timeago.js'; import umiRouter from "umi/router"; import * as antd from "antd"; +import moment from 'moment' import React from "react"; import config from "config" @@ -65,6 +66,22 @@ export function b64toBlob(b64Data, contentType, sliceSize) { var blob = new Blob(byteArrays, {type: contentType}); return blob; } +export const time = { + ago: (a) => { + const format = moment(a).format('DDMMYYYY'); + const b = new Date(format).toLocaleString(); + return time.relativeToNow(b); + }, + stmToAgo: (a) => { + const b = (a*1000); + return format(b); + }, + relativeToNow: (a, b) => { + return moment(a, b || "DDMMYYYY").fromNow(); + } +} + + export function objectLast(array, n) { if (array == null) return void 0; diff --git a/src/components/Layout/Secondary/index.js b/src/components/Layout/Secondary/index.js index e2d37168..150cee36 100644 --- a/src/components/Layout/Secondary/index.js +++ b/src/components/Layout/Secondary/index.js @@ -5,27 +5,17 @@ import * as Icons from '@ant-design/icons' import styles from './index.less' import classnames from 'classnames' -import SecRenderPost from './post' +import {__priPost, __secComments} from './renders.js' export const SwapMode = { - ext: () => { - SecondaryLayoutComponent.setState({ - swap: true, - mode: 'ext' - }) + close: () => { + SecondaryLayoutComponent.closeSwap() }, - PostComments: (e) => { + openPost: (a, b) => { SecondaryLayoutComponent.setState({ swap: true, - mode: 'post_comments', - s_raw: e - }) - }, - openPost: (e) => { - SecondaryLayoutComponent.setState({ - swap: true, - mode: 'open_post', - s_raw: e + mode: 'post', + global_raw: a, }) } } @@ -36,47 +26,68 @@ export default class Secondary extends React.PureComponent{ window.SecondaryLayoutComponent = this; this.state = { swap: false, - mode: 'ext', - s_raw: '', + mode: '', + global_raw: '', + pri_raw: '', + sec_raw: '', } } + closeSwap(){ this.setState({ swap: !this.state.swap, - s_raw: null, - mode: 'ext' + pri_raw: null, + sec_raw: null, + mode: '' }) } + + SwapBalanceContent(container){ + switch (container){ + case '__pri': { + return this.__pri() + } + case '__sec': { + return this.__sec() + } + default: return null + } + } + + __pri(){ + const dtraw = this.state.pri_raw; + switch (this.state.mode){ + case 'post': { + return this.renderPost(this.state.global_raw) + } + default: return null + } + } + __sec(){ + const dtraw = this.state.sec_raw; + switch (this.state.mode){ + case 'post': { + return this.renderComments(this.state.global_raw) + } + default: return null + } + } + renderPost = (payload) => { const post_data = JSON.parse(payload)['post_data'] console.log(post_data) return( - + <__priPost payload={post_data} /> ) } - - renderMode(){ - const { mode } = this.state - switch (mode) { - case 'ext': - return ( -

- ) - case 'post_comments':{ - return( - - ) - } - case 'open_post':{ - return( - this.renderPost(this.state.s_raw) - ) - } - - default: - break; - } + renderComments = (payload) => { + const post_comments = JSON.parse(payload)['post_comments'] + const post_data = JSON.parse(payload)['post_data'] + console.log(post_comments) + return( + <__secComments post_id={post_data.post_id} payload={post_comments} /> + ) } @@ -93,15 +104,12 @@ export default class Secondary extends React.PureComponent{
{this.state.swap? } onClick={() => this.closeSwap()} > Back : null} - {this.renderMode()} + {this.SwapBalanceContent('__pri')}
- - -
-

container_2

+ {this.SwapBalanceContent('__sec')}
diff --git a/src/components/Layout/Secondary/index.less b/src/components/Layout/Secondary/index.less index b4af7f25..1a13cd0d 100644 --- a/src/components/Layout/Secondary/index.less +++ b/src/components/Layout/Secondary/index.less @@ -3,6 +3,7 @@ .SecondaryWrapper{ width: 27%; height: 100vh; + position: relative; float: left; @@ -12,7 +13,6 @@ display: flex; &.active{ - z-index: 10000; width: 96vw; position: absolute; right: 0; @@ -31,7 +31,7 @@ top: 25px; display: flex; position: absolute; - z-index: 202; + z-index: 52; img { border-radius: 15px; width: 40px; @@ -53,7 +53,7 @@ } } .container{ - z-index: 200; + z-index: 50; position: relative; background-color: #201F23; color: @DarkMode-color_container !important; @@ -83,7 +83,7 @@ } .container_2{ - z-index: 201; + z-index: 51; background-color: #fff; border-radius: 32px 0 0 32px; @@ -104,3 +104,7 @@ transition: all @SwapAnimDuration ease-in-out; } + + .comments_body{ + + } \ No newline at end of file diff --git a/src/components/Layout/Secondary/post.js b/src/components/Layout/Secondary/post.js deleted file mode 100644 index 723f8692..00000000 --- a/src/components/Layout/Secondary/post.js +++ /dev/null @@ -1,53 +0,0 @@ -import React from 'react' -import styles from './post.less' - -import * as antd from 'antd' -import * as ycore from 'ycore' -import Icon from '@ant-design/icons' -import {MediaPlayer, PostCard} from 'components' - -const VerifiedBadge = () => ( ) - -export default class SecRenderPost 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)} -
- ) - } -} \ No newline at end of file diff --git a/src/components/Layout/Secondary/post.less b/src/components/Layout/Secondary/post.less deleted file mode 100644 index ca1f3aaf..00000000 --- a/src/components/Layout/Secondary/post.less +++ /dev/null @@ -1,121 +0,0 @@ -@import '~themes/vars.less'; - -.SecondaryBody{ - width: 100%; - height: 100%; -} - -.UserContainer{ - display: flex; - position: relative; - float: right; - z-index: 150; - transform: translate(0, -40px); - .UserContainer_text{ - margin: 0 8px; - h4 { text-align: right; } - p { word-break: break-all; text-align: right; font-size: 11px; color: #eeeeee!important; } - } - - -} - -.postAvatar{ - position: absolute; - left: -8px; - top: -8px; - display: flex; -} -.titleUser{ - display: flex; - font-family: 'Poppins', sans-serif; - margin: 0 0 0 50px; - color: #ffffff!important; -} -.textAgo{ - display: flex; - font-size: 10px; - margin: 0 0 0 53px; -} -.PostTags{ - float: right; - width: 100%; - z-index: 10; - :global { - .anticon{ - color:rgb(249, 179, 64); - float: right; - margin: -0 6px 0 0;; - font-size: 17px; - } - .MoreMenu{ - color: #2d2d2d !important; - } - } -} -.titleWrapper{ - display: flex; - h4{ - cursor: pointer; - } - color: #ffffff!important; - -} -.contentWrapper{ - margin: auto; - width: 100%; - padding: 20px; -} - - -.postContent{ - word-break: break-all; - position: absolute; - vertical-align: bottom; - border-radius: 7px; - bottom: 0; - max-width: 50vw; - - background-color: #2d2d2d4b; - padding: 10px; - h3{ - font-family: "Poppins", sans-serif; - color: #ffffff; - font-weight: 400; - font-size: 15px; - letter-spacing: -0.3px; - } -} -.postContent_OnlyText{ - padding: 25% 0 0 0; - position: relative; - vertical-align: middle; - -} - - -.likebtn{ - :global{ - svg{ - color:rgba(0, 0, 0, 0.45); - } - svg:hover{ - color: rgb(233, 35, 68); - transition: all 0.2s linear; - } - } -} - -.ellipsisIcon{ - color:rgba(0, 0, 0, 0.45); - width: 100%; - position: absolute; - text-align: center; - margin: auto; - font-size: 30px; - transition: opacity 150ms linear; -} -.ellipsisIcon:hover{ - opacity: 0; - transition: opacity 150ms linear; -} \ No newline at end of file diff --git a/src/components/Layout/Secondary/renders.js b/src/components/Layout/Secondary/renders.js new file mode 100644 index 00000000..d8fecf33 --- /dev/null +++ b/src/components/Layout/Secondary/renders.js @@ -0,0 +1,152 @@ +import React from 'react' +import styles from './renders.less' + +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){ + console.log(`Removing Comment with id => ${id}`) + ycore.Post_Comments.delete((err, res) => { if(err){return false} return this.reloadComments() }, {comment_id: id}) + } + 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)}

+
+ +
+
+

{Orginaltext}

+
+
+ ) + } + HandleCommentInput = e => { + const { value } = e.target; + this.setState({ raw_comment: value }) + }; + reloadComments(){ + try { + this.setState({ loading: true }) + ycore.GetPostData(this.props.post_id, null, (err, res) =>{ + const post_comments = JSON.parse(res)['post_comments'] + this.setState({ comment_data: post_comments, loading: false}) + }) + } catch (error) { + return false + } + } + dispatchNewComment(){ + const { raw_comment } = this.state + const { post_id } = this.props + if (raw_comment) { + ycore.ActionPost('comment', post_id, raw_comment, (err,res) =>{ + if (err) { + ycore.notify.error('This action could not be performed.', err) + } + this.setState({ raw_comment: '' }) + this.reloadComments() + return true + }) + } + return false + } + + + render(){ + const {comment_data, loading} = this.state + + return( +
+
+

Comments ({comment_data.length})

+
+
+ {loading? : + ( + this.renderComment(item) + )} + /> + } +
+
+
+ this.dispatchNewComment()} placeholder="Write a comment..." allowClear onChange={this.HandleCommentInput} /> +
+
+ + +
+ ) + } +} \ No newline at end of file diff --git a/src/components/Layout/Secondary/renders.less b/src/components/Layout/Secondary/renders.less new file mode 100644 index 00000000..81981a50 --- /dev/null +++ b/src/components/Layout/Secondary/renders.less @@ -0,0 +1,189 @@ +@import '~themes/vars.less'; + +.SecondaryBody{ + width: 100%; + height: 100%; +} + +.UserContainer{ + display: flex; + position: relative; + float: right; + z-index: 150; + transform: translate(0, -40px); + .UserContainer_text{ + margin: 0 8px; + h4 { text-align: right; } + p { word-break: break-all; text-align: right; font-size: 11px; color: #eeeeee!important; } + } + + +} + +.postAvatar{ + position: absolute; + left: -8px; + top: -8px; + display: flex; +} +.titleUser{ + display: flex; + font-family: 'Poppins', sans-serif; + margin: 0 0 0 50px; + color: #ffffff!important; +} +.textAgo{ + display: flex; + font-size: 10px; + margin: 0 0 0 53px; +} +.PostTags{ + float: right; + width: 100%; + z-index: 10; + :global { + .anticon{ + color:rgb(249, 179, 64); + float: right; + margin: -0 6px 0 0;; + font-size: 17px; + } + .MoreMenu{ + color: #2d2d2d !important; + } + } +} +.titleWrapper{ + display: flex; + h4{ + cursor: pointer; + } + color: #ffffff!important; + +} +.contentWrapper{ + margin: auto; + width: 100%; + padding: 20px; +} + + +.postContent{ + word-break: break-all; + position: absolute; + vertical-align: bottom; + border-radius: 7px; + bottom: 0; + max-width: 50vw; + + background-color: #2d2d2d4b; + padding: 10px; + h3{ + font-family: "Poppins", sans-serif; + color: #ffffff; + font-weight: 400; + font-size: 15px; + letter-spacing: -0.3px; + } +} +.postContent_OnlyText{ + padding: 25% 0 0 0; + position: relative; + vertical-align: middle; + +} + + +.likebtn{ + :global{ + svg{ + color:rgba(0, 0, 0, 0.45); + } + svg:hover{ + color: rgb(233, 35, 68); + transition: all 0.2s linear; + } + } +} + +.comments_body{ + font-family: "Poppins", sans-serif; + padding: 75px 10px 10px 20px; + + .comments_body_title{ + font-size: 12px; + h1{ + font-weight: 550; + letter-spacing: 0.01px; + } + } + + .comments_cards_wrapper{ + z-index: 50; + overflow: scroll; + :global{ + overflow: scroll; + } + .comment_card{ + position: relative; + width: 100%; + background-color: #ffffff; + word-break: break-all; + .comment_title{ + display: flex; + img{ + float: left; + width: 30px; + height: 30px; + border-radius: 12px; + } + .comment_user_username{ + margin: 0 5px 0 8px; + vertical-align: middle; + height: 100%; + color: #2d2d2d; + line-height: 25px; + } + .comment_user_ago{ + cursor: pointer; + position: absolute; + right: 0; + text-align: right; + font-size: 9px; + } + } + .comment_text{ + margin: 10px 0 0 0; + } + + } + } + + .comment_box{ + width: 100%; + bottom: 0; + right: 0; + position: absolute; + z-index: 100; + background-color: #ffffffd7; + padding-top: 20px; + padding-bottom: 40px; + border-radius: 0 0 0 32px; + .comment_box_body{ + border-radius: 5px; + width: 85%; + height: 40px; + margin: auto; + background-color: #f8f6f8; + :global{ + .ant-input-affix-wrapper, .ant-input{ + padding: 4px 5px; + background-color: transparent; + border: 0; + } + } + } + } + +} + diff --git a/src/components/PostCard/index.js b/src/components/PostCard/index.js index e3c0d4b1..18c03c66 100755 --- a/src/components/PostCard/index.js +++ b/src/components/PostCard/index.js @@ -62,6 +62,7 @@ class PostCard extends React.PureComponent{ goToPost(postID){ localStorage.setItem('p_back_uid', postID) ycore.GetPostData(postID, null, (err, res) => { + console.log(res) if (err) { return false } ycore.SecondarySwap.openPost(res) }) @@ -70,7 +71,7 @@ class PostCard extends React.PureComponent{ render(){ const { payload, customActions } = this.props const ActShowMode = ycore.AppSettings.force_show_postactions - const { id, post_time, postText, postFile, publisher, post_likes, is_post_pinned, is_liked } = payload || emptyPayload; + const { id, post_time, postText, postFile, publisher, post_likes, is_post_pinned, is_liked, post_comments } = payload || emptyPayload; const handlePostActions = { delete: (post_id) => { ycore.ActionPost('delete', post_id, null, (err, res)=>{ @@ -87,7 +88,7 @@ class PostCard extends React.PureComponent{ } const defaultActions = [
, - this.goToPost(id) } /> + 0 ? true : false}> this.goToPost(id) } /> ] const actions = customActions || defaultActions; diff --git a/src/components/PostCard/index.less b/src/components/PostCard/index.less index 1d73c5d4..304e04ed 100755 --- a/src/components/PostCard/index.less +++ b/src/components/PostCard/index.less @@ -28,7 +28,7 @@ transition: opacity 150ms linear, position 150ms linear, transform 150ms linear; border-radius: 0 0 10px 10px; opacity: 0; - // Doesn't work... So sad :C + &.showMode{ opacity: 1; transform: translate(0, 15px); @@ -40,7 +40,7 @@ transform: translate(0, 15px); transition: opacity 150ms linear, position 150ms linear, transform 150ms linear; } - .ant-card-actions > li > span > .anticon { + .ant-card-actions > li > .anticon { font-size: 16px; line-height: 22px; width: 40px; @@ -52,6 +52,21 @@ .ant-card-actions > li { margin: -20px 0 0 0 ; border-right: 0; + .ant-badge-count{ + width: 20px; + text-align: left; + span { + font-size: 12px; + } + .ant-scroll-number-only > p.ant-scroll-number-only-unit { + height: 20px; + width: 20px; + margin: 0; + line-height: 20px; + padding: 0 0 0 1px; + } + } + span { font-size: 16px; line-height: 22px;