From 1e405ccc75264d359c2117f3f8568de8cbb6863a Mon Sep 17 00:00:00 2001 From: ue Date: Mon, 5 Nov 2018 18:02:23 +0300 Subject: [PATCH] changed home screen swipable and gettin post functions also updated main button --- src/assets/avatar_default.png | Bin 0 -> 1326 bytes src/components/header/view/headerView.js | 2 +- .../container/postButtonContainer.js | 7 +++- .../postButton/view/postButtonView.js | 13 ++++++-- src/components/postCard/view/postCardView.js | 17 ++++------ src/components/posts/view/postsView.js | 8 ++--- .../editor/container/editorContainer.js | 11 +++++-- src/screens/editor/screen/editorScreen.js | 1 + src/screens/home/screen/homeScreen.js | 31 +++++++++--------- 9 files changed, 50 insertions(+), 40 deletions(-) create mode 100755 src/assets/avatar_default.png diff --git a/src/assets/avatar_default.png b/src/assets/avatar_default.png new file mode 100755 index 0000000000000000000000000000000000000000..51f9309eccece9c809b1b61fc8d5b7d35b36f4ed GIT binary patch literal 1326 zcmV+}1=0G6P)Px(=t)FDRA>d&TFY(|Nff<)#xalBJVF2=5SSqZhS`8%NfsbhAoeVf5PSe@cCcbG z-!OjwtOmgXmLQN2kI4W@(2Rf(62Oif;@EK#&Z)SX>bM=c-R;+vPF!7e>(;qdw_e=| zNdU6Eyxa>jr+{H#5Xb;&U;{uY09jxRcnv%N?uSC5B7WN=Ae{y-0=IzgfLCE1)};+P z+ZsV*N#Gig2Z9pXqRnK}ynyita0QqEnkBT&HX?yK0)sn&CqS!&ZS4%i2^cyKG_%+1 zbqd=&?#l@nxBwLEwa|imwtb-?Cs?rs1l=}K*NKpmcd*K#dk7?)%G;1Pk2X(Y-*~*b z?HUI_o|ESZuzj_1o1Z_S{bO+Aqsb#|K7c%zuiHSUkta=Zx?SbSXC*cVkaGz*x>D4U zf60v;EwMrfo^coCS;cqnPfktA?6TY${>`K@u*?w zD$>5lmlqb~&FGk9b2Elnk$j<`F#YAL9N3?ccr0cs_xM1LlQhgg$=;(4&SLZeGt2l=dKD>;a zZoq)8ik`3x8{PA!0-ewyrFG5n2GXa=og=`TRP)Z^4$Q2j&!Nmi7CE1y1H&FF)m7zE zN#TV3md(}ZF;7qCWL39D$$Q2y9pD|-w{V@;@^*aO<^;*V9UIrh*b@TT4`^>Ngg6>S zB4b(ik!ayEs#%V41OmHIbCcpauZ1C_!-jb*8-z}PlI94MU@#t_Q8AAaoUn{}hRs0# z&oB$9y>e3=2#A~;GiC0?+?F@H(RQOVUn)tlSQP$NDvPR0G#ZgaPmlEW_Nreuc3kQd z=s*@|*ny>`CCSaqVATO~Ihmj5<*B|T5((LqN@26>!w%gi;V`FR!;)nP{f+8pyqZ{8 zsL15K*;_;QWp^QUZsZ^FZgjQj8R?umx8Xf=eaYCl1rqx-=T)|AcYouRu1kOU? z&KgR#A`*E1YD5@16q4rIXX}>DDm3(Y$5zRBP&+k3jdufXaM~G$(jSM1R0kO9ze=8? z13b)q0bHGjUi>qHn9nQ2jN$!z_o&JFtCpO~IoU_w{io&-%X#2Ca%jj&)hUlRvMpis zAYXCcbJB3i%NJ%m|T-2IJAGp4iah-qq?77Rf)>fk}k3z0L9l%gzF&Azk^SWC@>@BV;ZIYYh%(it1 zG5sgNR~DTvGedg-(|%CUe{E4$L_-9|4{EcJ3*-oj~|lTffZ#dIl%D_vJ1f zfOmZRdmdQ(R7U023AvoFafze-TpM`L7116IDk#;-5WgHnP=3-8^Gdcq!sb;$eWVDlPnp(*OVf07*qoM6N<$g3Wn;WB>pF literal 0 HcmV?d00001 diff --git a/src/components/header/view/headerView.js b/src/components/header/view/headerView.js index 5ebbe6180..9d70ee90d 100644 --- a/src/components/header/view/headerView.js +++ b/src/components/header/view/headerView.js @@ -13,7 +13,7 @@ import { IconButton } from '../../iconButton'; // Styles import styles from './headerStyles'; -const DEFAULT_IMAGE = require('../../../assets/esteem.png'); +const DEFAULT_IMAGE = require('../../../assets/avatar_default.png'); class HeaderView extends Component { /* Props diff --git a/src/components/postButton/container/postButtonContainer.js b/src/components/postButton/container/postButtonContainer.js index b3ac01b76..b626fdb98 100644 --- a/src/components/postButton/container/postButtonContainer.js +++ b/src/components/postButton/container/postButtonContainer.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { connect } from 'react-redux'; import { withNavigation } from 'react-navigation'; // Components @@ -25,4 +26,8 @@ class PostButtonContainer extends Component { } } -export default withNavigation(PostButtonContainer); +const mapStateToProps = state => ({ + isLoggedIn: state.application.isLoggedIn, +}); + +export default connect(mapStateToProps)(withNavigation(PostButtonContainer)); diff --git a/src/components/postButton/view/postButtonView.js b/src/components/postButton/view/postButtonView.js index 937d1deec..275e2b2b0 100644 --- a/src/components/postButton/view/postButtonView.js +++ b/src/components/postButton/view/postButtonView.js @@ -7,6 +7,9 @@ import Icon from 'react-native-vector-icons/FontAwesome'; // Components import SubPostButton from './subPostButtonView'; +// Constant +import { default as ROUTES } from '../../../constants/routeNames'; + // Styles import styles from './postButtonStyles'; @@ -81,7 +84,7 @@ class PostButtonView extends Component { outputRange: ['0deg', '45deg'], }); - const { handleSubButtonPress } = this.props; + const { handleSubButtonPress, isLoggedIn } = this.props; return ( @@ -92,6 +95,8 @@ class PostButtonView extends Component { top: firstY, }} icon="camera" + onPress={() => handleSubButtonPress(isLoggedIn ? ROUTES.SCREENS.EDITOR : ROUTES.SCREENS.LOGIN) + } /> handleSubButtonPress('EditorScreen')} + onPress={() => handleSubButtonPress(isLoggedIn ? ROUTES.SCREENS.EDITOR : ROUTES.SCREENS.LOGIN) + } /> handleSubButtonPress(isLoggedIn ? ROUTES.SCREENS.EDITOR : ROUTES.SCREENS.LOGIN) + } /> - - + this._handleOnVotersPress()} style={styles.payoutButton} @@ -106,9 +104,7 @@ $ {content.top_likers ? ( - this._handleOnVotersPress()} - > + this._handleOnVotersPress()}> @ {content.top_likers[0]} - , @ +, @ {content.top_likers[1]} - , @ +, @ {content.top_likers[2]} & {content.vote_count - content.top_likers.length} {' '} - others like this +others like this - ) : ( diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index c23a084e8..47dec510e 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -84,7 +84,7 @@ class PostsView extends Component { start_author: startAuthor, start_permlink: startPermlink, }, - user.name, + (user && user.name) || 'esteemapp', ).then((result) => { const _posts = result; _posts.shift(); @@ -127,10 +127,7 @@ class PostsView extends Component { isReady, refreshing, posts, user, } = this.state; const { - componentId, - filterOptions, - isLoginMust, - isLoggedIn, + componentId, filterOptions, isLoginMust, isLoggedIn, } = this.props; if (user && posts && posts.length > 0) { @@ -140,7 +137,6 @@ class PostsView extends Component { )} diff --git a/src/screens/editor/container/editorContainer.js b/src/screens/editor/container/editorContainer.js index 86ee14b85..101c1d883 100644 --- a/src/screens/editor/container/editorContainer.js +++ b/src/screens/editor/container/editorContainer.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { connect } from 'react-redux'; // Services and Actions import { postContent } from '../../../providers/steem/dsteem'; @@ -69,8 +70,14 @@ class ExampleContainer extends Component { }; render() { - return ; + const { isLoggedIn } = this.props; + + return ; } } -export default ExampleContainer; +const mapStateToProps = state => ({ + isLoggedIn: state.application.isLoggedIn, +}); + +export default connect(mapStateToProps)(ExampleContainer); diff --git a/src/screens/editor/screen/editorScreen.js b/src/screens/editor/screen/editorScreen.js index 6a5749ef8..1275e566c 100644 --- a/src/screens/editor/screen/editorScreen.js +++ b/src/screens/editor/screen/editorScreen.js @@ -91,6 +91,7 @@ export class EditorScreen extends Component { render() { const { isPreviewActive, wordsCount, isFormValid } = this.state; + const { isLoggedIn } = this.props; return ( diff --git a/src/screens/home/screen/homeScreen.js b/src/screens/home/screen/homeScreen.js index 19d0df8aa..faf92913c 100644 --- a/src/screens/home/screen/homeScreen.js +++ b/src/screens/home/screen/homeScreen.js @@ -38,7 +38,17 @@ export default class HomeScreen extends PureComponent { render() { const { componentId, isLoggedIn, currentAccount } = this.props; - const _filterOptions = ['NEW POSTS', 'VOTES', 'REPLIES', 'MENTIONS', 'FOLLOWS', 'REBLOGS']; + const _filterOptions = [ + 'FEED', + 'TRENDING', + 'HOT', + 'NEW', + 'ACTIVE', + 'PROMETED', + 'VOTES', + 'COMMENTS', + 'PAYOUT', + ]; return ( @@ -57,23 +67,12 @@ export default class HomeScreen extends PureComponent { /> )} > - {isLoggedIn && ( - - - - )} - +