created screen and header

This commit is contained in:
ue 2019-09-04 22:17:39 +03:00
parent a8c46778d4
commit e8e5c9a95d
14 changed files with 210 additions and 24 deletions

View File

@ -0,0 +1,31 @@
import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({
headerContainer: {
height: 100,
flexDirection: 'row',
padding: 21,
},
backIcon: {
color: '$white',
},
wrapper: {
marginLeft: 16,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
textWrapper: {
marginLeft: 16,
},
name: {
color: '$white',
fontSize: 14,
fontWeight: 'bold',
},
username: {
color: '$white',
fontSize: 12,
marginTop: 4,
},
});

View File

@ -0,0 +1,38 @@
import React from 'react';
import { withNavigation } from 'react-navigation';
import { View, Text } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import { UserAvatar } from '../userAvatar';
import { IconButton } from '../iconButton';
// Styles
import styles from './avatarHeaderStyles';
const TooltipView = ({ username, name, reputation, navigation }) => (
<LinearGradient
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 0 }}
colors={['#357ce6', '#2d5aa0']}
style={styles.headerView}
>
<View style={styles.headerContainer}>
<IconButton
iconStyle={styles.backIcon}
iconType="MaterialIcons"
name="arrow-back"
onPress={() => navigation.goBack()}
size={25}
/>
<View style={styles.wrapper}>
<UserAvatar noAction size="xl" username={username} />
<View style={styles.textWrapper}>
<Text style={styles.name}>{name}</Text>
<Text style={styles.username}>{`@${username} (${reputation})`}</Text>
</View>
</View>
</View>
</LinearGradient>
);
export default withNavigation(TooltipView);

View File

@ -0,0 +1,3 @@
import AvatarHeader from './avatarHeaderView';
export { AvatarHeader };

View File

@ -100,7 +100,7 @@ class BasicHeaderView extends Component {
<IconButton <IconButton
iconStyle={[styles.backIcon, isModalHeader && styles.closeIcon]} iconStyle={[styles.backIcon, isModalHeader && styles.closeIcon]}
iconType="MaterialIcons" iconType="MaterialIcons"
name={isModalHeader ? 'arrow-back' : 'arrow-back'} name="arrow-back"
onPress={() => (isModalHeader ? handleOnPressClose() : handleOnPressBackButton())} onPress={() => (isModalHeader ? handleOnPressClose() : handleOnPressBackButton())}
disabled={disabled} disabled={disabled}
/> />

View File

@ -67,6 +67,7 @@ class ProfileSummaryView extends PureComponent {
handleFollowUnfollowUser, handleFollowUnfollowUser,
handleOnFavoritePress, handleOnFavoritePress,
handleOnFollowsPress, handleOnFollowsPress,
handleOnPressProfileEdit,
handleUIChange, handleUIChange,
hoursRC, hoursRC,
hoursVP, hoursVP,
@ -184,7 +185,7 @@ class ProfileSummaryView extends PureComponent {
</TouchableOpacity> </TouchableOpacity>
</Fragment> </Fragment>
</View> </View>
{isLoggedIn && !isOwnProfile && ( {isLoggedIn && !isOwnProfile ? (
<View style={styles.rightIcons}> <View style={styles.rightIcons}>
<IconButton <IconButton
backgroundColor="transparent" backgroundColor="transparent"
@ -221,6 +222,19 @@ class ProfileSummaryView extends PureComponent {
/> />
)} )}
</View> </View>
) : (
isOwnProfile && (
<Fragment>
<IconButton
backgroundColor="transparent"
color="#c1c5c7"
iconType="MaterialCommunityIcons"
name="pencil"
onPress={handleOnPressProfileEdit}
size={20}
/>
</Fragment>
)
)} )}
</View> </View>
</Fragment> </Fragment>

View File

@ -24,6 +24,7 @@ export default {
PROMOTE: `Promote${SCREEN_SUFFIX}`, PROMOTE: `Promote${SCREEN_SUFFIX}`,
FREE_ESTM: `FreeEstm${SCREEN_SUFFIX}`, FREE_ESTM: `FreeEstm${SCREEN_SUFFIX}`,
REBLOGS: `Reblogs${SCREEN_SUFFIX}`, REBLOGS: `Reblogs${SCREEN_SUFFIX}`,
PROFILE_EDIT: `ProfileEdit${SCREEN_SUFFIX}`,
}, },
DRAWER: { DRAWER: {
MAIN: `Main${DRAWER_SUFFIX}`, MAIN: `Main${DRAWER_SUFFIX}`,

View File

@ -1,4 +1,5 @@
import PointsContainer from './pointsContainer'; import PointsContainer from './pointsContainer';
import TransferContainer from './transferContainer'; import TransferContainer from './transferContainer';
import ProfileEditContainer from './profileEditContainer';
export { PointsContainer, TransferContainer }; export { PointsContainer, TransferContainer, ProfileEditContainer };

View File

@ -0,0 +1,39 @@
import { Component } from 'react';
import { connect } from 'react-redux';
// import ROUTES from '../constants/routeNames';
class ProfileEditContainer extends Component {
/* Props
* ------------------------------------------------
* @prop { type } name - Description....
*/
constructor(props) {
super(props);
this.state = {};
}
// Component Life Cycles
// Component Functions
_handleOnSave = () => {};
render() {
const { children, currentAccount } = this.props;
return (
children &&
children({
currentAccount,
})
);
}
}
const mapStateToProps = state => ({
currentAccount: state.account.currentAccount,
});
export default connect(mapStateToProps)(ProfileEditContainer);

View File

@ -9,6 +9,8 @@ import { default as ROUTES } from '../constants/routeNames';
// Screens // Screens
import { import {
Bookmarks, Bookmarks,
Boost,
BoostPost,
Drafts, Drafts,
Editor, Editor,
Follows, Follows,
@ -16,15 +18,14 @@ import {
PinCode, PinCode,
Post, Post,
Profile, Profile,
ProfileEdit,
Promote,
Reblogs,
SearchResult,
Settings, Settings,
SteemConnect, SteemConnect,
Voters,
SearchResult,
Transfer, Transfer,
Boost, Voters,
Promote,
BoostPost,
Reblogs,
} from '../screens'; } from '../screens';
// Components // Components
@ -55,6 +56,12 @@ const stackNavigatior = createStackNavigator(
header: () => null, header: () => null,
}, },
}, },
[ROUTES.SCREENS.PROFILE_EDIT]: {
screen: ProfileEdit,
navigationOptions: {
header: () => null,
},
},
[ROUTES.SCREENS.POST]: { [ROUTES.SCREENS.POST]: {
screen: Post, screen: Post,
navigationOptions: { navigationOptions: {

View File

@ -19,6 +19,7 @@ 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'; import Reblogs from './reblogs';
import ProfileEdit from './profileEdit/screen/profileEditScreen';
export { export {
Bookmarks, Bookmarks,
@ -35,11 +36,12 @@ export {
Points, Points,
Post, Post,
Profile, Profile,
ProfileEdit,
Promote, Promote,
Reblogs,
SearchResult, SearchResult,
Settings, Settings,
SteemConnect, SteemConnect,
Transfer, Transfer,
Voters, Voters,
Reblogs,
}; };

View File

@ -343,6 +343,12 @@ class ProfileContainer extends Component {
this.setState({ forceLoadPost: value }); this.setState({ forceLoadPost: value });
}; };
_handleOnPressProfileEdit = () => {
const { navigation } = this.props;
navigation.navigate(ROUTES.SCREENS.PROFILE_EDIT);
};
render() { render() {
const { const {
avatar, avatar,
@ -368,16 +374,19 @@ class ProfileContainer extends Component {
about={get(user, 'about.profile')} about={get(user, 'about.profile')}
activePage={activePage} activePage={activePage}
avatar={avatar} avatar={avatar}
changeForceLoadPostState={this._changeForceLoadPostState}
comments={comments} comments={comments}
currency={currency} currency={currency}
error={error} error={error}
follows={follows} follows={follows}
forceLoadPost={forceLoadPost}
getReplies={() => this._getReplies(username)} getReplies={() => this._getReplies(username)}
handleFollowUnfollowUser={this._handleFollowUnfollowUser} handleFollowUnfollowUser={this._handleFollowUnfollowUser}
handleMuteUnmuteUser={this._handleMuteUnmuteUser} handleMuteUnmuteUser={this._handleMuteUnmuteUser}
handleOnBackPress={this._handleOnBackPress} handleOnBackPress={this._handleOnBackPress}
handleOnFavoritePress={this._handleOnFavoritePress} handleOnFavoritePress={this._handleOnFavoritePress}
handleOnFollowsPress={this._handleFollowsPress} handleOnFollowsPress={this._handleFollowsPress}
handleOnPressProfileEdit={this._handleOnPressProfileEdit}
isDarkTheme={isDarkTheme} isDarkTheme={isDarkTheme}
isFavorite={isFavorite} isFavorite={isFavorite}
isFollowing={isFollowing} isFollowing={isFollowing}
@ -389,8 +398,6 @@ class ProfileContainer extends Component {
selectedQuickProfile={selectedQuickProfile} selectedQuickProfile={selectedQuickProfile}
selectedUser={user} selectedUser={user}
username={username} username={username}
forceLoadPost={forceLoadPost}
changeForceLoadPostState={this._changeForceLoadPostState}
/> />
); );
} }

View File

@ -62,15 +62,19 @@ class ProfileScreen extends PureComponent {
render() { render() {
const { const {
about, about,
activePage,
changeForceLoadPostState,
comments, comments,
currency, currency,
follows, follows,
forceLoadPost,
getReplies, getReplies,
handleFollowUnfollowUser, handleFollowUnfollowUser,
handleMuteUnmuteUser, handleMuteUnmuteUser,
handleOnBackPress, handleOnBackPress,
handleOnFavoritePress, handleOnFavoritePress,
handleOnFollowsPress, handleOnFollowsPress,
handleOnPressProfileEdit,
intl, intl,
isDarkTheme, isDarkTheme,
isFavorite, isFavorite,
@ -83,9 +87,6 @@ class ProfileScreen extends PureComponent {
selectedQuickProfile, selectedQuickProfile,
selectedUser, selectedUser,
username, username,
activePage,
forceLoadPost,
changeForceLoadPostState,
} = this.props; } = this.props;
const { const {
@ -175,6 +176,7 @@ class ProfileScreen extends PureComponent {
location={location} location={location}
percentRC={resourceCredits} percentRC={resourceCredits}
percentVP={votingPower} percentVP={votingPower}
handleOnPressProfileEdit={handleOnPressProfileEdit}
/> />
</CollapsibleCard> </CollapsibleCard>
)} )}

View File

@ -0,0 +1,41 @@
import React, { PureComponent, Fragment } from 'react';
import { injectIntl } from 'react-intl';
import get from 'lodash/get';
import { ProfileEditContainer } from '../../../containers';
import AvatarHeader from '../../../components/avatarHeader/avatarHeaderView';
class ProfileEditScreen extends PureComponent {
/* Props
* ------------------------------------------------
* @prop { type } name - Description....
*/
constructor(props) {
super(props);
this.state = {};
}
// Component Life Cycles
// Component Functions
render() {
return (
<ProfileEditContainer>
{({ currentAccount }) => (
<Fragment>
<AvatarHeader
username={get(currentAccount, 'name')}
name={get(currentAccount, 'about.profile.name')}
reputation={get(currentAccount, 'reputation')}
/>
</Fragment>
)}
</ProfileEditContainer>
);
}
}
export default injectIntl(ProfileEditScreen);

View File

@ -84,15 +84,6 @@ class SettingsScreen extends PureComponent {
})} })}
titleStyle={styles.cardTitle} titleStyle={styles.cardTitle}
/> />
<SettingsItem
title={intl.formatMessage({
id: 'settings.dark_theme',
})}
type="toggle"
actionType="theme"
isOn={isDarkTheme}
handleOnChange={handleOnChange}
/>
<SettingsItem <SettingsItem
title={intl.formatMessage({ title={intl.formatMessage({
id: 'settings.currency', id: 'settings.currency',
@ -143,6 +134,15 @@ class SettingsScreen extends PureComponent {
selectedOptionIndex={parseInt(nsfw, 10)} selectedOptionIndex={parseInt(nsfw, 10)}
handleOnChange={handleOnChange} handleOnChange={handleOnChange}
/> />
<SettingsItem
title={intl.formatMessage({
id: 'settings.dark_theme',
})}
type="toggle"
actionType="theme"
isOn={isDarkTheme}
handleOnChange={handleOnChange}
/>
{!!isLoggedIn && ( {!!isLoggedIn && (
<SettingsItem <SettingsItem
title={intl.formatMessage({ title={intl.formatMessage({