Skip to content

Commit b053fe9

Browse files
authored
Merge pull request #2915 from ecency/nt/feed-query
Nt/feed query
2 parents b64c750 + 1a4ffc1 commit b053fe9

File tree

15 files changed

+579
-692
lines changed

15 files changed

+579
-692
lines changed

src/components/postCard/children/postCardHeader.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@ interface Props {
1919
intl: IntlShape;
2020
content: any;
2121
isHideImage: boolean;
22+
pageType?: 'main' | 'community' | 'profile' | 'ownProfile';
2223
handleCardInteraction: (id: PostCardActionIds, payload?: any) => void;
2324
}
2425

25-
export const PostCardHeader = ({ intl, content, isHideImage, handleCardInteraction }: Props) => {
26+
export const PostCardHeader = ({
27+
intl,
28+
content,
29+
pageType,
30+
isHideImage,
31+
handleCardInteraction,
32+
}: Props) => {
2633
const rebloggedBy = get(content, 'reblogged_by[0]', null);
2734
const dateString = useMemo(() => getTimeFromNow(content?.created), [content]);
2835
const _isPollPost =
@@ -32,6 +39,14 @@ export const PostCardHeader = ({ intl, content, isHideImage, handleCardInteracti
3239
handleCardInteraction(PostCardActionIds.NAVIGATE, navParams);
3340
};
3441

42+
// handle pinned status
43+
const _isPinned =
44+
pageType === 'community'
45+
? content?.stats?.is_pinned
46+
: pageType === 'profile' || pageType === 'ownProfile'
47+
? content?.stats?.is_pinned_blog
48+
: false;
49+
3550
return (
3651
<>
3752
{!!rebloggedBy && (
@@ -65,7 +80,7 @@ export const PostCardHeader = ({ intl, content, isHideImage, handleCardInteracti
6580
{_isPollPost && (
6681
<Icon style={styles.pollPostIcon} size={16} name="chart" iconType="SimpleLineIcons" />
6782
)}
68-
{(content?.stats?.is_pinned || content?.stats?.is_pinned_blog) && (
83+
{_isPinned && (
6984
<Icon
7085
style={styles.pushPinIcon}
7186
size={20}

src/components/postCard/container/postCard.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const PostCard = ({
2828
isHideImage,
2929
nsfw,
3030
imageRatio,
31+
pageType,
3132
setImageRatio,
3233
handleCardInteraction,
3334
}) => {
@@ -36,6 +37,7 @@ const PostCard = ({
3637
<PostCardHeader
3738
intl={intl}
3839
content={content}
40+
pageType={pageType}
3941
isHideImage={isHideImage}
4042
handleCardInteraction={handleCardInteraction}
4143
/>

src/components/postsList/container/postsListContainer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ const postsListContainer = (
219219
intl={intl}
220220
key={`${item.author}-${item.permlink}`}
221221
content={item}
222+
pageType={pageType}
222223
isHideImage={isHideImages}
223224
nsfw={nsfw}
224225
imageRatio={imgRatio}

src/components/tabbedPosts/container/tabbedPosts.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { useState } from 'react';
22
import ScrollableTabView from 'react-native-scrollable-tab-view';
3-
import { TabbedPostsProps } from '../services/tabbedPostsModels';
3+
import { TabbedPostsProps } from '../types/tabbedPosts.types';
44
import { StackedTabBar, TabItem } from '../view/stackedTabBar';
5-
import TabContent from '../view/tabContent';
5+
import PostsTabContent from '../view/postsTabContent';
66

77
export const TabbedPosts = ({
88
filterOptions,
@@ -67,7 +67,7 @@ export const TabbedPosts = ({
6767
}
6868

6969
return (
70-
<TabContent
70+
<PostsTabContent
7171
key={filter.filterKey}
7272
filterKey={filter.filterKey}
7373
isFeedScreen={isFeedScreen}

src/components/tabbedPosts/services/tabbedPostsFetch.ts

Lines changed: 0 additions & 195 deletions
This file was deleted.

src/components/tabbedPosts/services/tabbedPostsHelpers.ts

Lines changed: 0 additions & 77 deletions
This file was deleted.

src/components/tabbedPosts/services/tabbedPostsModels.ts renamed to src/components/tabbedPosts/types/tabbedPosts.types.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,7 @@ export interface TabbedPostsProps {
1818
handleOnScroll: () => void;
1919
}
2020

21-
export interface TabMeta {
22-
startPermlink: string;
23-
startAuthor: string;
24-
isLoading: boolean;
25-
isRefreshing: boolean;
26-
isNoPost: boolean;
27-
}
28-
29-
export interface LoadPostsOptions {
30-
filterKey: string;
31-
prevPosts: any[];
32-
tabMeta: TabMeta;
33-
34-
setTabMeta: (meta: TabMeta) => void;
35-
getFor: string;
36-
isConnected: boolean;
37-
isLoggedIn: boolean;
38-
feedUsername: string;
39-
pinnedPermlink: string;
40-
pageType: string;
41-
tag: string;
42-
nsfw: string;
43-
isLatestPostsCheck?: boolean;
44-
refreshing?: boolean;
45-
}
46-
47-
export interface TabContentProps {
21+
export interface PostsTabContentProps {
4822
filterKey: string;
4923
isFeedScreen: boolean;
5024
isInitialTab: boolean;

0 commit comments

Comments
 (0)