Fixed github comments

This commit is contained in:
Furkan Kılıç 2021-01-18 22:30:13 +03:00
parent ef4e15baa1
commit cc89b2ffe6
11 changed files with 20 additions and 20 deletions

View File

@ -62,7 +62,7 @@ const CommunitiesList = ({
{!noResult && (
<FlatList
data={data}
keyExtractor={(item, index) => index}
keyExtractor={(item, index) => index.toString()}
renderItem={_renderItem}
ListEmptyComponent={_renderEmptyContent}
/>

View File

@ -28,7 +28,7 @@ const SubscribedCommunitiesListView = ({
return (
<FlatList
data={data}
keyExtractor={(item, ind) => ind}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item, index }) => (
<View style={[styles.communityWrapper, index % 2 !== 0 && styles.itemWrapperGray]}>
<View style={{ flex: 3, flexDirection: 'row', alignItems: 'center' }}>

View File

@ -583,7 +583,7 @@
"unfollow": "Unfollow"
},
"communities": {
"joined": "Joined",
"joined": "Membership",
"discover": "Discover"
}
}

View File

@ -1138,9 +1138,9 @@ export const lookupAccounts = async (username) => {
}
};
export const getTrendingTags = async (tag) => {
export const getTrendingTags = async (tag, number = 20) => {
try {
const tags = await client.database.call('get_trending_tags', [tag, 20]);
const tags = await client.database.call('get_trending_tags', [tag, number]);
return tags;
} catch (error) {
return [];

View File

@ -10,7 +10,7 @@ import { getPost, getAccountPosts } from '../../../../../../providers/hive/dhive
const PostsResultsContainer = ({ children, navigation, searchValue, currentAccountUsername }) => {
const [data, setData] = useState([]);
const [sort, setSort] = useState('relevance');
const [sort, setSort] = useState('newest');
const [scrollId, setScrollId] = useState('');
const [noResult, setNoResult] = useState(false);

View File

@ -26,12 +26,15 @@ const PostsResults = ({ navigation, searchValue }) => {
const intl = useIntl();
const _renderItem = (item, index) => {
const reputation =
get(item, 'author_rep', undefined) || get(item, 'author_reputation', undefined);
return (
<View style={[styles.itemWrapper, index % 2 !== 0 && styles.itemWrapperGray]}>
<PostHeaderDescription
date={getTimeFromNow(get(item, 'created_at'))}
name={get(item, 'author')}
reputation={Math.floor(get(item, 'author_rep'))}
reputation={Math.floor(reputation)}
size={36}
tag={item.category}
/>
@ -90,7 +93,7 @@ const PostsResults = ({ navigation, searchValue }) => {
) : (
<FlatList
data={data}
keyExtractor={(item, index) => index}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item, index }) => (
<TouchableOpacity onPress={() => handleOnPress(item)}>
{_renderItem(item, index)}

View File

@ -45,7 +45,7 @@ const CommunitiesResultsContainer = ({ children, navigation, searchValue }) => {
setNoResult(false);
getSubscriptions(currentAccount.username).then((subs) => {
getCommunities('', searchValue ? 100 : 20, searchValue, 'rank').then((communities) => {
getCommunities('', searchValue ? 250 : 20, searchValue, 'rank').then((communities) => {
communities.forEach((community) =>
Object.assign(community, {
isSubscribed: subs.some(

View File

@ -32,7 +32,7 @@ const PeopleResults = ({ navigation, searchValue }) => {
) : (
<FlatList
data={users}
keyExtractor={(item, index) => index}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item, index }) => (
<UserListItem
handleOnPress={() => handleOnPress(item)}

View File

@ -13,16 +13,13 @@ const OtherResultContainer = (props) => {
const [tags, setTags] = useState([]);
const [noResult, setNoResult] = useState(false);
const { children, navigation, searchValue, username } = props;
const { children, navigation, searchValue } = props;
useEffect(() => {
setNoResult(false);
setTags([]);
if (searchValue.length > 10) {
setNoResult(true);
} else {
getTrendingTags(searchValue.trim()).then((res) => {
if (searchValue.length <= 10) {
setNoResult(false);
setTags([]);
getTrendingTags(searchValue.trim(), 100).then((res) => {
const data = res?.filter((item) => !isCommunity(item.name));
if (data.length === 0) {
setNoResult(true);

View File

@ -36,7 +36,7 @@ const TopicsResults = ({ navigation, searchValue }) => {
) : (
<FlatList
data={tags}
keyExtractor={(item, index) => index}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item, index }) => (
<TouchableOpacity onPress={() => handleOnPress(item)}>
{_renderTagItem(item, index)}

View File

@ -1,7 +1,7 @@
import { isNumber } from 'lodash';
export const isCommunity = (text) => {
if (/^hive-\d+/.test(text) && text.length === 11 && isNumber(Number(text.split('-')[1]))) {
if (/hive-[1-3]\d{4,6}$/.test(text) && isNumber(Number(text.split('-')[1]))) {
return true;
}