Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nt/wave media #2758

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/comments/container/commentsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const CommentsContainer = ({
incrementRepliesCount,
handleOnReplyPress,
handleOnCommentsLoaded,
postType
}) => {
const navigation = useNavigation();
const postsCachePrimer = postQueries.usePostsCachePrimer();
Expand Down Expand Up @@ -318,6 +319,7 @@ const CommentsContainer = ({
fetchedAt={fetchedAt}
postContentView={postContentView}
isLoading={isLoading}
postType={postType}
/>
);
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/comments/view/commentsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const CommentsView = ({
incrementRepliesCount,
postContentView,
isLoading,
postType
}) => {
const [selectedComment, setSelectedComment] = useState(null);
const intl = useIntl();
Expand Down Expand Up @@ -192,7 +193,7 @@ const CommentsView = ({
/>
)}
<UpvotePopover ref={upvotePopoverRef} />
<PostHtmlInteractionHandler ref={postInteractionRef} />
<PostHtmlInteractionHandler ref={postInteractionRef} postType={postType} />
</Fragment>
);
};
Expand Down
16 changes: 14 additions & 2 deletions src/components/postHtmlRenderer/postInteractionHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ import { useDispatch } from 'react-redux';
import { useNavigation } from '@react-navigation/native';
import { IconButton } from '../buttons';
import styles from './postHtmlRendererStyles'
import { PostTypes } from '../../constants/postTypes';

export const PostHtmlInteractionHandler = forwardRef(({ }, ref) => {
interface PostHtmlInteractionHandlerProps {
postType?:PostTypes
}

export const PostHtmlInteractionHandler = forwardRef(({
postType
}:PostHtmlInteractionHandlerProps, ref) => {

const navigation = useNavigation();
const dispatch = useDispatch();
Expand All @@ -51,7 +58,12 @@ export const PostHtmlInteractionHandler = forwardRef(({ }, ref) => {
handleImagePress: (url: string, postImgUrls: string[]) => {
setPostImages(postImgUrls);
setSelectedImage(url);
actionImage.current?.show();
if(postType === PostTypes.WAVE){
setIsImageModalOpen(true);
} else {
actionImage.current?.show();
}

},
handleLinkPress: (url: string) => {
setSelectedLink(url);
Expand Down
7 changes: 5 additions & 2 deletions src/providers/queries/postQueries/wavesQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@tanstack/react-query';
import { useEffect, useMemo, useRef, useState } from 'react';

import { unionBy } from 'lodash';
import { unionBy, isArray } from 'lodash';
import { getDiscussionCollection } from '../../hive/dhive';

import { getAccountPosts } from '../../hive/dhive';
Expand Down Expand Up @@ -222,7 +222,10 @@ export const useWavesQuery = (host: string) => {


const _data = unionBy(...wavesQueries.map((query) => query.data), 'url');
const _filteredData = useMemo(() =>{ console.log('filtering waves'); return _data.filter(post => mutes.indexOf(post?.author) < 0)}, [mutes, _data])

const _filteredData = useMemo(() =>
_data.filter(post => isArray(mutes) ? mutes.indexOf(post?.author) < 0 : true),
[mutes, _data])

return {
data: _filteredData,
Expand Down
2 changes: 2 additions & 0 deletions src/screens/waves/screen/wavesScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styles from '../styles/wavesScreen.styles';
import { wavesQueries } from '../../../providers/queries';
import { useAppSelector } from '../../../hooks';
import WavesHeader from '../children/wavesHeader';
import { PostTypes } from '../../../constants/postTypes';


const WavesScreen = () => {
Expand Down Expand Up @@ -47,6 +48,7 @@ const WavesScreen = () => {

<View style={{ flex: 1 }}>
<Comments
postType={PostTypes.WAVE}
comments={_data}
handleOnOptionsPress={_handleOnOptionsPress}
flatListProps={{
Expand Down