mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-30 09:07:28 +03:00
Added reblogs screen
This commit is contained in:
parent
301e56c8d4
commit
3f8b65a95b
@ -51,6 +51,18 @@ class PostDisplayContainer extends Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_handleOnReblogsPress = reblogs => {
|
||||||
|
const { navigation, post } = this.props;
|
||||||
|
|
||||||
|
navigation.navigate({
|
||||||
|
routeName: ROUTES.SCREENS.REBLOGS,
|
||||||
|
params: {
|
||||||
|
reblogs,
|
||||||
|
},
|
||||||
|
key: post.permlink + Math.random(),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
_handleOnReplyPress = () => {
|
_handleOnReplyPress = () => {
|
||||||
const { post, navigation } = this.props;
|
const { post, navigation } = this.props;
|
||||||
|
|
||||||
@ -123,6 +135,7 @@ class PostDisplayContainer extends Component {
|
|||||||
handleOnRemovePress={this._handleDeleteComment}
|
handleOnRemovePress={this._handleDeleteComment}
|
||||||
handleOnReplyPress={this._handleOnReplyPress}
|
handleOnReplyPress={this._handleOnReplyPress}
|
||||||
handleOnVotersPress={this._handleOnVotersPress}
|
handleOnVotersPress={this._handleOnVotersPress}
|
||||||
|
handleOnReblogsPress={this._handleOnReblogsPress}
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
isNewPost={isNewPost}
|
isNewPost={isNewPost}
|
||||||
isPostUnavailable={isPostUnavailable}
|
isPostUnavailable={isPostUnavailable}
|
||||||
|
@ -71,6 +71,7 @@ class PostDisplayView extends PureComponent {
|
|||||||
handleOnEditPress,
|
handleOnEditPress,
|
||||||
handleOnReplyPress,
|
handleOnReplyPress,
|
||||||
handleOnVotersPress,
|
handleOnVotersPress,
|
||||||
|
handleOnReblogsPress,
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
post,
|
post,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@ -101,6 +102,7 @@ class PostDisplayView extends PureComponent {
|
|||||||
iconStyle={styles.barIcons}
|
iconStyle={styles.barIcons}
|
||||||
iconType="MaterialIcons"
|
iconType="MaterialIcons"
|
||||||
isClickable
|
isClickable
|
||||||
|
onPress={() => handleOnReblogsPress && handleOnReblogsPress(get(post, 'reblogs'))}
|
||||||
text={get(post, 'reblogCount', 0)}
|
text={get(post, 'reblogCount', 0)}
|
||||||
textMarginLeft={20}
|
textMarginLeft={20}
|
||||||
/>
|
/>
|
||||||
|
@ -326,5 +326,8 @@
|
|||||||
"rewards": "REWARDS",
|
"rewards": "REWARDS",
|
||||||
"percent": "PERCENT",
|
"percent": "PERCENT",
|
||||||
"time": "TIME"
|
"time": "TIME"
|
||||||
|
},
|
||||||
|
"reblog": {
|
||||||
|
"title": "Reblog Info"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ export default {
|
|||||||
BOOST_POST: `BoostPost${SCREEN_SUFFIX}`,
|
BOOST_POST: `BoostPost${SCREEN_SUFFIX}`,
|
||||||
PROMOTE: `Promote${SCREEN_SUFFIX}`,
|
PROMOTE: `Promote${SCREEN_SUFFIX}`,
|
||||||
FREE_ESTM: `FreeEstm${SCREEN_SUFFIX}`,
|
FREE_ESTM: `FreeEstm${SCREEN_SUFFIX}`,
|
||||||
|
REBLOGS: `Reblogs${SCREEN_SUFFIX}`,
|
||||||
},
|
},
|
||||||
DRAWER: {
|
DRAWER: {
|
||||||
MAIN: `Main${DRAWER_SUFFIX}`,
|
MAIN: `Main${DRAWER_SUFFIX}`,
|
||||||
|
@ -2,6 +2,8 @@ import { PureComponent } from 'react';
|
|||||||
|
|
||||||
import { isBefore } from '../utils/time';
|
import { isBefore } from '../utils/time';
|
||||||
|
|
||||||
|
import ROUTES from '../constants/routeNames';
|
||||||
|
|
||||||
class AccountListContainer extends PureComponent {
|
class AccountListContainer extends PureComponent {
|
||||||
/* Props
|
/* Props
|
||||||
* ------------------------------------------------
|
* ------------------------------------------------
|
||||||
@ -54,6 +56,18 @@ class AccountListContainer extends PureComponent {
|
|||||||
this.setState({ filterResult: _data });
|
this.setState({ filterResult: _data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_handleOnUserPress = username => {
|
||||||
|
const { navigation } = this.props;
|
||||||
|
|
||||||
|
navigation.navigate({
|
||||||
|
routeName: ROUTES.SCREENS.PROFILE,
|
||||||
|
params: {
|
||||||
|
username,
|
||||||
|
},
|
||||||
|
key: username,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { data, filterResult } = this.state;
|
const { data, filterResult } = this.state;
|
||||||
const { children } = this.props;
|
const { children } = this.props;
|
||||||
@ -65,6 +79,7 @@ class AccountListContainer extends PureComponent {
|
|||||||
filterResult,
|
filterResult,
|
||||||
handleOnVotersDropdownSelect: this._handleOnVotersDropdownSelect,
|
handleOnVotersDropdownSelect: this._handleOnVotersDropdownSelect,
|
||||||
handleSearch: this._handleSearch,
|
handleSearch: this._handleSearch,
|
||||||
|
handleOnUserPress: this._handleOnUserPress,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import {
|
|||||||
Boost,
|
Boost,
|
||||||
Promote,
|
Promote,
|
||||||
BoostPost,
|
BoostPost,
|
||||||
|
Reblogs,
|
||||||
} from '../screens';
|
} from '../screens';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
@ -126,6 +127,12 @@ const stackNavigatior = createStackNavigator(
|
|||||||
header: () => null,
|
header: () => null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
[ROUTES.SCREENS.REBLOGS]: {
|
||||||
|
screen: Reblogs,
|
||||||
|
navigationOptions: {
|
||||||
|
header: () => null,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
headerMode: 'none',
|
headerMode: 'none',
|
||||||
|
@ -18,6 +18,7 @@ import BoostPost from './boostPost/screen/boostPostScreen';
|
|||||||
import Promote from './promote/screen/promoteScreen';
|
import Promote from './promote/screen/promoteScreen';
|
||||||
import SteemConnect from './steem-connect/steemConnect';
|
import SteemConnect from './steem-connect/steemConnect';
|
||||||
import Transfer from './transfer';
|
import Transfer from './transfer';
|
||||||
|
import Reblogs from './reblogs';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Bookmarks,
|
Bookmarks,
|
||||||
@ -40,4 +41,5 @@ export {
|
|||||||
SteemConnect,
|
SteemConnect,
|
||||||
Transfer,
|
Transfer,
|
||||||
Voters,
|
Voters,
|
||||||
|
Reblogs,
|
||||||
};
|
};
|
||||||
|
1
src/screens/reblogs/index.js
Normal file
1
src/screens/reblogs/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { default } from './screen/reblogScreen';
|
@ -1,50 +1,59 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React from 'react';
|
||||||
import { View } from 'react-native';
|
import { View, FlatList } from 'react-native';
|
||||||
import { injectIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { BasicHeader } from '../../../components/basicHeader';
|
import { BasicHeader } from '../../../components/basicHeader';
|
||||||
import { FilterBar } from '../../../components/filterBar';
|
import { UserListItem } from '../../../components/basicUIElements';
|
||||||
import { VotersDisplay } from '../../../components/votersDisplay';
|
|
||||||
|
|
||||||
import AccountListContainer from '../../../containers/accountListContainer';
|
import AccountListContainer from '../../../containers/accountListContainer';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import globalStyles from '../../../globalStyles';
|
import globalStyles from '../../../globalStyles';
|
||||||
|
import { getTimeFromNow } from '../../../utils/time';
|
||||||
|
|
||||||
class ReblogScreen extends PureComponent {
|
const renderUserListItem = (item, index, handleOnUserPress) => {
|
||||||
render() {
|
return (
|
||||||
const { intl, navigation } = this.props;
|
<UserListItem
|
||||||
const headerTitle = intl.formatMessage({
|
index={index}
|
||||||
id: 'voters.voters_info',
|
username={item.account}
|
||||||
});
|
description={getTimeFromNow(item.timestamp)}
|
||||||
|
handleOnPress={() => handleOnUserPress(item.account)}
|
||||||
|
isClickable
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const activeVotes =
|
const ReblogScreen = ({ navigation }) => {
|
||||||
navigation.state && navigation.state.params && navigation.state.params.activeVotes;
|
const intl = useIntl();
|
||||||
|
const headerTitle = intl.formatMessage({
|
||||||
|
id: 'reblog.title',
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
const activeVotes =
|
||||||
<AccountListContainer data={activeVotes}>
|
navigation.state && navigation.state.params && navigation.state.params.reblogs;
|
||||||
{({ data, filterResult, handleOnVotersDropdownSelect, handleSearch }) => (
|
|
||||||
<View style={globalStyles.container}>
|
|
||||||
<BasicHeader
|
|
||||||
title={`${headerTitle} (${data && data.length})`}
|
|
||||||
isHasSearch
|
|
||||||
handleOnSearch={text => handleSearch(text, 'voter')}
|
|
||||||
/>
|
|
||||||
<FilterBar
|
|
||||||
dropdownIconName="arrow-drop-down"
|
|
||||||
options={['REWARDS', 'PERCENT', 'TIME']}
|
|
||||||
defaultText="REWARDS"
|
|
||||||
onDropdownSelect={handleOnVotersDropdownSelect}
|
|
||||||
/>
|
|
||||||
<VotersDisplay key={Math.random()} votes={filterResult || data} />
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</AccountListContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default injectIntl(ReblogScreen);
|
return (
|
||||||
|
<AccountListContainer data={activeVotes} navigation={navigation}>
|
||||||
|
{({ data, filterResult, handleSearch, handleOnUserPress }) => (
|
||||||
|
<View style={globalStyles.container}>
|
||||||
|
<BasicHeader
|
||||||
|
title={`${headerTitle} (${data && data.length})`}
|
||||||
|
isHasSearch
|
||||||
|
handleOnSearch={text => handleSearch(text, 'account')}
|
||||||
|
/>
|
||||||
|
<FlatList
|
||||||
|
data={filterResult || data}
|
||||||
|
keyExtractor={item => item.account}
|
||||||
|
removeClippedSubviews={false}
|
||||||
|
renderItem={({ item, index }) => renderUserListItem(item, index, handleOnUserPress)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</AccountListContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ReblogScreen;
|
||||||
|
@ -67,8 +67,8 @@ export const parsePost = async (post, currentUserName, isPromoted) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const postReblogs = await getPostReblogs(post);
|
post.reblogs = await getPostReblogs(post);
|
||||||
post.reblogCount = postReblogs.length;
|
post.reblogCount = post.reblogs.length;
|
||||||
|
|
||||||
return post;
|
return post;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user