added language support for home enhanced editor

This commit is contained in:
ue 2018-11-26 15:03:12 +03:00
parent 7a7202e45f
commit d01d85e02a
9 changed files with 93 additions and 12 deletions

View File

@ -43,4 +43,7 @@ export default EStyleSheet.create({
dropdownIconStyle: {
color: '$primaryDarkGray',
},
icon: {
color: '$iconColor',
},
});

View File

@ -98,6 +98,7 @@ export default class MarkdownEditorView extends Component {
<IconButton
size={20}
style={styles.editorButton}
iconStyle={styles.icon}
iconType={item.iconType}
name={item.icon}
onPress={() => item.onPress({ getState, setState, item })}
@ -120,6 +121,7 @@ export default class MarkdownEditorView extends Component {
<IconButton
size={20}
style={styles.rightIcons}
iconStyle={styles.icon}
iconType="FontAwesome"
name="link"
onPress={() => Formats[9].onPress({ getState, setState })}

View File

@ -2,6 +2,7 @@ import React, { Component, Fragment } from 'react';
import {
View, Text, TextInput, FlatList, TouchableHighlight, Image,
} from 'react-native';
import FastImage from 'react-native-fast-image';
// Constants
@ -68,7 +69,7 @@ class SearchModalView extends Component {
onPress={() => handleOnPressListItem(searchResults.type, item)}
>
<View style={styles.searhItems}>
<Image
<FastImage
source={{
uri:
searchResults.type === 'user'

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react';
import { View, Text, ImageBackground } from 'react-native';
import { injectIntl } from 'react-intl';
import {
Thumbnail, List, ListItem, Container,
} from 'native-base';
@ -79,7 +80,7 @@ class SideMenuView extends Component {
render() {
const {
navigateToRoute, currentAccount, isLoggedIn, switchAccount,
navigateToRoute, currentAccount, isLoggedIn, switchAccount, intl,
} = this.props;
const { menuItems, isAddAccountIconActive } = this.state;
@ -91,7 +92,10 @@ class SideMenuView extends Component {
colors={['#357ce6', '#2d5aa0']}
style={styles.headerView}
>
<ImageBackground source={SIDE_MENU_BACKGROUND} style={{ width: '100%', height: '100%', flexDirection: 'row', }}>
<ImageBackground
source={SIDE_MENU_BACKGROUND}
style={{ width: '100%', height: '100%', flexDirection: 'row' }}
>
{isLoggedIn && (
<View style={styles.headerContentView}>
<Thumbnail style={styles.userAvatar} source={this._getUserAvatar()} />
@ -138,7 +142,9 @@ class SideMenuView extends Component {
{item.image && (
<Thumbnail small style={styles.otherUserAvatar} source={item.image} />
)}
<Text style={styles.listItemText}>{item.name}</Text>
<Text style={styles.listItemText}>
{intl.formatMessage({ id: `side_menu.${item.id}` })}
</Text>
</ListItem>
)}
/>
@ -148,4 +154,4 @@ class SideMenuView extends Component {
}
}
export default SideMenuView;
export default injectIntl(SideMenuView);

View File

@ -42,5 +42,19 @@
"cancel": "cancel",
"login": "LOGIN",
"steemconnect_description": "If you don't want to keep your password encrypted and saved on your device, you can use Steemconnect."
},
"home": {
"feed": "Feed",
"popular": "Popular"
},
"side_menu": {
"profile": "Profile",
"bookmarks": "Bookmarks",
"favorites": "Favorites",
"drafts": "Drafts",
"schedules": "Schedules",
"gallery": "Gallery",
"settings": "Settings",
"add_account": "Add Account"
}
}

View File

@ -35,12 +35,26 @@
"login": {
"signin": "Giriş",
"signup": "Kayıt",
"signin_title": "eSteem'in ayrıçalıklı dünyasına hoşgeldiniz.",
"signin_title": "eSteem'in ayrıcalıklı dünyasına hoşgeldiniz.",
"username": "Kullanıcı Adı",
"password": "Şifre yada WIF",
"description": "Kullanıçı bilgileri telefonunuz üzeründe şifreli olarak tutulur ve çıkış yaptıgınızda tüm bilgiler silinir.",
"cancel": "geç",
"login": "GİRİŞ",
"steemconnect_description": "Eğer kullanıçı bilgilerini şifreli olarak tutulmasını istemiyorsanız Steemconnect ilede giriş yapabilirsiniz."
},
"home": {
"feed": "Akış",
"popular": "Popüler"
},
"side_menu": {
"profile": "Profil",
"bookmarks": "Yerimleri",
"favorites": "Favoriler",
"drafts": "Taslaklar",
"schedules": "Yapılacaklar",
"gallery": "Galeri",
"settings": "Ayarlar",
"add_account": "Hesap Ekle"
}
}

View File

@ -5,36 +5,43 @@ const authMenuItems = [
name: 'Profile',
route: 'Profile',
icon: 'user-o',
id: 'profile',
},
{
name: 'Bookmarks',
route: 'bookmarks',
icon: 'star-o',
id: 'bookmarks',
},
{
name: 'Favorites',
route: 'favorites',
icon: 'heart-o',
id: 'favorites',
},
{
name: 'Drafts',
route: 'drafts',
icon: 'file-o',
id: 'drafts',
},
{
name: 'Schedules',
route: 'schedules',
icon: 'clock-o',
id: 'schedules',
},
{
name: 'Gallery',
route: 'galery',
icon: 'picture-o',
id: 'gallery',
},
{
name: 'Settings',
route: ROUTES.SCREENS.SETTINGS,
icon: 'gear',
id: 'settings',
},
];
@ -43,11 +50,13 @@ const noAuthMenuItems = [
name: 'Add Account',
route: ROUTES.SCREENS.LOGIN,
icon: 'plus-square-o',
id: 'add_account',
},
{
name: 'Settings',
route: ROUTES.SCREENS.SETTINGS,
icon: 'gear',
id: 'settings',
},
];

View File

@ -1,6 +1,7 @@
import React, { PureComponent, Fragment } from 'react';
import { View } from 'react-native';
import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view';
import { injectIntl } from 'react-intl';
// STEEM
@ -11,14 +12,16 @@ import { Header } from '../../../components/header';
// Styles
import styles from './homeStyles';
export default class HomeScreen extends PureComponent {
class HomeScreen extends PureComponent {
constructor(props) {
super(props);
this.state = {};
}
render() {
const { componentId, isLoggedIn, currentAccount } = this.props;
const {
componentId, isLoggedIn, currentAccount, intl,
} = this.props;
const _filterOptions = [
'FEED',
'TRENDING',
@ -47,7 +50,12 @@ export default class HomeScreen extends PureComponent {
/>
)}
>
<View tabLabel="Feed" style={styles.tabbarItem}>
<View
tabLabel={intl.formatMessage({
id: 'home.feed',
})}
style={styles.tabbarItem}
>
<Posts
filterOptions={_filterOptions}
getFor="feed"
@ -57,7 +65,12 @@ export default class HomeScreen extends PureComponent {
componentId={componentId}
/>
</View>
<View tabLabel="Popular" style={styles.tabbarItem}>
<View
tabLabel={intl.formatMessage({
id: 'home.popular',
})}
style={styles.tabbarItem}
>
<Posts
filterOptions={_filterOptions}
getFor="trending"
@ -72,3 +85,5 @@ export default class HomeScreen extends PureComponent {
);
}
}
export default injectIntl(HomeScreen);

View File

@ -100,13 +100,30 @@ export const parsePostsSummary = (posts, user) => {
post.vote_count = post.active_votes.length;
post.author_reputation = getReputation(post.author_reputation);
post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`;
post.body = markDown2Html(post.body);
post.summary = getPostSummary(post.body, 100);
post.raw_body = post.body;
post.is_voted = false;
const totalPayout = parseFloat(post.pending_payout_value)
+ parseFloat(post.total_payout_value)
+ parseFloat(post.curator_payout_value);
const voteRshares = post.active_votes.reduce((a, b) => a + parseFloat(b.rshares), 0);
const ratio = totalPayout / voteRshares;
if (post && post.active_votes) {
for (const i in post.active_votes) {
post.is_voted = post.active_votes[i].voter === user.name && post.active_votes[i].percent > 0;
post.vote_perecent = post.active_votes[i].voter === user.name ? post.active_votes[i].percent : null;
post.active_votes[i].value = (post.active_votes[i].rshares * ratio).toFixed(2);
post.active_votes[i].reputation = getReputation(post.active_votes[i].reputation);
post.active_votes[i].percent = post.active_votes[i].percent / 100;
post.active_votes[i].avatar = `https://steemitimages.com/u/${
post.active_votes[i].voter
}/avatar/small`;
post.active_votes[i].created = getTimeFromNow(post.active_votes[i].time);
post.active_votes[i].is_down_vote = Math.sign(post.active_votes[i].percent) < 0;
}
}
});
@ -131,10 +148,10 @@ export const parsePost = (post) => {
const voteRshares = post.active_votes.reduce((a, b) => a + parseFloat(b.rshares), 0);
const ratio = totalPayout / voteRshares;
// post.is_voted = false;
post.is_voted = false;
for (const i in post.active_votes) {
// post.is_voted = post.active_votes[i].voter === "u-e" && post.active_votes[i].percent > 0;
post.is_voted = post.active_votes[i].voter === "u-e" && post.active_votes[i].percent > 0;
post.active_votes[i].value = (post.active_votes[i].rshares * ratio).toFixed(2);
post.active_votes[i].reputation = getReputation(post.active_votes[i].reputation);
post.active_votes[i].avatar = `https://steemitimages.com/u/${