aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/screens/profile/IndividualMoment.tsx39
1 files changed, 4 insertions, 35 deletions
diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx
index 515cbacf..4ad4515d 100644
--- a/src/screens/profile/IndividualMoment.tsx
+++ b/src/screens/profile/IndividualMoment.tsx
@@ -4,11 +4,7 @@ import {StackNavigationProp} from '@react-navigation/stack';
import React from 'react';
import {FlatList, StyleSheet, View} from 'react-native';
import {useSelector} from 'react-redux';
-import {
- IndividualMomentTitleBar,
- MomentPostContent,
- MomentPostHeader,
-} from '../../components';
+import {IndividualMomentTitleBar, MomentPost} from '../../components';
import {MainStackParams} from '../../routes';
import {RootState} from '../../store/rootreducer';
import {MomentType} from '../../types';
@@ -35,45 +31,16 @@ const IndividualMoment: React.FC<IndividualMomentProps> = ({
}) => {
const {moment_category, moment_id} = route.params.moment;
const {userXId, screenType} = route.params;
- const {username: loggedInUsername} = useSelector(
- (state: RootState) => state.user.user,
- );
- const {
- user: {username},
- } = useSelector((state: RootState) =>
- userXId ? state.userX[screenType][userXId] : state.user,
- );
const {moments} = useSelector((state: RootState) =>
userXId ? state.userX[screenType][userXId] : state.moments,
);
- const isOwnProfile = username === loggedInUsername;
const momentData = moments.filter(
(m) => m.moment_category === moment_category,
);
const initialIndex = momentData.findIndex((m) => m.moment_id === moment_id);
- const renderMomentPost = ({item}: {item: MomentType}) => (
- <View style={styles.postContainer}>
- <MomentPostHeader
- userXId={userXId}
- screenType={screenType}
- username={isOwnProfile ? loggedInUsername : username}
- momentId={item.moment_id}
- style={styles.postHeader}
- />
- <MomentPostContent
- style={styles.postContent}
- momentId={item.moment_id}
- caption={item.caption}
- pathHash={item.moment_url}
- dateTime={item.date_created}
- screenType={screenType}
- />
- </View>
- );
-
return (
<BlurView
blurType="light"
@@ -88,7 +55,9 @@ const IndividualMoment: React.FC<IndividualMomentProps> = ({
<View style={styles.content}>
<FlatList
data={momentData}
- renderItem={renderMomentPost}
+ renderItem={({item}: {item: MomentType}) => (
+ <MomentPost userXId={userXId} screenType={screenType} item={item} />
+ )}
keyExtractor={(item, index) => index.toString()}
showsVerticalScrollIndicator={false}
snapToAlignment={'start'}