added less inforatmion status

This commit is contained in:
ue 2018-10-04 21:46:39 +03:00
parent 074906643e
commit f37b3f5544
10 changed files with 110 additions and 58 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

BIN
src/assets/no_post.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

View File

@ -1,5 +1,6 @@
import LineBreak from "./view/lineBreakView"; import LineBreak from "./view/lineBreakView";
import TextWithIcon from "./view/textWithIconView"; import TextWithIcon from "./view/textWithIconView";
import PercentBar from "./view/percentBarView"; import PercentBar from "./view/percentBarView";
import NoPost from "./view/noPostView";
export { LineBreak, TextWithIcon, PercentBar }; export { LineBreak, TextWithIcon, PercentBar, NoPost };

View File

@ -0,0 +1,21 @@
import EStyleSheet from "react-native-extended-stylesheet";
export default EStyleSheet.create({
wrapper: {
flexDirection: "column",
alignItems: "center",
height: "$deviceHeight",
backgroundColor: "$white",
},
image: {
width: "$deviceWidth - 40",
height: 192,
marginTop: 16,
},
text: {
color: "$primaryGray",
fontSize: 14,
marginTop: 12,
fontWeight: "bold",
},
});

View File

@ -0,0 +1,13 @@
import React from "react";
import { View, Text, Image, ScrollView } from "react-native";
import NO_POST from "../../../assets/no_post.png";
import styles from "./noPostStyles";
const NoPost = ({ text, name }) => (
<View style={styles.wrapper}>
<Image style={styles.image} source={NO_POST} />
<Text style={styles.text}>{"@" + name + " " + text}</Text>
</View>
);
export default NoPost;

View File

@ -11,13 +11,13 @@ const TextWithIcon = ({ iconName, text, isClickable, onPress }) => (
onPress={() => onPress && onPress()} onPress={() => onPress && onPress()}
> >
<View style={styles.wrapper}> <View style={styles.wrapper}>
<Ionicons style={styles.icon} name={iconName} /> {text && <Ionicons style={styles.icon} name={iconName} />}
<Text style={styles.text}>{text}</Text> <Text style={styles.text}>{text}</Text>
</View> </View>
</TouchableHighlight> </TouchableHighlight>
) : ( ) : (
<View style={styles.wrapper}> <View style={styles.wrapper}>
<Ionicons style={styles.icon} name={iconName} /> {text && <Ionicons style={styles.icon} name={iconName} />}
<Text style={styles.text}>{text}</Text> <Text style={styles.text}>{text}</Text>
</View> </View>
)} )}

View File

@ -63,7 +63,7 @@ class CollapsibleCardView extends Component {
}; };
render() { render() {
const { title, children, isLoading } = this.props; const { title, children, defaultTitle } = this.props;
const { expanded } = this.state; const { expanded } = this.state;
return ( return (
@ -77,6 +77,7 @@ class CollapsibleCardView extends Component {
color="#788187" color="#788187"
fontSize={12} fontSize={12}
title={title} title={title}
defaultTitle={defaultTitle}
iconName={expanded ? "md-arrow-dropdown" : "md-arrow-dropup"} iconName={expanded ? "md-arrow-dropdown" : "md-arrow-dropup"}
/> />
</TouchableHighlight> </TouchableHighlight>

View File

@ -26,12 +26,13 @@ class ContainerHeaderView extends Component {
render() { render() {
const { const {
title,
isBoldTitle,
color, color,
hasSeperator, defaultTitle,
fontSize, fontSize,
hasSeperator,
iconName, iconName,
isBoldTitle,
title,
} = this.props; } = this.props;
return ( return (
@ -44,7 +45,7 @@ class ContainerHeaderView extends Component {
fontSize && { fontSize: fontSize }, fontSize && { fontSize: fontSize },
]} ]}
> >
{title} {title ? title : defaultTitle}
</Text> </Text>
{iconName && <Ionicons style={styles.icon} name={iconName} />} {iconName && <Ionicons style={styles.icon} name={iconName} />}
</View> </View>

View File

@ -3,7 +3,7 @@ import { View, Image, Text } from "react-native";
import { DropdownButton } from "../../../components/dropdownButton"; import { DropdownButton } from "../../../components/dropdownButton";
// Constants // Constants
import TEMP_IMAGE from "../../../assets/drawer-cover.png"; import DEFAULT_IMAGE from "../../../assets/default_cover_image.png";
// Components // Components
import { TextWithIcon } from "../../basicUIElements"; import { TextWithIcon } from "../../basicUIElements";
@ -59,7 +59,7 @@ class ProfileSummaryView extends Component {
<Image <Image
style={styles.longImage} style={styles.longImage}
source={{ uri: coverImage }} source={{ uri: coverImage }}
defaultSource={TEMP_IMAGE} defaultSource={DEFAULT_IMAGE}
/> />
<PercentBar percent={percent} margin={24}> <PercentBar percent={percent} margin={24}>
<View style={styles.percentTitleWrapper}> <View style={styles.percentTitleWrapper}>

View File

@ -8,13 +8,11 @@ import FastImage from "react-native-fast-image";
// Components // Components
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view"; import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
import { TabBar } from "../../../components/tabBar"; import { TabBar } from "../../../components/tabBar";
import DiscoverPage from "../../discover/discover";
import { PostCard } from "../../../components/postCard"; import { PostCard } from "../../../components/postCard";
import { ProfileSummary } from "../../../components/profileSummary"; import { ProfileSummary } from "../../../components/profileSummary";
import Comment from "../../../components/comment/comment"; import Comment from "../../../components/comment/comment";
import { FilterBar } from "../../../components/filterBar"; import { FilterBar } from "../../../components/filterBar";
import { DropdownButton } from "../../../components/dropdownButton"; import { NoPost } from "../../../components/basicUIElements";
// Utilitites // Utilitites
import { getUserData, getAuthStatus } from "../../../realm/realm"; import { getUserData, getAuthStatus } from "../../../realm/realm";
import { import {
@ -176,36 +174,45 @@ class ProfileScreen extends React.Component {
}); });
}; };
_getPostRenderItem = () => {};
render() { render() {
const { const {
user, user,
follows, follows,
about,
posts, posts,
commments, commments,
isLoggedIn, isLoggedIn,
isLoading, isLoading,
about,
} = this.state; } = this.state;
let _about, cover_image, location, website;
const votingPower = user && user.voting_power && user.voting_power / 100;
const fullInHour = Math.ceil((100 - votingPower) * 0.833333);
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); if (about) {
location = about.location;
_about = about.about;
website = about.website;
cover_image = about.cover_image;
}
console.log(this.state); console.log(this.state);
console.log(this.props);
const votingPower = user.voting_power && user.voting_power / 100;
const fullIn = Math.ceil((100 - votingPower) * 0.833333);
return ( return (
<View style={styles.container}> <View style={styles.container}>
<CollapsibleCard title={about.about} expanded={true}> <CollapsibleCard
title={_about}
defaultTitle="Profile details"
expanded={true}
>
<ProfileSummary <ProfileSummary
percent={votingPower} percent={votingPower}
hours={fullIn} hours={fullInHour}
location={about.location} location={location}
link={about.website} link={website}
date={getFormatedCreatedDate(user.created)} date={getFormatedCreatedDate(user && user.created)}
followerCount={follows.follower_count} followerCount={follows.follower_count}
followingCount={follows.following_count} followingCount={follows.following_count}
coverImage={about.cover_image} coverImage={cover_image}
/> />
</CollapsibleCard> </CollapsibleCard>
@ -236,40 +243,48 @@ class ProfileScreen extends React.Component {
onDropdownSelect={this._handleOnDropdownSelect} onDropdownSelect={this._handleOnDropdownSelect}
rightIconName="md-apps" rightIconName="md-apps"
/> />
<FlatList {posts && posts.length > 0 ? (
data={posts} <FlatList
showsVerticalScrollIndicator={false} data={posts}
renderItem={({ item }) => ( showsVerticalScrollIndicator={false}
<PostCard renderItem={({ item }) => (
style={{ <PostCard
shadowColor: "#f6f6f6", style={{
}} shadowColor: "#f6f6f6",
content={item} }}
user={user} content={item}
isLoggedIn={true} user={user}
/> isLoggedIn={true}
)} />
keyExtractor={(post, index) => index.toString()} )}
onEndReached={info => { keyExtractor={(post, index) => index.toString()}
if (!isLoading) { onEndReached={info => {
this._getMore(); if (!isLoading) {
} this._getMore();
}} }
onEndThreshold={0} }}
bounces={false} onEndThreshold={0}
/> bounces={false}
/>
) : (
<NoPost name={user.name} text="haven't posted anything yet" />
)}
</View> </View>
<View tabLabel="Comments" style={styles.commentsTabBar}> <View tabLabel="Comments" style={styles.commentsTabBar}>
<FlatList {commments && commments.length > 0 ? (
data={commments} <FlatList
showsVerticalScrollIndicator={false} data={commments}
renderItem={({ item }) => ( showsVerticalScrollIndicator={false}
<Comment comment={item} isLoggedIn={true} user={user} /> renderItem={({ item }) => (
)} <Comment comment={item} isLoggedIn={true} user={user} />
keyExtractor={(post, index) => index.toString()} )}
onEndThreshold={0} keyExtractor={(post, index) => index.toString()}
bounces={false} onEndThreshold={0}
/> bounces={false}
/>
) : (
<NoPost name={user.name} text="haven't commented anything yet" />
)}
</View> </View>
<View tabLabel={"$" + user.balance}> <View tabLabel={"$" + user.balance}>
<Card> <Card>