mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-13 09:34:20 +03:00
commit
0fdac9e24e
@ -28,35 +28,33 @@ const TagContainer = ({
|
|||||||
style,
|
style,
|
||||||
textStyle,
|
textStyle,
|
||||||
disabled,
|
disabled,
|
||||||
|
communityTitle,
|
||||||
}) => {
|
}) => {
|
||||||
const [label, setLabel] = useState(value);
|
const [label, setLabel] = useState(value);
|
||||||
const [isCommunity, setIsCommunity] = useState(false);
|
const [isCommunity, setIsCommunity] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let isCancelled = false;
|
if (value && /hive-[1-3]\d{4,6}$/.test(value)) {
|
||||||
if (value && /^hive-\d+/.test(value)) {
|
if (communityTitle) {
|
||||||
|
setLabel(communityTitle);
|
||||||
|
setIsCommunity(true);
|
||||||
|
} else {
|
||||||
getCommunityTitle(value)
|
getCommunityTitle(value)
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
if (!isCancelled) {
|
|
||||||
setLabel(r);
|
setLabel(r);
|
||||||
setIsCommunity(value !== r);
|
setIsCommunity(value !== r);
|
||||||
return r;
|
return r;
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
if (!isCancelled) {
|
|
||||||
setLabel(value);
|
setLabel(value);
|
||||||
setIsCommunity(/^hive-\d+/.test(value));
|
setIsCommunity(/hive-[1-3]\d{4,6}$/.test(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setLabel(value);
|
setLabel(value);
|
||||||
setIsCommunity(false);
|
setIsCommunity(false);
|
||||||
}
|
}
|
||||||
return () => {
|
|
||||||
isCancelled = true;
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Component Functions
|
// Component Functions
|
||||||
|
@ -37,7 +37,7 @@ const SelectCommunityModalView = ({
|
|||||||
renderItem={({ item, index, separators }) => (
|
renderItem={({ item, index, separators }) => (
|
||||||
<CommunityCard
|
<CommunityCard
|
||||||
community={item}
|
community={item}
|
||||||
key={index}
|
key={index.toString()}
|
||||||
onPress={onPressCommunity}
|
onPress={onPressCommunity}
|
||||||
separators={separators}
|
separators={separators}
|
||||||
/>
|
/>
|
||||||
|
@ -39,25 +39,25 @@ const PostCardContainer = ({
|
|||||||
}, [isRefresh]);
|
}, [isRefresh]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (content) {
|
if (_content) {
|
||||||
setActiveVotes(get(content, 'active_votes', []));
|
setActiveVotes(get(_content, 'active_votes', []));
|
||||||
|
|
||||||
getPostReblogs(content).then((result) => {
|
getPostReblogs(_content).then((result) => {
|
||||||
setReblogs(result);
|
setReblogs(result);
|
||||||
});
|
});
|
||||||
setContent(content);
|
setContent(_content);
|
||||||
}
|
}
|
||||||
}, [content]);
|
}, [_content]);
|
||||||
|
|
||||||
const _handleOnUserPress = () => {
|
const _handleOnUserPress = () => {
|
||||||
if (content && get(currentAccount, 'name') !== get(content, 'author')) {
|
if (_content && get(currentAccount, 'name') !== get(_content, 'author')) {
|
||||||
navigation.navigate({
|
navigation.navigate({
|
||||||
routeName: ROUTES.SCREENS.PROFILE,
|
routeName: ROUTES.SCREENS.PROFILE,
|
||||||
params: {
|
params: {
|
||||||
username: get(content, 'author'),
|
username: get(_content, 'author'),
|
||||||
reputation: get(content, 'author_reputation'),
|
reputation: get(_content, 'author_reputation'),
|
||||||
},
|
},
|
||||||
key: get(content, 'author'),
|
key: get(_content, 'author'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -79,9 +79,9 @@ const PostCardContainer = ({
|
|||||||
routeName: ROUTES.SCREENS.VOTERS,
|
routeName: ROUTES.SCREENS.VOTERS,
|
||||||
params: {
|
params: {
|
||||||
activeVotes,
|
activeVotes,
|
||||||
content,
|
content: _content,
|
||||||
},
|
},
|
||||||
key: get(content, 'permlink'),
|
key: get(_content, 'permlink'),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -91,12 +91,16 @@ const PostCardContainer = ({
|
|||||||
params: {
|
params: {
|
||||||
reblogs,
|
reblogs,
|
||||||
},
|
},
|
||||||
key: get(content, 'permlink', get(content, 'author', '')),
|
key: get(_content, 'permlink', get(_content, 'author', '')),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const _fetchPost = async () => {
|
const _fetchPost = async () => {
|
||||||
await getPost(get(content, 'author'), get(content, 'permlink'), get(currentAccount, 'username'))
|
await getPost(
|
||||||
|
get(_content, 'author'),
|
||||||
|
get(_content, 'permlink'),
|
||||||
|
get(currentAccount, 'username'),
|
||||||
|
)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
setContent(result);
|
setContent(result);
|
||||||
|
@ -102,7 +102,7 @@ const PostCardView = ({
|
|||||||
profileOnPress={_handleOnUserPress}
|
profileOnPress={_handleOnUserPress}
|
||||||
reputation={get(content, 'author_reputation')}
|
reputation={get(content, 'author_reputation')}
|
||||||
size={36}
|
size={36}
|
||||||
tag={content.category}
|
content={content}
|
||||||
rebloggedBy={rebloggedBy}
|
rebloggedBy={rebloggedBy}
|
||||||
isPromoted={get(content, 'is_promoted')}
|
isPromoted={get(content, 'is_promoted')}
|
||||||
/>
|
/>
|
||||||
|
@ -46,6 +46,7 @@ class PostHeaderDescription extends PureComponent {
|
|||||||
reputation,
|
reputation,
|
||||||
size,
|
size,
|
||||||
tag,
|
tag,
|
||||||
|
content,
|
||||||
tagOnPress,
|
tagOnPress,
|
||||||
isShowOwnerIndicator,
|
isShowOwnerIndicator,
|
||||||
isPromoted,
|
isPromoted,
|
||||||
@ -90,6 +91,16 @@ class PostHeaderDescription extends PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.rightContainer}>
|
<View style={styles.rightContainer}>
|
||||||
|
{!!content && (
|
||||||
|
<TouchableOpacity onPress={() => tagOnPress && tagOnPress()}>
|
||||||
|
<Tag
|
||||||
|
isPostCardTag={!isPromoted}
|
||||||
|
isPin
|
||||||
|
value={content.category}
|
||||||
|
communityTitle={content.community_title}
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
{!!tag && (
|
{!!tag && (
|
||||||
<TouchableOpacity onPress={() => tagOnPress && tagOnPress()}>
|
<TouchableOpacity onPress={() => tagOnPress && tagOnPress()}>
|
||||||
<Tag isPostCardTag={!isPromoted} isPin value={tag} />
|
<Tag isPostCardTag={!isPromoted} isPin value={tag} />
|
||||||
|
@ -198,7 +198,7 @@ const PostDisplayView = ({
|
|||||||
name={author || post.author}
|
name={author || post.author}
|
||||||
currentAccountUsername={name}
|
currentAccountUsername={name}
|
||||||
reputation={post.author_reputation}
|
reputation={post.author_reputation}
|
||||||
tag={post.category}
|
content={post}
|
||||||
size={36}
|
size={36}
|
||||||
/>
|
/>
|
||||||
<PostBody body={post.body} />
|
<PostBody body={post.body} />
|
||||||
|
@ -255,7 +255,7 @@ const PostsContainer = ({
|
|||||||
const filter = type || selectedFilterValue;
|
const filter = type || selectedFilterValue;
|
||||||
const subfilter = selectedFeedSubfilterValue;
|
const subfilter = selectedFeedSubfilterValue;
|
||||||
let options = {};
|
let options = {};
|
||||||
const limit = 7;
|
const limit = 5;
|
||||||
let func = null;
|
let func = null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -319,7 +319,7 @@ const PostsContainer = ({
|
|||||||
_posts = unionBy(posts, _posts, 'permlink');
|
_posts = unionBy(posts, _posts, 'permlink');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (posts.length <= 7 && pageType !== 'profiles') {
|
if (posts.length <= 5 && pageType !== 'profiles') {
|
||||||
_setFeedPosts(_posts);
|
_setFeedPosts(_posts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user