aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/moments/MomentPost.tsx8
-rw-r--r--src/components/moments/MomentPostContent.tsx24
-rw-r--r--src/components/moments/MomentPostHeader.tsx12
3 files changed, 20 insertions, 24 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index 7149a5b4..e744fcd9 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -76,18 +76,16 @@ const MomentPost: React.FC<MomentPostProps> = ({item, userXId, screenType}) => {
userXId={userXId}
screenType={screenType}
username={isOwnProfile ? loggedInUsername : username}
- momentId={item.moment_id}
style={styles.postHeader}
momentTagId={momentTagId}
removeTag={removeTag}
+ moment={item}
+ tags={tags}
/>
<MomentPostContent
style={styles.postContent}
- momentId={item.moment_id}
- caption={item.caption}
- pathHash={item.moment_url}
- dateTime={item.date_created}
screenType={screenType}
+ moment={item}
momentTags={tags}
/>
</View>
diff --git a/src/components/moments/MomentPostContent.tsx b/src/components/moments/MomentPostContent.tsx
index 4a1f3894..153833d7 100644
--- a/src/components/moments/MomentPostContent.tsx
+++ b/src/components/moments/MomentPostContent.tsx
@@ -6,7 +6,7 @@ import Animated, {Easing} from 'react-native-reanimated';
import {useDispatch, useStore} from 'react-redux';
import {getCommentsCount} from '../../services';
import {RootState} from '../../store/rootReducer';
-import {MomentTagType, ScreenType, UserType} from '../../types';
+import {MomentTagType, MomentType, ScreenType, UserType} from '../../types';
import {
getTimePosted,
navigateToProfile,
@@ -20,19 +20,13 @@ import {MomentTags} from '../common';
interface MomentPostContentProps extends ViewProps {
screenType: ScreenType;
- momentId: string;
- caption: string;
- pathHash: string;
- dateTime: string;
+ moment: MomentType;
momentTags: MomentTagType[];
}
const MomentPostContent: React.FC<MomentPostContentProps> = ({
screenType,
- momentId,
- caption,
- pathHash,
- dateTime,
style,
+ moment,
momentTags,
}) => {
const state: RootState = useStore().getState();
@@ -54,12 +48,12 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({
useEffect(() => {
const fetchCommentsCount = async () => {
- const count = await getCommentsCount(momentId, false);
+ const count = await getCommentsCount(moment.moment_id, false);
setCommentsCount(count);
};
- setElapsedTime(getTimePosted(dateTime));
+ setElapsedTime(getTimePosted(moment.date_created));
fetchCommentsCount();
- }, [dateTime, momentId]);
+ }, [moment.date_created, moment.moment_id]);
useEffect(() => {
const fade = async () => {
@@ -82,7 +76,7 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({
<Image
ref={imageRef}
style={styles.image}
- source={{uri: pathHash}}
+ source={{uri: moment.moment_url}}
resizeMode={'cover'}
/>
{tags.length > 0 && (
@@ -100,13 +94,13 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({
<View style={styles.footerContainer}>
<CommentsCount
commentsCount={comments_count}
- momentId={momentId}
+ momentId={moment.moment_id}
screenType={screenType}
/>
<Text style={styles.text}>{elapsedTime}</Text>
</View>
{renderTextWithMentions({
- value: caption,
+ value: moment.caption,
styles: styles.captionText,
partTypes: mentionPartTypes('white'),
onPress: (user: UserType) =>
diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx
index dc6a3cd9..cde7639c 100644
--- a/src/components/moments/MomentPostHeader.tsx
+++ b/src/components/moments/MomentPostHeader.tsx
@@ -10,7 +10,7 @@ import {
import {useDispatch, useSelector, useStore} from 'react-redux';
import {loadUserMoments} from '../../store/actions';
import {RootState} from '../../store/rootReducer';
-import {ScreenType} from '../../types';
+import {MomentTagType, MomentType, ScreenType} from '../../types';
import {fetchUserX, userXInStore} from '../../utils';
import {MomentMoreInfoDrawer} from '../profile';
import TaggAvatar from '../profile/TaggAvatar';
@@ -19,19 +19,21 @@ interface MomentPostHeaderProps extends ViewProps {
userXId?: string;
screenType: ScreenType;
username: string;
- momentId: string;
momentTagId: string;
removeTag: () => Promise<void>;
+ moment: MomentType;
+ tags: MomentTagType[];
}
const MomentPostHeader: React.FC<MomentPostHeaderProps> = ({
userXId,
screenType,
username,
- momentId,
style,
momentTagId,
removeTag,
+ moment,
+ tags,
}) => {
const [drawerVisible, setDrawerVisible] = useState(false);
const dispatch = useDispatch();
@@ -68,7 +70,6 @@ const MomentPostHeader: React.FC<MomentPostHeaderProps> = ({
<MomentMoreInfoDrawer
isOpen={drawerVisible}
setIsOpen={setDrawerVisible}
- momentId={momentId}
isOwnProfile={isOwnProfile}
momentTagId={momentTagId}
removeTag={removeTag}
@@ -76,6 +77,9 @@ const MomentPostHeader: React.FC<MomentPostHeaderProps> = ({
dispatch(loadUserMoments(loggedInUserId));
navigation.pop();
}}
+ screenType={screenType}
+ moment={moment}
+ tags={tags}
/>
</View>
);