diff --git a/src/components/editorElements/selectCommunityArea/view/selectCommunityAreaView.js b/src/components/editorElements/selectCommunityArea/view/selectCommunityAreaView.js index f7f44c5ee..e9be69ba2 100644 --- a/src/components/editorElements/selectCommunityArea/view/selectCommunityAreaView.js +++ b/src/components/editorElements/selectCommunityArea/view/selectCommunityAreaView.js @@ -1,5 +1,6 @@ import React, { useEffect } from 'react'; import { TouchableOpacity, Text } from 'react-native'; +import { injectIntl } from 'react-intl'; import { UserAvatar } from '../../../userAvatar'; @@ -7,7 +8,14 @@ import globalStyles from '../../../../globalStyles'; import styles from './selectCommunityAreStyles'; -const SelectCommunityAreaView = ({ community, mode, currentAccount, onPressIn, onPressOut }) => { +const SelectCommunityAreaView = ({ + community, + mode, + currentAccount, + onPressIn, + onPressOut, + intl, +}) => { return ( - {mode === 'community' ? community.title : 'My Blog'} + {mode === 'community' ? community.title : intl.formatMessage({ id: 'editor.my_blog' })} ); }; -export default SelectCommunityAreaView; +export default injectIntl(SelectCommunityAreaView); diff --git a/src/components/editorElements/selectCommunityModal/container/selectCommunityModalContainer.js b/src/components/editorElements/selectCommunityModal/container/selectCommunityModalContainer.js index 3c9e876be..a3b0ed5ba 100644 --- a/src/components/editorElements/selectCommunityModal/container/selectCommunityModalContainer.js +++ b/src/components/editorElements/selectCommunityModal/container/selectCommunityModalContainer.js @@ -15,7 +15,7 @@ import { fetchSubscribedCommunitiesSuccess, } from '../../../../redux/actions/communitiesAction'; -const SelectCommunityModalContainer = ({ onPressCommunity }) => { +const SelectCommunityModalContainer = ({ onPressCommunity, currentAccount }) => { const dispatch = useDispatch(); const [searchedCommunities, setSearchedCommunities] = useState([]); @@ -32,7 +32,7 @@ const SelectCommunityModalContainer = ({ onPressCommunity }) => { const callTopCommunities = () => { dispatch(fetchCommunities()); - getCommunities('', 50, '', 'rank') + getCommunities('', 15, '', 'rank') .then((communities) => { dispatch(fetchCommunitiesSuccess(communities)); }) @@ -43,7 +43,7 @@ const SelectCommunityModalContainer = ({ onPressCommunity }) => { const callSubscribedCommunities = () => { dispatch(fetchSubscribedCommunities()); - getSubscriptions('furkankilic') + getSubscriptions(currentAccount.name) .then((subscriptions) => { dispatch(fetchSubscribedCommunitiesSuccess(subscriptions)); }) @@ -53,7 +53,7 @@ const SelectCommunityModalContainer = ({ onPressCommunity }) => { const handleChangeSearch = (text) => { if (text.length >= 3) { setShowSearchedCommunities(true); - getCommunities('', 50, text, 'rank') + getCommunities('', 15, text, 'rank') .then((searcheds) => { setSearchedCommunities(searcheds); console.log(searcheds, text, 'searcheds'); @@ -66,8 +66,6 @@ const SelectCommunityModalContainer = ({ onPressCommunity }) => { } }; - const handlePressCloseForSearch = () => {}; - return ( <> { onChangeSearch={debounce(handleChangeSearch, 500)} searchedCommunities={searchedCommunities} showSearchedCommunities={showSearchedCommunities} + currentAccount={currentAccount} /> ); diff --git a/src/components/editorElements/selectCommunityModal/view/selectCommunityModalView.js b/src/components/editorElements/selectCommunityModal/view/selectCommunityModalView.js index 6fdfa0bf8..2a892b314 100644 --- a/src/components/editorElements/selectCommunityModal/view/selectCommunityModalView.js +++ b/src/components/editorElements/selectCommunityModal/view/selectCommunityModalView.js @@ -1,11 +1,11 @@ import React from 'react'; import { View, Text, ScrollView, FlatList } from 'react-native'; -import globalStyles from '../../../../globalStyles'; +import { injectIntl } from 'react-intl'; import CommunityCard from '../../../communityCard'; - import { SearchInput } from '../../../searchInput'; +import globalStyles from '../../../../globalStyles'; import styles from './selectCommunityModalStyles'; const SelectCommunityModalView = ({ @@ -16,7 +16,10 @@ const SelectCommunityModalView = ({ onPressCloseForSearch, searchedCommunities, showSearchedCommunities, + currentAccount, + intl, }) => { + console.log(subscribedCommunities, 'subscribedCommunities'); return ( @@ -29,7 +32,7 @@ const SelectCommunityModalView = ({ renderItem={({ item, index, separators }) => ( @@ -37,14 +40,47 @@ const SelectCommunityModalView = ({ /> ) : ( <> - MY BLOG + + {intl.formatMessage({ id: 'editor.my_blog' }).toUpperCase()} + onPressCommunity(null)} /> + {!subscribedCommunities.loading && + !subscribedCommunities.error && + subscribedCommunities.data.length > 0 && ( + + + {intl.formatMessage({ id: 'editor.my_communities' }).toUpperCase()} + + } + showsVerticalScrollIndicator={false} + data={subscribedCommunities.data} + renderItem={({ item, index, separators }) => { + const community = { name: item[0], title: item[1] }; + return ( + + ); + }} + /> + + )} {!topCommunities.loading && !topCommunities.error && topCommunities.data.length > 0 && ( - TOP RATED + + {' '} + {intl.formatMessage({ id: 'editor.top_communities' }).toUpperCase()} + } showsVerticalScrollIndicator={false} @@ -60,32 +96,13 @@ const SelectCommunityModalView = ({ /> )} - {!subscribedCommunities.loading && - !subscribedCommunities.error && - subscribedCommunities.data.length > 0 && ( - - SUBSCRIBED - } - showsVerticalScrollIndicator={false} - data={subscribedCommunities.data} - renderItem={({ item, index, separators }) => ( - - )} - /> - - )} )} + ); }; const Separator = () => ; -export default SelectCommunityModalView; +export default injectIntl(SelectCommunityModalView); diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index dd1241509..2c0413f07 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -291,7 +291,10 @@ "reward_power_up": "Power Up 100%", "reward_decline": "Decline Payout", "beneficiaries": "Beneficiaries", - "options": "Options" + "options": "Options", + "my_blog": "My Blog", + "my_communities": "My Communities", + "top_communities": "Top Communities" }, "pincode": { "enter_text": "Enter PIN to unlock", diff --git a/src/screens/editor/screen/editorScreen.js b/src/screens/editor/screen/editorScreen.js index a2b01dce8..ebe3c18f7 100644 --- a/src/screens/editor/screen/editorScreen.js +++ b/src/screens/editor/screen/editorScreen.js @@ -280,7 +280,10 @@ class EditorScreen extends Component { presentationStyle="pageSheet" style={styles.modal} > - + handleDatePickerChange(date, fields)}