aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-08 14:20:57 -0400
committerIvan Chen <ivan@tagg.id>2021-06-08 16:18:34 -0400
commitf8dd6b8ef033039278e2931876488c307f5d5adc (patch)
tree3303e77f4a8991b8ff9c95b638849efa23b32b7b /src/components
parent96a80c53fcc0b5815b56f0ed0b48d152a6c6e2a4 (diff)
Create MomentPostType
Diffstat (limited to 'src/components')
-rw-r--r--src/components/moments/MomentPost.tsx22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index 1f363052..4f8bb63f 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -4,16 +4,20 @@ import {useSelector} from 'react-redux';
import {MomentPostContent, MomentPostHeader} from '.';
import {deleteMomentTag, loadMomentTags} from '../../services';
import {RootState} from '../../store/rootReducer';
-import {MomentTagType, MomentType, ScreenType} from '../../types';
+import {MomentPostType, MomentTagType, ScreenType} from '../../types';
import {SCREEN_HEIGHT} from '../../utils';
interface MomentPostProps {
- item: MomentType;
+ moment: MomentPostType;
userXId: string | undefined;
screenType: ScreenType;
}
-const MomentPost: React.FC<MomentPostProps> = ({item, userXId, screenType}) => {
+const MomentPost: React.FC<MomentPostProps> = ({
+ moment,
+ userXId,
+ screenType,
+}) => {
const {userId: loggedInUserId, username: loggedInUsername} = useSelector(
(state: RootState) => state.user.user,
);
@@ -29,7 +33,7 @@ const MomentPost: React.FC<MomentPostProps> = ({item, userXId, screenType}) => {
const isOwnProfile = username === loggedInUsername;
const loadTags = async () => {
- const response = await loadMomentTags(item.moment_id);
+ const response = await loadMomentTags(moment.moment_id);
setTags(response ? response : []);
};
@@ -74,17 +78,17 @@ const MomentPost: React.FC<MomentPostProps> = ({item, userXId, screenType}) => {
userXId={userXId}
screenType={screenType}
username={isOwnProfile ? loggedInUsername : username}
- momentId={item.moment_id}
+ momentId={moment.moment_id}
style={styles.postHeader}
momentTagId={momentTagId}
removeTag={removeTag}
/>
<MomentPostContent
style={styles.postContent}
- momentId={item.moment_id}
- caption={item.caption}
- pathHash={item.moment_url}
- dateTime={item.date_created}
+ momentId={moment.moment_id}
+ caption={moment.caption}
+ pathHash={moment.moment_url}
+ dateTime={moment.date_created}
screenType={screenType}
momentTags={tags}
/>